Summary:
See also: Classes and Objects, XML Utilities
The NodeList class holds a list of DomNode objects created from a selection method.
om.NodeList
Object Methods | |
Name | Description |
item( index INTEGER ) RETURNING om.DomNode |
Returns the DomNode object at the given position (first is 1). Returns NULL if the item does not exist. |
getLength( ) RETURNING INTEGER |
Returns the number of items in the list. |
A NodeList object contains a list of the child objects of the DomNode from which it was created, selected by Tag Name or Path. Use the DomNode methods to create the NodeList, as shown in the examples below.
The XPath syntax of the selectByTagName()
and selectByPath()
methods of om.DomNode class is limited to:
{ / | // } TagName
[ [@AttributeName="Value"] ]
[...]
Once the NodeList object is created, the following Object methods are available:
item()
- This method returns the DomNode that is at the specified position in
the list.
getLength()
- This method returns the total number of DomNodes in the list.
01
MAIN02
DEFINE nl om.NodeList03
DEFINE r, n om.DomNode04
DEFINE i INTEGER05
06
LET r = ui.Interface.getRootNode()07
LET nl = r.selectByTagName("Form")08
09
FOR i=1 to nl.getLength()10
LET n = nl.item(i)11
DISPLAY n.getAttribute("name")12
END FOR13
14
END MAIN
01
MAIN02
DEFINE nl om.NodeList03
DEFINE r, n om.DomNode04
DEFINE i INTEGER05
06
LET r = ui.Interface.getRootNode()07
LET nl = r.selectByPath("//Window[@name=\"screen\"]")08
09
FOR i=1 to nl.getLength()10
LET n = nl.item(i)11
DISPLAY n.getAttribute("name")12
END FOR13
14
END MAIN