Using the XML Parser Xtra
543
CHAPTER 22
Using the XML Parser Xtra
The XML Parser Xtra lets Macromedia Director MX movies read, parse, and use the contents of
Extensible Markup Language (XML) documents. Using the XML Parser Xtra requires that you
understand the structure and content of the documents you are parsing. You can then access the
XML document’s contents through Lingo or convert the contents to a Lingo list that is
meaningful to you and your movie. After your movie has read an XML document, it can perform
actions that you define based on the contents of the document.
For example, an XML document might describe the structure of a molecule for an educational
chemistry application. After the movie has parsed the XML that describes the molecule, it can use
that information to draw an accurate visual representation of the molecule on the screen. In this
case, the movie must be programmed to know ahead of time that the XML document describes a
molecule and not a grocery list, in order to make logical use of it.
About XML
XML is similar to HTML in that it uses markup tags to define content. However, HTML has
predefined tags that you can use to format any data. Any application that reads HTML must
understand the meaning of tags such as
TITLE
,
P
, and
BODY
. HTML tags also describe how
information appears on the screen. XML, on the other hand, consists of a set of rules that let you
define custom tags and the type of data they can contain, and it has no visual component. With
XML, there is no predefined way to display any given type of data such as molecular structures or
grocery lists. An XML document is merely a container for the data.The Director developer, by
knowing what kind of data the XML document contains, can make intelligent decisions about
what the Director movie should do with the information.
One key advantage of XML over a regular text document is that XML is not order-dependent. If
an application refers to the third item in a line of data, inserting new data or making subsequent
changes to the way the data is produced could cause the application to fail. With XML, you
can refer to the individual data components by name. If you insert a new chunk of data before
the one in use, the name is still valid. Existing code continues to work, and the newly inserted
data is ignored.
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/
Summary of Contents for DIRECTOR MX-USING DIRECTOR MX
Page 1: ...Using Director MX Macromedia Director MX...
Page 12: ...Contents 12...
Page 156: ...Chapter 4 156...
Page 202: ...Chapter 6 202...
Page 244: ...Chapter 7 244...
Page 292: ...Chapter 10 292...
Page 330: ...Chapter 12 330...
Page 356: ...Chapter 13 356...
Page 372: ...Chapter 14 372...
Page 442: ...Chapter 16 442...
Page 472: ...Chapter 18 472...
Page 520: ...Chapter 19 520...
Page 536: ...Chapter 20 536...
Page 562: ...Chapter 23 562...
Page 566: ...Chapter 24 566...
Page 602: ...Chapter 27 602...