Class XmlData


  • public final class XmlData
    extends Object
    XmlData takes care of reading and writing of table data in XML format. The reader and writer use a streaming API to avoid excessive memory use. The class can be used, e.g., as follows:
     Table dataTable = new ListTable("data", "dataTable", columns);
     Writer writer = new FileWriter("c:/data/data.xml");
     XmlData.writeData(writer, dataTable);
     
    The XML document has the following structure:
     <xmldata>
       <table id="tableId" description="description" class="org.djutils.data.ListTable">
         <column nr="0" id="obsNr" description="observation nr" type="int"></column>
         <column nr="1" id="value" description="observation value" type="double"></column>
         <column nr="2" id="comment" description="comment" type="java.lang.String"></column>
       </table>
       <data>
         <record index="0">
           <value nr="0" content="2"></value>
           <value nr="1" content="18.6"></value>
           <value nr="2" content="normal"></value>
         </record>
         <record index="1">
           <value nr="0" content="4"></value>
           <value nr="1" content="36.18"></value>
           <value nr="2" content="normal"></value>
         </record>
       </data>
     </xmldata>
     

    Copyright (c) 2020-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
    BSD-style license. See DJUTILS License.

    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel