MACROMEDIA DIRECTOR MX 2004-USING DIRECTOR Use Manual page 423

Hide thumbs Also See for DIRECTOR MX 2004-USING DIRECTOR:
Table of Contents

Advertisement

Using this XML document as a starting point, the following examples demonstrate how to use
these script 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 script returns the name of the first XML tag:
put gParserObject.child[1].name
-- "e1"
The
variable contains the parsed XML. When used in the preceding script, it
gParserObject
refers to the root node of the XML document. The script term
nested tag, which is the
To find out what kind of node the first tag is, use the
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 script returns the name of the first tag that is nested within the
put gParserObject.child[1].child[1].name
-- "tagName"
The following script returns the name of the second tag that is nested within the
put gParserObject.child[1].child[2].name
-- "e2"
To refer to text data that occurs within a particular tag, use the
node of the tag that contains it, so you need an additional level of child reference. This script
returns the following string, which appears inside the
put gParserObject.child[1].child[2].child[1].text
-- "element 2"
In this example, the
gParserObject
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
child[2]
to the text within the
e2
returns the text of the node rather than any other property of the node.
The fourth child of the
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 script returns the type of the fourth child of the
put gParserObject.child[1].child[4].type
-- #text
tag.
e1
variable refers to the root node of the XML. The
e1
tag, which is
element 2
tag is a line of text that reads
e1
child[1]
method, as shown in the following
type
property. The text is a child
text
tag from the previous XML example:
e2
tag, which is the
tag. The last
e2
. Finally, the
property is specified, so script
text
here is some text
tag:
e1
Using XML document nodes
refers to the first level of
tag:
e1
tag:
e1
child[1]
refers
child[1]
. This text is a child
423

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Director mx 2004

Table of Contents