And this validates? It doesn't look like well formed XML to me .. it has to
be valid XML or you're asking for trouble from the getgo.

Signature
Nancy Gill
Adobe Community Expert
Author: Dreamweaver 8 e-book for the DMX Zone
Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
Technical Editor: Dreamweaver CS3: The Missing Manual,
DMX 2004: The Complete Reference, DMX 2004: A Beginner's Guide
Mastering Macromedia Contribute
Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development
Look like fine XML to me ...
I am also having problems with XML parsing. And I have had success with very
simple XML, for example, with this XML:
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item id="0" title="0, 0" type="1" contentPath="sample.html">
<description>Description here.</description>
<georss>0 0</georss>
</item>
<item id="1" title="New York City" type="2" contentPath="sample.flv">
<description>Description here.</description>
<georss>42.3583 -75.85</georss>
</item>
<item id="2" title="Rome" type="3" contentPath="sample.html">
<description>Description here.</description>
<georss>41.54 -12.27</georss>
</item>
</items>
I can use this, and it will parse the above XML (which is then handled as
independent objects per <item> in the Node class):
public function processMarkerData (xmlData:XML):void {
// loop through all markers in the XML
// and generate a node for each one
trace ("xmlData: " + xmlData);
for each (var xmlPlacemark:XML in xmlData.item) {
trace ("success!");
// create node
var node:Node = new Node(
xmlPlacemark,
{
nodeID: nodeID,
app: this
});
}
}
miquael - 19 Mar 2008 02:48 GMT
But when I change the structure a little, this won't work! Why not? I just
want to create one Node for each <placemark> tag in the xml.
The XML:
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Placemark id="0" type ="1">
<name>Zero - zero</name>
<description>This is at zero latitude and zero longitude</description>
<Point>
<coordinates>0,0,0</coordinates>
</Point>
</Placemark>
<Placemark id="1" type ="2">
<name>Simple placemark</name>
<description>Attached to the ground. Intelligently places itself
at the height of the underlying terrain.</description>
<Point>
<coordinates>-122.0822035425683,37.42228990140251,0</coordinates>
</Point>
</Placemark>
<Placemark id="2" type ="3">
<name>New York City</name>
<description>This is a rockin' town</description>
<Point>
<coordinates>42.3583,-75.85,0</coordinates>
</Point>
</Placemark>
</kml>
Yet, I cannot even get the second "success!" trace. It's almost exactly the
same as above! (xmlData.item vs. xmlData.Placemark)
Attach Code
public function processMarkerData (xmlData:XML):void {
// loop through all markers in the XML
// and generate a node for each one
trace ("xmlData: " + xmlData);
for each (var xmlPlacemark:XML in xmlData.Placemark) {
trace ("success!");
// create node
var node:Node = new Node(
xmlPlacemark,
{
nodeID: nodeID,
app: this
});
}
}
}