1 Reply Latest reply on Jan 15, 2010 1:09 AM by ferdyferret

    xml loading and empty elements

    ferdyferret

      Hi,

       

      I'm having problems with Flex and xml data.

       

      I've created an app to edit pre-existing xml files or create new xml files, which are then saved out.  The xml node structure is defined (and cannot be changed as it's widely used across the company and it's associates).

       

      The problem is that as soon as the xml is loaded using a URLLoader class, any xml nodes that are empty are changed from:

       

      <nodename></nodename>

       

      to

       

      <nodename />

       

      This is how the data is traced out / saved, but this is useless to me as I need to keep the existing structure as the file may be edited outside of the app.

       

      Is there a way to prevent the xml data from being changed in this way?  Adobe's own documentation even says:


      'If an element contains no content, it can be written as an empty element (sometimes called a self-closing element). In XML, this element:<lastplayed/> is identical to this element: <lastplayed></lastplayed>'.

       

      In which case, why does this get re-written all the time?


      If anyone can help with this I'd be really grateful, as I just can't find a way to solve this.

      Thanks,

      ferdyferret