hey, the xml portfolio i’m building is coming along great. The final snag i’ve got, and its a wierd one, is that i’m trying to use the insertBefore() method to allow editing of the XML. It defines a new node, and adds its attributes, then inserts it into the main XML… but, while i can trace the XML object and everything will look fine, when used to recreate the portfolio menu, the attributes come out as ‘undefined’ for some reason. When this happens, and then php updates the XML file, the new node is in the xml, but so is an additional broken node with attribute=‘undefined’ and it messes everything up. Has anyone had any experience with insertBefore() and this type of problem?.. below is the code in which i’m using this method… it builds the new node, inserts it, then reloads the menu based on the updated xml object, but again, comes as ‘undefined’ instead of ‘Enter Name’, etc…
_root.addItem.onRelease = function() {
this.newNode_xml = new XML();
this.newNode_xml.ignoreWhite = true;
this.newNode_xml.contentType = ‘text/xml’;
this.newNode_xml.appendChild(this.newNode_xml.createElement(“project”));
this.newNode_xml.firstChild.attributes.description = “Enter Description”;
this.newNode_xml.firstChild.attributes.link = “Enter Link”;
this.newNode_xml.firstChild.attributes.src = “Enter Source”;
this.newNode_xml.firstChild.attributes.client = “Enter Client”;
this.newNode_xml.firstChild.attributes.name = “Enter Name”;
_root.curr_node.insertBefore(this.newNode_xml,_root.curr_node.childNodes[this.ident])
_root.createSubMenu(_root.tempident);
}
after sending the same XML object to server, it comes out like this:
…<project name=“web project4” client=“dcs services” src=“portfolio/web01.jpg” link=“ww.dcs.com” description=“web project 4 description” /> description=“undefined” link=“undefined” src=“undefined” client=“undefined” name=“undefined”<project name=“Enter Name” client=“Enter Client” src=“Enter Source” link=“Enter Link” description=“Enter Description” />…
as you can see the new project node is in there, but it also adds undefined attributes without a node for some reason. If anyone can help me let me know, thanks!
-CC