Adobe 65036570 - Director - PC User Manual page 417

User guide
Hide thumbs Also See for 65036570 - Director - PC:
Table of Contents

Advertisement

To refer to the text data that occurs within a particular tag, use the
that contains it, so you need an additional level of child reference. This script 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
gParserObject
which occupies the first level down in the XML's nested structure. The
tag, which is the
tag. The last
e1
e2
property is specified, so the script returns the text of the node rather than any other property of the node.
text
The fourth child of the
e1
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
The following script returns the text of the fourth child of the
put gParserObject.child[1].child[4].text
-- "
here is some text
"
The
element includes the white space for Return, Space, and Tab characters as well as the string
text
.
text"
You can use the script
count
structure. The following script returns the number of children at the 2nd level in the previous XML example:
put gparser.child[1].child.count
-- 4
Accessing attributes
Use the
and
attributeName
previous XML example, the first tag nested inside the
and
.
attr2
The following script uses the
, which is the first child of the
tagName
put gParserObject.child[1].child[1].attributeName[1]
-- "attr1"
The following script uses the
the
tag:
tagName
put gParserObject.child[1].child[1].attributeValue[1]
-- "val1"
The following script uses the
put gParserObject.child[1].child[1].attributeValue["attr1"]
-- "val1"
The following script uses the
in the first child of the
tag:
e1
variable refers to the root node of the XML. The
refers to the text within the
child[1]
tag is a line of text that reads
method to determine the number of children that exist at a particular level of the XML
properties to access the attributes of tags that have values. In the
attributeValue
property to return the name of the first attribute of the tag called
attributeName
tag:
e1
property with an integer to return the value of the first attribute of
attributeValue
property with a string to return the value of the
attributeValue
method with the
count
property. The text is a child node of the tag
text
child[2]
tag, which is
e2
. This text is a child, as are the XML
here is some text
tag:
e1
tag:
e1
tag is called
and has two attributes called
e1
tagName
property to return the number of attributes
attributeName
ADOBE DIRECTOR 11.0
refers to the
child[1]
refers to the second tag within the
. Finally, the
element 2
"here is some
attribute:
attr1
406
User Guide
tag,
e1
attr1

Advertisement

Table of Contents
loading

This manual is also suitable for:

Director 11

Table of Contents