MACROMEDIA DIRECTOR MX-USING DIRECTOR MX Use Manual page 547

Table of Contents

Advertisement

The
variable contains the parsed XML. When used in the preceding Lingo, it
gParserObject
refers to the root node of the XML document. The Lingo term
refers to the first level
child[1]
of nested tag, which is the
tag.
e1
To find out what kind of node the first tag is, use the
function, as shown in the following
type
example:
put gParserObject.child[1].type
-- #element
To refer to nodes that are nested more than one level deep, use more than one level of child
reference. The following Lingo returns the name of the first tag that is nested within the
tag:
e1
put gParserObject.child[1].child[1].name
-- "tagName"
The following Lingo returns the name of the second tag that is nested within the
tag:
e1
put gParserObject.child[1].child[2].name
-- "e2"
To refer to text data that occurs within a particular tag, use the
property. The text is a child
text
node of the tag that contains it, so you need an additional level of child reference. This Lingo
returns the following string, which appears inside the
tag from the previous XML example:
e2
put gParserObject.child[1].child[2].child[1].text
-- "element 2"
In this example, the
variable refers to the root node of the XML. The
gParserObject
child[1]
refers to the
tag, which occupies the first level down in the XML's nested structure. The
e1
refers to the second tag within the
tag, which is the
tag. The last
refers
child[2]
e1
e2
child[1]
to the text within the
tag, which is
. Finally, the
property is specified, so Lingo
e2
element 2
text
returns the text of the node rather than any other property of the node.
The fourth child of the
tag is a line of text that reads
. This text is a child
e1
here is some text
the same as the XML tags that precede it. You can get the type of this child the same way you get
other children.
The following Lingo returns the type of the fourth child of the
tag:
e1
put gParserObject.child[1].child[4].type
-- #text
This Lingo returns the text of the fourth child of the
tag, as shown in the following example:
e1
put gParserObject.child[1].child[4].text
-- "
here is some text
"
The text element includes the white space for Return, Space, and Tab characters as well as the
string
.
" here is some text "
You can use the Lingo
function to determine the number of children that exist at a
count
particular level of the XML structure. The following Lingo returns the number of children at the
2nd level in the previous XML example:
put gparser.child[1].child.count
-- 4
Using the XML Parser Xtra 547

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the DIRECTOR MX-USING DIRECTOR MX and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Director mx

Table of Contents