Saving XML Root Attributes

  • AmieCutie
  • Newbie
  • Newbie
  • User avatar
  • Joined: Aug 17, 2011
  • Posts: 12
  • Status: Offline

Post October 14th, 2012, 12:51 am

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

http://pastie. org/5055988
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post October 14th, 2012, 12:51 am

  • spork
  • Brewmaster
  • Silver Member
  • User avatar
  • Joined: Sep 22, 2003
  • Posts: 6134
  • Loc: Seattle, WA
  • Status: Offline

Post October 16th, 2012, 4:52 pm

Maybe I'm missing something, but it looks like the save function is explicitly writing out the root tag without attributes:
JAVASCRIPT Code: [ Select ]
xmlStr = '<?xml version="1.0" encoding="utf-8"?>\n<'+rootNodeName+'>'+convertHtmlToXml($('#main-editor'))+'\n</'+rootNodeName+'>';
The Beer Monocle. Classy.
  • AmieCutie
  • Newbie
  • Newbie
  • User avatar
  • Joined: Aug 17, 2011
  • Posts: 12
  • Status: Offline

Post October 16th, 2012, 5:14 pm

You're right, lol. Just something overlooked I guess :P

Post Information

  • Total Posts in this topic: 3 posts
  • Users browsing this forum: No registered users and 179 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.