Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 370699

Summary: Adjust attribute order of serialized XML root element
Product: [Automotive] Sphinx Reporter: Christian K. <christian.k.2510>
Component: CoreAssignee: Christian K. <christian.k.2510>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: stephaneberle9
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Christian K. CLA 2012-02-06 05:55:51 EST
For XML files serialized using the class ExtendedXMLSaveImpl a certain order of the XML root element attributes is established. The current order of the standard namespace and schema related attributes is:
- xmlns:xsi
- xmlns
- xsi:schemaLocation

This order does not match the order which is produced by common DOM implementations and also JDOM, e.g. Xerces uses an alphabetical order of the attributes [1].

The ordering mismatch produces undesirable side-effects if XML files are processed using other tools/parsers. This might also be done as part of automated testing where test files are processed using DOM/JDOM and text comparison is used for assertations.

The ordering established by ExtendedXMLSaveImpl should be adjusted to be:
- xmlns
- xmlns:xsi
- xsi:schemaLocation

Please note that the wrong order is only produced by ExtendedXMLSaveImpl if it operates in a non-DOM mode (toDOM=false).

[1]: http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/dom/NamedNodeMapImpl.html
Comment 1 Christian K. CLA 2012-02-23 03:23:37 EST
Class org.eclipse.sphinx.emf.resource.ExtendedXMLSaveImpl was adjusted to desired order of root attributes.
Comment 2 Balazs Grill CLA 2021-07-14 02:16:34 EDT
Mass-closing Resolved tickets