@StableMinor(version="12.2", sinceVersion="8.1") public interface IXPath
Document
navigator helper.Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
getMap(String xpath)
Selects a node with the given XPath and converts it to a
Map , by using toMap(Node) . |
Map<String,Object> |
getMap(String xpath,
Node context)
Selects a node with the given XPath and converts it to a
Map , by using toMap(Node) . |
List<Map<String,Object>> |
getMaps(String xpath)
Selects nodes with the given XPath and converts them to a
List of Map , by using
toMap(Node) in each of these nodes. |
List<Map<String,Object>> |
getMaps(String xpath,
Node context)
Selects nodes with the given XPath and converts them to a
List of Map , by using
toMap(Node) in each of these nodes. |
List<Node> |
selectNodes(String xpath)
Returns a
node list with the selected nodes by the given XPath using the document in context. |
List<Node> |
selectNodes(String xpath,
Node context)
Returns a
node list with the selected nodes by the given XPath in the given context . |
Node |
selectSingleNode(String xpath)
Returns a single node selected by the given XPath expression using the document in context.
|
Node |
selectSingleNode(String xpath,
Node context)
Returns a single node selected by the given XPath expression in the given
context . |
Map<String,Object> |
toMap(Node node)
Returns a Map object based on the given node.
|
String |
valueOf(String xpath,
Node context)
Returns the string representation of the evaluated XPath in the given context.
|
String valueOf(String xpath, Node context)
xpath
- the XPath expression.context
- the context node.List<Node> selectNodes(String xpath)
node list
with the selected nodes by the given XPath using the document in context.xpath
- the XPath expression.node list
with the selected nodes by the given XPath.List<Node> selectNodes(String xpath, Node context)
node list
with the selected nodes by the given XPath in the given context
.xpath
- the XPath expression.context
- the context node.node list
with the selected nodes by the given XPath.Node selectSingleNode(String xpath)
null
is returned.xpath
- the XPath expression.Node selectSingleNode(String xpath, Node context)
context
. If more than one node is selected, the first one is
returned. If there's no such node, null
is returned.xpath
- the XPath expression.context
- the context node.Map<String,Object> toMap(Node node)
The conversion rules are as follows:
var myValue = myMap.myNode;
, the variable myValue
will have the value Some textother textanother text
.
If the element node is a simple element node with attributes, then its value will become available under the $
object, inside the node object.
For example, the given XML node:
var myValue = myMap.myNode.$;
, the variable myValue
will have the value Some textother textanother text
.
If the node is a complex node then its text (inner CDATA sections
and text nodes
) will not
be accessible. This kind of node is simply a container for inner nodes.
For example, the given XML node:
myNode
will not be accessible at all and the text of node myOtherNode
will be accessible using myMap.myNode.myOtherNode
.
Another aspect of element nodes is when they are automatically wrapped in arrays. It happens in the following situations:
lumIsArray
with the value true
.lumIsArray
attribute or the value of lumIsArray
attribute is not false
.row
and its parent node name is data
and the child element node either doesn't have the
lumIsArray
attribute or the value of lumIsArray
attribute is not false
.myAttribute
becomes available using the name $myAttribute
.
For example, the given XML node:myAttribute
available using myNode.$myAttribute
.
CDATA sections
or text nodes
(comments
are ignored).CDATA sections
or text nodes
(comments
are ignored).CDATA sections
and text nodes
.
CDATA section
nor a text node
.node
- the node to be transformed in Map
.Map<String,Object> getMap(String xpath, Node context)
Map
, by using toMap(Node)
. If no node
could be resolved with the given XPath, null
will be returned.xpath
- the XPath.context
- the context the given XPath is resolved from.null
if no node matches the given XPath.Map<String,Object> getMap(String xpath)
Map
, by using toMap(Node)
. If no node
could be resolved with the given XPath, null
will be returned.xpath
- the XPath.null
if no node matches the given XPath.List<Map<String,Object>> getMaps(String xpath, Node context)
List
of Map
, by using
toMap(Node)
in each of these nodes. If no node could be resolved with the given XPath, an empty list
will be returned.xpath
- the XPath.context
- the context the given XPath is resolved from.List<Map<String,Object>> getMaps(String xpath)
List
of Map
, by using
toMap(Node)
in each of these nodes. If no node could be resolved with the given XPath, an empty list
will be returned.xpath
- the XPath.LumisXP 12.2.0.200122 - Copyright © 2006–2020 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.