User Guide

Chapter 22546
You use Lingo to access the nodes of an XML document. The following table shows the Lingo
terms that refer to nodes and their properties:
Note: The subfield count exists for any field that is accessible with bracket access. You can specify
whichNode.child.count to find how many children are in the specified node.
Using this XML document as a starting point, the following examples demonstrate how to use
these Lingo terms to access the data within various node levels of the XML structure.
The XML looks like the following example:
<?xml version="1.0"?>
<e1>
<tagName attr1="val1" attr2="val2"/>
<e2>element 2</e2>
<e3>element 3</e3>
Here is some text
</e1>
The following Lingo returns the name of the first XML tag:
put gParserObject.child[1].name
-- "e1"
Node Lingo Return value if an
element
Return value if text Return value if Processing Instruction
type #element #text #procInst
name String representing
the name of the
element
VOID String representing the name of the
processing instruction
child[N]
(N is an integer)
The Nth child node of
the node;
VOID is returned if no
Nth child exists or
there is a script error
VOID VOID
attributeName[N]
(N is an integer)
String representing
the name of the Nth
attribute;
VOID is returned if no
Nth attribute exists or
there is a script error
VOID VOID
attributeValue[N]
(N is an integer)
String representing
the value of the Nth
attribute;
VOID is returned if no
Nth attribute exists or
there is a script error
VOID VOID
attributeValue[N]
(N is a string)
String representing
the value of the
attribute with the
name N;
VOID is returned if the
node does not have
an attribute named N
or there is a script
error
VOID VOID
text VOID String representing
the character data
contained in this node
String representing the data section of the
processing instruction