Why?? If my XML document looks like (just an example)...
< parent name="name" >
< child name="child" >
< /parent >
and my flash script looks like....
parentXML = new XML();
parentXML.onLoad = loaded;
parentXML.load("document.xml");
function loaded() {
parentNameX = parentXML.firstChild;
parentName = parentNameX.attributes.name;
}
stop ();
The the name attribute of the parent node is successfully loaded into the variable parentName. But if my XML document looks like...
< ?xml version="1.0" encoding="utf-8" ? >
< parent name="name" >
< child name="child" >
< /parent >
the attribute isn't loaded into the variable? And how do I load the child attributes into variables? I can't seem to get this. Any help would be much appreciated!
thx,
Paul
Uhh...
Whitespace - whitespace - whitespace
When you add (I think it's called...) XML type declaration, you add whitespace. That whitespace is treated like a text node.
Try:
parentNameX = parentXML.childNodes[1];
and see if that works.
almost
that didn't work but... i used [2] and it did...
parentXML = new XML();
parentXML.onLoad = loaded;
parentXML.load("PaulSpitzer.xml");
function loaded() {
parentNameX = parentXML.childNodes[2];
parentName = parentNameX.attributes.name;
}
stop ();
my xml doc looks like
< ?xml version="1.0" encoding="utf-8" ?>
< parent name="parent">
< child name="child"/>
< /parent>
This is good, I'm getting close! thanks. Now I need to figure out how to get the damn < child name="child"> into a variable. Any help with that?
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width