Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Table of Contents
maxLevel5
minLevel5

 

Object xPath(String xpathStr)
DescriptionThis function evaluates the XPath query and returns the relevant element.
xpathStrThe XPath expression that is to be evaluated.
Return
  • A org.w3c.dom.NodeList is returned if there is more than one elements in the result.
  • A org.w3c.dom.Node object is returned if there is only one element in the result.

 

Object xPath(String xpathStr, String returnType)
DescriptionThis function evaluates the XPath query and returns the specified return type.
xpathStrThe XPath expression that is to be evaluated.
returnType

The desired return type of the XPath evaluation. The supported return types are:

    • NODESET
    • NODE
    • STRING
    • NUMBER
    • BOOLEAN
Return

The result of the XPath evaluation in the form of the specified return type.

 

Node set(String xPathStr, Object obj)
Description

This function sets, replaces or updates an object (string/element) to match the XPath provided.

Note

If a new element is added, this API will clone it and merge the new node to the target location that the XPath points to and will return the new cloned node.

xpathStrThe XPath to the target location where the object is to be set.
objThe string or node object to be set.
Return

The node gets updated if the object is string and returns a newly added node if the object is an element.

 

Node appendChild(String xPathToParent, Element element)
Description

This function appends a child element to the target element.

xpathToParentThe XPath to the parent node.
elementThe element that is to be appended.
Return

The node either gets appended or returns a newly added node if the object is an element.

 

Node insertBefore(String xPathToTargetNode, Element element)
Description

This function inserts a new child node before the specified existing node.

xpathToTargetNodeThe XPath to the target node.
elementThe element that is to be inserted.
Return

The node gets inserted.

 

String toString()
Description

This function will serialize the XML object to a string.

 

Element createNewElement(String elementStr)
Description

This function creates a new element.

Note

This is a util method.