Jump to content

MiniXML problem


spelltwister

Recommended Posts

Hey all,

This is a sort of specific question, but hopefully someone knows ;-D

I'm using minixml to parse an xml file.  Here's the code:

$XMLString = $_POST['xml_stuff'];

$XMLDoc = new MiniXMLDoc();
$XMLDoc->fromString($XMLString);
$XMLRoot =& $XMLDoc->getRoot();

Now, if I write echo $XMLDoc->toString(); it takes the following xml:

<units>
  <info attacker="persian" turn="2" />
  <g>
    <calvary ranged="0" number="2" bonus="0" />
  </g>
</units>

and transforms it into:

<units>
  <info />
  <g>
    <calvary />
  </g>
</units>

However, I had origianlly tested the script with the XML file sitting on the server and using the fromFile and toString and that worked fine.  Any ideas why it's removing all the attributes from the XML?

Thanks,

Mike
Link to comment
https://forums.phpfreaks.com/topic/28542-minixml-problem/
Share on other sites

Maybe I could be more clear.  The posted data looks like:
<units><info attacker="persian" turn="2" /><g><calvary ranged="0" number="2" bonus="0" /></g></units>

and if I use $XMLDoc->toString(); is prints
<units>
  <info />
  <g>
    <calvary />
  </g>
</units>

Again, this worked fine when reading the EXACT same xml from a file then performing the operations on it.

If no one knows, can someone please give me another method of parsing posted XML data?

Thanks,

Mike
Link to comment
https://forums.phpfreaks.com/topic/28542-minixml-problem/#findComment-130676
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.