-
Here's my Flash code:
Code:
loginXML = new XML();
id1 = loginXML.createElement("BODY");
id1.attributes.id = "mylink";
loginXML.appendChild(id1);
loginXML.contentType = "text/xml";
loginReplyXML = new XML();
loginReplyXML.onLoad = onLoginReply;
loginXML.sendAndLoad("xmlreader.php", loginReplyXML);
Here's What I get when I write my XML file:
< BODY id="mylink" />
Here's What I want it to look like:
< BODY id="myVariable" >mylink< /body >
What am I doing wrong???!
Thanks in advance...
-
You'll want to use createTextNode for the text inside the element.
Code:
loginXML = new XML();
id1 = loginXML.createElement("BODY");
// do this:
text1 = loginXML.createTextNode("mylink");
id1.appendChild(text1);
// not this:
// // id1.attributes.id = "mylink";
loginXML.appendChild(id1);
...
-
Originally posted by shoehorn
You'll want to use createTextNode for the text inside the element.
Code:
loginXML = new XML();
id1 = loginXML.createElement("BODY");
// do this:
text1 = loginXML.createTextNode("mylink");
id1.appendChild(text1);
// not this:
// // id1.attributes.id = "mylink";
loginXML.appendChild(id1);
...
That's not really working...? Here's my code:
Code:
loginXML = new XML();
id1 = loginXML.createElement("BODY");
text1 = loginXML.createTextNode("mylink");
id1.appendChild(text1);
loginXML.appendChild(id1);
And this is what my XML looks like:
< BODY >mylink< /BODY >
This is what I want it to look like:
< BODY id="myVariable" >mylink< /BODY >
-
The id="myVariable" part is an attribute of the element, which you had tried in your first sample. So here's what you want:
Code:
loginXML = new XML();
id1 = loginXML.createElement("BODY");
id1.attributes.id = "myVariable";
text1 = loginXML.createTextNode("mylink");
id1.appendChild(text1);
loginXML.appendChild(id1);
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
|