I've been working on a CMS built using AJAX and PHP. Pretty much it saves everything to XML files. Everything is working perfectly except getting the root node's attributes to save. These are never brought in to edit, I don't want these visible in the CMS. So what happens when I save, all of the root node attributes get removed. I've gone over this so much that I can't figure out what's causing this. So I thought another set of eyes my help.

The saving function is called saveXml() and is located at the bottom

My code --> http://pastie.org/5055988

var rootNodeName = pageXmlData.nodeName;
xmlStr = '<?xml version="1.0" encoding="utf-8"?>\n<'+rootNodeName+'>'+convertHtmlToXml($('#main-editor'))+'\n</'+rootNodeName+'>';

Both lines only use the root name, no attributes are specified.