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:
     DataTable dataTable = new ListDataTable("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.ListDataTable">
         <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-2021 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information https://djutils.org. The DJUTILS project is distributed under a three-clause BSD-style license, which can be found at https://djutils.org/docs/license.html.
    Author:
    Alexander Verbraeck, Peter Knoppers, Wouter Schakel