Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006004 [Quercus] minor always 05-15-16 08:38 07-03-16 13:07
Reporter ebo View Status public  
Assigned To nam
Priority normal Resolution not fixable  
Status closed   Product Version
Summary 0006004: SimpleXML reorders attributes
Description When adding attributes with SimpleXML, the attributes get reordered in alphabetic order. This causes issues when comparing XML documents.

The following code snippet:

$xml=simplexml_load_string('<?xml version="1.0" encoding="utf-8"?><test/>');
$child=$xml->addChild('foo', 'bar');
$child->addAttribute('xyz', 'first');
$child->addAttribute('abc', 'second');
echo '
' . htmlentities($xml->asXML()) . '
';

Outputs:

<?xml version="1.0"?>
<test><foo abc="second" xyz="first">bar</foo></test>
Additional Information
Attached Files

- Relationships

- Notes
(0006709)
nam
07-03-16 13:07

According to the W3C DOM specs, attribute ordering is not guaranteed. It would be nice to match PHP, but it is not possible because Java's Xerces XML implementation does not support attribute ordering.
 

- Issue History
Date Modified Username Field Change
05-15-16 08:38 ebo New Issue
07-03-16 13:07 nam Status new => assigned
07-03-16 13:07 nam Assigned To  => nam
07-03-16 13:07 nam Status assigned => closed
07-03-16 13:07 nam Note Added: 0006709
07-03-16 13:07 nam Resolution open => not fixable


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker