xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jtnews <jtn...@bellatlantic.net>
Subject why does XMLSerializer display two different formats with the same OutputFormat object?e flatten my XML?
Date Fri, 29 Sep 2000 05:40:08 GMT
I can't figure out why XMLSerializer keeps on formatting
my XML file differently even though I'm using the exact
same OutputFormat, with setIndenting(true).

My original XML file is shown in Figure A below.
After I use DOMParser, to parse this XML file, 
and use XMLSerializer again to write it back out
I get an XML file shown in Figure B.  Structurally
it's exactly the same, but it's formatted differently!

Has anyone run into similar problems and found a
solution?


Figure A.

<root>
     <class>
        
<name>org_46_magnetoville_46_xml_46_XMLConverter_36_1_36_Trade_0_</name>
         <field>
             <type>java_46_lang_46_String_0_</type>
             <name>symbol</name>
             <value>A_0_</value>
         </field>
         <field>
             <type>java_46_lang_46_String_0_</type>
             <name>type</name>
             <value>buy_0_</value>
         </field>
         <field>
             <type>double_0_</type>
             <name>quantity</name>
             <value>100.0</value>
         </field>
         <field>
             <type>double_0_</type>
             <name>price</name>
             <value>2.0</value>
         </field>
         <field>
             <type>java_46_lang_46_String_0_</type>
             <name>trackingNumber</name>
             <value>X100X_0_</value>
         </field>
         <field>
             <type>long_0_</type>
             <name>executionTime</name>
             <value>970161090929</value>
         </field>
     </class>
 </root>


Figure B.  The unexpected output.


 <root>     <class>
        
<name>org_46_magnetoville_46_xml_46_XMLConverter_36_1_36_Trade_0_</name>
             <field>             <type>java_46_lang_46_String_0_</type>
             <name>symbol</name>             <value>A_0_</value>
         </field>         <field>
             <type>java_46_lang_46_String_0_</type>
             <name>type</name>             <value>buy_0_</value>
         </field>         <field>             <type>double_0_</type>
             <name>quantity</name>             <value>100.0</value>
         </field>         <field>             <type>double_0_</type>
             <name>price</name>             <value>2.0</value>
         </field>         <field>
             <type>java_46_lang_46_String_0_</type>
             <name>trackingNumber</name>
             <value>X100X_0_</value>         </field>         <field>
             <type>long_0_</type>             <name>executionTime</name>
             <value>970161090929</value>         </field>     </class>
</root>

Mime
View raw message