I am trying to use Xerces C++ to modify an XML file, but somehow the output 
file does not keep the attributes' order.
I use the sample program, DOMPrint, to see how it reads and writes the XML 
file.  The input files has the following header and nodes:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
....
       <rule name="docws" enabled="true" stopProcessing="false">
            <action type="Rewrite" url="http://localhost:9090/{R:0}"; />
            <match url="^docws(/(.*))?" />
       </rule>
       <rule name="streaming" enabled="true" stopProcessing="false">
          <action type="Rewrite" url="http://localhost:9090/{R:0}"; />
          <match url="^Streaming(/(.*))?" />
          <conditions>
            <add input="{SERVER_PORT}" pattern="80" />
          </conditions>
       </rule>
....
</configuration>

The output file becomes

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<configuration>
....
        <rule enabled="true" name="docws" stopProcessing="false">
            <action type="Rewrite" url="http://localhost:9090/{R:0}"/>
            <match url="^docws(/(.*))?"/>
        </rule>
        <rule enabled="true" name="streaming" stopProcessing="false">
          <action type="Rewrite" url="http://localhost:9090/{R:0}"/>
          <match url="^Streaming(/(.*))?"/>
          <conditions>
            <add input="{SERVER_PORT}" pattern="80"/>
          </conditions>
        </rule>
....
</configuration>

The output file adds a new 'standalone' attribute to the header and changes the 
order of 'name' and 'enabled' attributes of the  'rule' node.
If I add the setXmlStandalone(true) call  to the root document, it does not 
remove the 'standalone' attribute but only changes it to 'yes'

How can this be fixed?


Thanks.

Alex
----

Reply via email to