public interface XMLContentModel extends ContentModel
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.ContentContainer
Modifier and Type | Method and Description |
---|---|
java.lang.Boolean |
getBooleanValue(java.lang.String xpath)
Returns the boolean result of evaluating the specified path expression.
|
java.lang.Number |
getNumericValue(java.lang.String xpath)
Returns the result of evaluating the path with return type of numeric e.g. count
the number of elements that match the path expression.
|
java.lang.String |
getStringValue(java.lang.String xpath,
java.lang.String attribute)
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.
|
java.util.List<java.lang.String> |
getStringValues(java.lang.String xpath,
java.lang.String attribute)
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.
|
java.util.List<java.util.List<java.lang.String>> |
getValuesList(java.lang.String xpath,
java.util.List<java.lang.String> attributes,
boolean includeValue)
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.
|
java.util.Map<java.lang.String,java.util.List<java.lang.String>> |
getValuesMap(java.lang.String xpath,
java.lang.String keyAttribute,
java.util.List<java.lang.String> attributes,
boolean includeValue)
Evaluates the XPath expression to obtain a list of XML nodes and returns a hash
table of the specified attributes.
|
java.lang.String |
getXMLAsString()
Returns the XML as a string.
|
boolean |
isNamespaceAware()
Returns
true if the content model is aware of XML namespaces when
parsing XML documents. |
void |
setNamespaceAware(boolean isAware)
Sets whether the content model is aware of XML namespaces when
parsing XML documents.
|
getContainerName, reset
java.lang.Number getNumericValue(java.lang.String xpath) throws java.lang.Exception
xpath
- the XPath expressionjava.lang.Exception
java.lang.Boolean getBooleanValue(java.lang.String xpath) throws java.lang.Exception
xpath
- the XPath expressionjava.lang.Exception
java.lang.String getStringValue(java.lang.String xpath, java.lang.String attribute) throws java.lang.Exception
xpath
- the XPath expressionattribute
- the name of the attribute to be returned or null
if the XML node value is to be returnedjava.lang.Exception
java.util.List<java.lang.String> getStringValues(java.lang.String xpath, java.lang.String attribute) throws java.lang.Exception
xpath
- the XPath expressionattribute
- the name of the attribute to be returned or null
if the XML node value is to be returnedjava.lang.Exception
java.util.List<java.util.List<java.lang.String>> getValuesList(java.lang.String xpath, java.util.List<java.lang.String> attributes, boolean includeValue) throws java.lang.Exception
includeValue
flag is set
to true
.xpath
- the XPath expressionattributes
- the list of attribute names whose values are to be returned
in each sublistincludeValue
- whether the XML node value should be included at the end
of each sublistjava.lang.Exception
java.util.Map<java.lang.String,java.util.List<java.lang.String>> getValuesMap(java.lang.String xpath, java.lang.String keyAttribute, java.util.List<java.lang.String> attributes, boolean includeValue) throws java.lang.Exception
includeValue
flag is set to true
.xpath
- the XPath expressionkeyAttribute
- attributes
- the list of attribute names whose values are to be returned
in each table entry listincludeValue
- whether the XML node value should be included at the end
of each table entry listjava.lang.Exception
java.lang.String getXMLAsString()
boolean isNamespaceAware()
true
if the content model is aware of XML namespaces when
parsing XML documents. The default value is false
.true
if the content model is aware of XML namespacesvoid setNamespaceAware(boolean isAware)
reset()
is
called to ensure that all internal storage is flushed to ensure any
documents are re-parsed with the new setting.isAware
- whether the content model should be namespace awareContentModel.reset()
Copyright © 2014 Integral Solutions Ltd. All Rights Reserved.