Using Xml Parser Objects - MACROMEDIA DIRECTOR MX 2004-USING DIRECTOR Use Manual

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

Advertisement

There are many sources of information for understanding, creating, and editing XML on the
Internet. The following websites offer useful information about XML:
www.xml.com
www.ucc.ie/xml/
www.w3.org/TR/REC-xml
www.w3.org/DOM/

Using XML parser objects

The XML Parser Xtra lets Director developers access the nodes of an XML document. A node can
be a tag (similar to an HTML tag, also called an element), character data (text that does not
appear inside the angle brackets of a tag), or a processing instruction (a special type of tag that
passes data to the parsing application for special processing). You can extract information from
the XML document by looking at its nodes with Lingo or JavaScript syntax. This access to XML
data lets users incorporate XML documents into their movies and selectively extract data from
the documents.
An XML document is well formed if it has a coherent nesting structure and no misplaced angle
brackets. Some XML documents can be associated with a document type declaration (DTD) file
that describes specific rules for the XML tags the document uses. The XML parser of the Xtra
checks that the XML follows the general rules of creating and using XML tags to ensure that the
document is well formed. However, the Xtra does not check the DTD file to ensure that the tags
follow the specific rules for XML document tags, which is described by the DTD. For this reason,
the Xtra is called nonvalidating. The creator of the original XML document must follow the rules
described in the DTD. Your Director movie should also include script that checks for errors in
the use of the XML document's tags.
To use the XML Parser Xtra, create a parser object by using Lingo or JavaScript syntax to assign a
new instance of the Xtra to a variable. This variable now contains the parser object. Use a global
variable if you need to access the XML data from anywhere in the Director movie.
global gParserObject
gParserObject = new(xtra "xmlparser")
The next step is to parse the XML data using the
from the text of a cast member or a string variable. To parse XML from a URL, use
instead.
ParseString()
successful, or an error code that indicates a problem with the XML data.
The following script statement sets the variable
parseString()
errCode = gParserObject.parseString(member("XMLtext").text)
After the XML Parser Xtra parses the data, the parser object contains all the data from the XML
document.
The XML data can be considered a tree structure because most documents have tags nested
within other tags, with each tag being like a branch of the tree.
420
Chapter 19: Using the XML Parser Xtra
and
parseURL()
method:
parseString()
return either
, which indicates that the method is
VOID
to the return value of the
errCode
method. The data can come
parseURL()

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

This manual is also suitable for:

Director mx 2004

Table of Contents