XMLContentModel Objects

Subclass of ContentModel.

An interface that provides a mechanism for accessing the XML content of a ContentContainer. Content is accessed using XPath syntax without having to configure the additional parsers although callers can access the underlying XML text if they prefer to use a different mechanism.

x.getBooleanValue(xpath) : boolean

xpath (string) : the XPath expression

Returns the boolean result of evaluating the specified path expression.

Exceptions:

Exception :

x.getNumericValue(xpath) : Number

xpath (string) : the XPath expression

Returns the result of evaluating the path with return type of numeric. For example, count the number of elements that match the path expression.

Exceptions:

Exception :

x.getStringValue(xpath, attribute) : string

xpath (string) : the XPath expression

attribute (string) : the name of the attribute to be returned or None if the XML node value is to be returned

Evaluates the XPath expression to an XML node and returns either the value of the specified attribute in that node if the attribute name is a non-zero length string or the node value otherwise.

Exceptions:

Exception :

x.getStringValues(xpath, attribute) : List

xpath (string) : the XPath expression

attribute (string) : the name of the attribute to be returned or None if the XML node value is to be returned

Evaluates the XPath expression to a collection of XML nodes and returns a list containing either the value of the specified attribute in that node if the attribute name is a non-zero length string or the node value otherwise.

Exceptions:

Exception :

x.getValuesList(xpath, attributes, includeValue) : List

xpath (string) : the XPath expression

attributes (List) : the list of attribute names whose values are to be returned in each sublist

includeValue (boolean) : whether the XML node value should be included at the end of each sublist

Evaluates the XPath expression to obtain a list of XML nodes and returns a list of lists where each sublist contains the specified values from a particular node. The values of the named attributes are added to each sublist and the node value is added to the end of the sublist if the includeValue flag is set to True.

Exceptions:

Exception :

x.getValuesMap(xpath, keyAttribute, attributes, includeValue) : Map

xpath (string) : the XPath expression

keyAttribute (string) :

attributes (List) : the list of attribute names whose values are to be returned in each table entry list

includeValue (boolean) : whether the XML node value should be included at the end of each table entry list

Evaluates the XPath expression to obtain a list of XML nodes and returns a hash table of the specified attributes. The key for each entry is either the value of the specified key attribute in that node if the key attribute name is a non-zero length string or the node value otherwise. The value for each entry in the table is a list containing the specified values from the key node. The node value is added to the end of each list if the includeValue flag is set to True.

Exceptions:

Exception :

x.getXMLAsString() : string

Returns the XML as a string.

x.isNamespaceAware() : boolean

Returns True if the content model is aware of XML namespaces when parsing XML documents. The default value is False.

x.setNamespaceAware(isAware)

isAware (boolean) : whether the content model should be namespace aware

Sets whether the content model is aware of XML namespaces when parsing XML documents. Moidyfing this value can affect the syntax that should be used in XPath expressions. By default, XML content models are not namespace aware. When the value is changed, reset() is called to ensure that all internal storage is flushed to ensure any documents are re-parsed with the new setting.