Chapter 22
546
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
Содержание DIRECTOR MX-USING DIRECTOR MX
Страница 1: ...Using Director MX Macromedia Director MX...
Страница 12: ...Contents 12...
Страница 156: ...Chapter 4 156...
Страница 202: ...Chapter 6 202...
Страница 244: ...Chapter 7 244...
Страница 292: ...Chapter 10 292...
Страница 330: ...Chapter 12 330...
Страница 356: ...Chapter 13 356...
Страница 372: ...Chapter 14 372...
Страница 442: ...Chapter 16 442...
Страница 472: ...Chapter 18 472...
Страница 520: ...Chapter 19 520...
Страница 536: ...Chapter 20 536...
Страница 562: ...Chapter 23 562...
Страница 566: ...Chapter 24 566...
Страница 602: ...Chapter 27 602...