XMLTree

an XML toolbox for MATLAB

XMLTree: an XML toolbox for MATLAB

XML Parser is an XML 1.0 parser written in MATLAB. It aims to be fully conforming. It is currently not a validating XML processor.

This XML Parser is embedded in a MATLAB class (@xmltree) including various methods to import, export, access and modify the data. A subset of XPath is used for addressing parts of the XML document.

Download

Installation

This library takes advantage of MATLAB Object-Oriented facilities and all the code is embedded in a @xmltree class. To install it, all you need is to make sure that the directoy containing @xmltree is in MATLAB path:

  >> addpath /home/login/Documents/MATLAB/xmltree

Under certain circumstances, you might need to recompile a C-MEX file used to accelerate the parsing. To do so, just run the following in @xmltree/private:

  >> mex -O xml_findstr.c

Example

>> tree = xmltree('<root><path><tag>content</tag></path></root>');
>> uid = find(tree,'/root/path/tag');
>> get(tree,children(tree,uid),'value')
>> save(tree,'test.xml');

See also

For a faster, mostly compatible alternative, see also xml_parser.m, a MEX file wrapper around C library yxml.