XML2STRUCT
Convert XML data to MATLAB struct


XML2STRUCT, a MATLAB program which reads a file containing XML data, and produces a corresponding MATLAB struct, by Wouter Falkena.

A file containing:

  
    Some text
    Some more text
    Even more text
  
will produce a struct:
  s.XMLname.Attributes.attrib1 = "Some value";
  s.XMLname.Element.Text = "Some text";
  s.XMLname.DifferentElement{1}.Attributes.attrib2 = "2";
  s.XMLname.DifferentElement{1}.Text = "Some more text";
  s.XMLname.DifferentElement{2}.Attributes.attrib3 = "2";
  s.XMLname.DifferentElement{2}.Attributes.attrib4 = "1";
  s.XMLname.DifferentElement{2}.Text = "Even more text";

Licensing:


Copyright (c) 2010, Wouter Falkena
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

    * Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the distribution

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

Languages:

XML2STRUCT is available in a MATLAB version.

Related Data and Programs:

DOLFIN_XML, a data directory which contains examples of XML files that describe 3D finite element method (FEM) meshes as used by DOLFIN and FENICS.

FEM_TO_XML, a MATLAB program which reads FEM files defining a 1D, 2D or 3D mesh, namely a file of node coordinates and a file of elements defined by node indices, and creates a corresponding XML file for input to DOLFIN or FENICS.

TRIANGLE_TO_XML, a MATLAB program which reads the NODE and ELE files created by triangle() to describe a triangular mesh in 2D, and writes out a corresponding XML mesh file for use by DOLFIN or FENICS.

XML, a data directory which contains examples of XML files, a standard, general datafile format.

xml2struct_test

Author:

Wouter Falkena, ASTI, TUDelft.

Source Code:


Last modified on 19 June 2019.