I’m attempting to add the nodes:
<deli>
<item sku=“rb-798”>Roast Beef</item>
</deli>
via AS what did I goof?
//create the xml object
XML_Shopping = new XML();
XML_Shopping.onLoad = parseXML_Shopping;
function parseXML_Shopping(success) {
if (!success) {
trace("Shopping document failed to load");
return;
} else {
if (this.status != 0) {
trace("This document not well formed."+this.status);
return;
} else {
addAisle();
trace(this);
}
}
}
XML_Shopping.load("./shopping.xml");
function addAisle() {
newAisle = XML_Shopping.createElement("Deli");
XML_Shopping.appendChild(newAisle);
newItem = XML_Shopping.createTextNode("Roast Beef");
XML_Shopping.firstChild.appendChild(newItem);
}
//FROM OUTPUT WINDOW
<list>
<freezer>
<item sku="p-444">peas</item>
<item sku="g-444">green beans</item>
<item sku="pp-444">pot pie</item>
<item sku="i-444">ice cream</item>
</freezer>
<bakery>
<item sku="r-444">rolls</item>
<item sku="j-444">jelly doughnuts</item>
<item sku="br-444">bread</item>
</bakery>
<produce>
<item sku="ba-444">bananas</item>
<item sku="k-444">kumquats</item>
<item sku="a-444">apples</item>
</produce>
Roast Beef</list>
<Deli />