View Full Version : [Q] Difference between XML, XMLList and XMLDocument?
manfree
July 12th, 2007, 04:33 AM
Hi all
Could any body explain ..
what is the difference between XML, XMLList, and XMLDocument
var theList:XML = new XML(theXML.data);
As the above syntax can retrieve the XML data, why we still have to use XMLList ??
Thanks
Dazzer
July 12th, 2007, 05:01 AM
according to the reference, the XMLList is a group of XML objects. so they are fundamentally different
XMLDocument is the AS2.0 version of XML, used for backward compatibility.
Aquilonian
July 12th, 2007, 05:13 AM
Also, a XMLList can be just a piece of a XML
In the old way we used to take a piece of the XML we wanted and put it into a array and loop into that array to get the data we want, now they wont fit into a array, so you use a XMLList
senocular
July 12th, 2007, 07:59 AM
The problem with XML is that XML requires to have one, single root node to be valid XML. That is why XMLList is required - to handle those situations where we have multiple XML values for one variable. Essentially, XMLList is just an array container for one or more XML nodes.
manfree
July 13th, 2007, 02:13 AM
Thanks guys ~~~
Now I understand that XMLList is a group of XML objects
and XMLList can import the XML objects directly into an array
but I don't really understand ... "XML requires to have one, single root node to be valid XML" ???
Is it possible to explain with a simple example ???
is that mean ... while we are going to import a list of XML data,
"XMLList" is a better choice rather than using "XML"?
Dazzer
July 13th, 2007, 02:18 AM
var something:XML =
<xmlroot>
<blah>a</blah>
<blah>s</blah>
<blah>d</blah>
<blah>f</blah>
<blah>g</blah>
</xmlroot>
Now if you were to say
var myXML:XML = something.blah;
You'd get an error. Because there is no root node. Blah occurs more than once, and thus it cannot be the root node. In this case, you must use XMLList, which is a group of XML objects (<blah>a</blah>), all with a single root node.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.