Nested nodes access methods

The methods in this section can be used to retrieve any nodes nested within the referenced node. They affect only the nodes of the first level of nesting.

hasChildNodes()

This method checks whether the node associated with the variable has any child nodes attached and returns TRUE, if it does. It returns FALSE, if the node has no children.

DISPLAY xmlnode_var.HasChildNodes()

getChildCount()

This method returns an integer value which represents the number of children attached to the node associated with the variable. It calculates only the nodes attached to the referenced node directly and does not calculate the nested nodes the children may have. E.g.:

DISPLAY xmlnode_var.GetChildCount()

getChildNodeItem()

This method returns the child node of the node associated with the index specified. If there is no child node with this index - it returns NULL. This method accepts a single parameter of the INTEGER data type which represents the child node index. The node indexes are assigned in the following way: the first child node has index value 1 and all the rest of the nodes have the indexes which corresponds to their position regarding the parent node. It returns the child node in the form of an XMLNODE value. E.g.:

LET child_node = xmlnode_var.GetChildNodeItem(4)

getParentNode()

This method returns the parent node of the node associated with the XMLNODE variable used, or NULL if the node has no parent. It accepts no parameters. E.g.:

LET par_node = xmlnode_var.GetParentNode()

 

In case if the xmlnode_var variable contains the node called "node", this method will return another XMLNODE value containing the node called "parent, if the parent node is defined like this:

<parent>

   <node/>

</parent>

getFirstChild()

This method returns the first child node of the node associated with the XMLNODE variable used, or NULL if the node has no children. It accepts no parameters. E.g.:

LET child_node = xmlnode_var.GetFirstChild()

The par_node variable will contain the value of the "first_child" node, if the xmlnode_var contains the value of the "node" node defined like this:

<node>

  <first_child/>

  <second_child/>

  <last_child/>

</node>

getFirstChildElement()

This method returns the first child of the XMLNODE associated with the variable used that is of type ELEMENT or NULL if the XMLNODE has no children that are ELEMENT types. The returned value is of the XMLNODE data type. E.g.:

LET first_child_element = xmlnode_var.GetFirstChildElement()

getLastChild()

This method returns the last child node of the node associated with the XMLNODE variable used, or NULL if the node has no children. It accepts no parameters. E.g.:

LET child_node = xmlnode_var.GetLastChild()

The par_node variable will contain the value of the "last_child" node, if the xmlnode_var contains the value of the "node" node defined like this:

<node>

  <first_child/>

  <second_child/>

  <last_child/>

</node>

getLastChildElement()

This method returns the last child of the XMLNODE associated with the variable used that is of type ELEMENT or NULL, if the XMLNODE has no children that are ELEMENT types. The returned value is of the XMLNODE data type. E.g.:

LET last_child_element = xmlnode_var.GetFirstChildElement()

getNextSibling()

This method returns the next sibling of the XMLNODE associated with the variable used. The sibling of the node is the next node of the same nesting level as the referenced node located immediately after the referenced node. If No sibling nodes exist, it will return NULL, otherwise it will return the value of the XMLNODE data type. E.g.:

LET sibling = xmlnode_var.GetNextSibling()

If the node has no siblings that are located after or below it, this method will return NULL, even if there are siblings above or before the referenced node.

getNextSiblingElement()

This method returns the next sibling of the XMLNODE associated with the variable used that is of type ELEMENT or NULL, if the XMLNODE has no siblings that are ELEMENT types. The returned value is of the XMLNODE data type. E.g.:

LET sibling_element = xmlnode_var.GetNextSiblingElement()

If the node has no sibling elements that are located after or below it, this method will return NULL, even if there are sibling elements above or before the referenced node.

getElementsByTagName()

This method returns all the elements of the referenced node that match the specified tag name. It accepts a single parameter which is the name of the tag. It returns a value of the XMLNODELIST data type containing all the matching elements.

LET xmlnodelist_var = xmlnode_var.GetElementsByTagName("mytag")

 

Contact Us

Privacy Policy

Copyright © 2025 Querix, (UK) Ltd.