Introduction to XML in Flash
       by senocular

Additional XML Content
As you work with XML, especially that which is not of your own creation (if you're just starting out), you may notice other bits of information outside the XML document root element. Such information can exist before (in the XML Prolog) and/or after (the XML Epilog) the document root.

Most XML documents come with declarations that provide more information about the XML. These include XML declarations as well as doctype declarations.

The optional XML declaration specifies certain properties about the XML page itself such as version and character encoding used. This is placed at the very beginning of an XML document before anything else, including comments and even white space. Most XML documents should at least be declared with one of these that at least specifies XML version, though Flash typically doesn't care whether an XML file it receives has one or not. An example of a XML declaration would be:

<?xml version="1.0"?>

Doctype declarations give information about how an XML document is defined. They usually consist of the name of the document root of the XML file, its availability and a url to a DTD (Document Type Definition) file that defines the file's vocabulary. An example would be

<!DOCTYPE root PUBLIC "http://www.kirupa.com/root.dtd">

where root is the the name of the document root element and root.dtd is the

DTDs and Schemas, a successor to the DTD (usually saved as .xsd), are files or instructions within the doctype that outline how an XML behaves and what it means. They define the vocabulary that an XML file (or any of many that use it) must adhere to to become valid.

Processing Instructions can also be used in XML. These can go in the prolog, epilog or within the XML body within the document root. These provide special instructions to the application processing the XML and are typically defined with <? and >. For example, a PHP tag in HTML is a processing instruction and can be placed anywhere within an HTML (or PHP, rather) document.

<HTML>
<HEAD>
<TITLE>My Page</TITLE>
</HEAD>
<BODY>
<?php
print "Welcome to my page!";
?>
</BODY>
</HTML>

Most of these are of no importance when it comes to Flash, however. The Flash interpreter for XML will, for the most part, ignore these though not without giving you access to their raw values (via some XML properties to be covered shortly). So unless otherwise needed, you wouldn't have to spend too much time worrying about what they all mean. Plus, as an introduction to XML in Flash, they are out of the scope of what is to be covered here in the first place.


 




SUPPORTERS:

kirupa.com's fast and reliable hosting provided by Media Temple.