The XML Toolbox
A User’s Guide
XML Toolbox for Matlab V.3.1.2
2
Release: XML Toolbox v.3.1.2 standalone
Version: manual.doc 3.1.2
Title: The XML Toolbox – A User's Guide
Authors: Dr Marc Molinari, m.molinari@soton.ac.uk
PI: Prof Simon Cox, s.j.cox@soton.ac.uk
Web: http://www.geodise.org
Note: This is an extract from "The Geodise User Manual – A User's Guide"
Copyright: Copyright © 2005, The Geodise Project, University of Southampton
Acknowledgement:
The development of the Geodise toolboxes for public release has been
supported by the managed programme of the Open Middleware
Infrastructure Institute (http://www.omii.ac.uk/).
XML Toolbox for Matlab V.3.1.2
3
Contents
Introduction from "The Geodise Toolboxes".................................................................3
Introduction....................................................................................................................5
Tutorial...........................................................................................................................6
Function Reference ......................................................................................................12
xml_format...........................................................................................................12
xml_formatany.....................................................................................................15
xml_help ..............................................................................................................17
xml_load ..............................................................................................................18
xml_parse.............................................................................................................20
xml_parseany.......................................................................................................22
xml_save ..............................................................................................................25
Examples......................................................................................................................26
Frequently Asked Questions........................................................................................34
Introduction from "The Geodise Toolboxes"
The Geodise Toolboxes provide a collection of functions that extend the capability of
the Matlab
®1
technical computing environment. The Geodise Compute, Database and
XML toolboxes contain routines that facilitate many aspects of Grid computing and
data management including:
• The submission and management of computational job on remote compute
resources via the Globus GRAM service.
• File transfer and remote directory management using the GridFTP protocol.
• Single sign-on to the Grid with Globus proxy certificates.
• Storage and grouping of files and variables, annotated with user defined
metadata, in an archive.
• Graphical and programmatic interfaces for querying the metadata to easily
locate files and variables.
1
Matlab
®
is a registered trademark of The Mathworks, Inc, http://www.mathworks.com
XML Toolbox for Matlab V.3.1.2
4
• Sharing and reuse of data among distributed users. Users may grant access to
their data to other members of a Virtual Organisation.
• Conversion of Matlab structures and variables into a non-proprietary, plain
text format (XML) which can be stored and used by other tools.
• Conversion of almost any type of XML document including WSDL
descriptions of Web Services into Matlab's struct format or cell data type.
Grid computing provides the infrastructure for the collaborative use of computers,
networks, data, storage and applications across distributed organisations. A
computational job can be run on the Grid to make use of resources unavailable on the
user’s desktop, for example to exploit software licenses or greater computational
power. The Geodise Compute Toolbox provides Matlab functions for submitting and
monitoring jobs on the Grid, transferring files to and from remote compute resources,
and managing the certificates used to identify users and authorise use of the resources.
Compute intensive applications often use and produce many data files and data
structures. It can become difficult to find, reuse and share data from various
applications that have been run repeatedly with different parameters. The Geodise
Database Toolbox can be used to store additional user-defined information (called
metadata) describing files and Matlab variables, so that they can be located and
retrieved more easily with metadata queries. Files and variables can also be grouped
together, and data can be shared with other users by granting access permissions.
XML is a flexible standard data format that is widely used to structure and store
information, and to exchange data between various computer applications. The XML
Toolbox functions convert and store Matlab variables and structures from the internal
format into XML and vice versa. This allows parameter structures, variables and
results from computational applications to be stored in a non-proprietary file format,
or in XML-capable databases, and can be used to transfer Matlab data across the Grid.
Comparing arbitrary Matlab structures was not previously possible, but this can be
now achieved by comparing their XML representation.
This user guide is an extract of the full Geodise manual and introduces the reader to
the XML toolbox giving an overview of the functionality provided. The function
reference contains detailed information about the syntax its functions.
XML Toolbox for Matlab V.3.1.2
5
Introduction
The XML Toolbox for Matlab allows users to convert and store variables and
structures from the Matlab workspace into the plain text XML format, and vice versa.
This XML format can be used to store parameter structures, variables and results from
engineering applications in non-proprietary files, or XML-capable databases, and can
be used for the transfer of data across the Grid. The toolbox contains bi-directional
conversion routines implemented as four small intuitive and easy-to-use Matlab
functions. As an additional feature, this toolbox allows the comparison of internal
Matlab structures by comparing their XML representation, which was not previously
possible.
• Almost any type of XML document can be read and converted into Matlab's
struct format or cell data type.
• Matlab structures and variables can be stored in a non-proprietary format and
used by other tools.
• XML representations can be stored and queried using the functions provided
by the Geodise Database Toolbox.
• The ability to leverage XML and database technologies makes the data
available beyond the Matlab environment, and facilitates data sharing and
reuse between users.
• Access to XML data-driven tools such as Web Services becomes more
transparent to engineering users.
The following definitions are valid for XML Toolbox Version ≥ 2.0 (2.0, 2.1, 2.2,
3.0a, 3.1). The size of data structures the XML Toolbox can deal with is only limited
by the available memory; as an indication, 60MB large data structures can be easily
converted on a 256MB PC running Matlab.
xml_format
Converts Matlab data to an XML string
xml_formatany
Converts Matlab data to an XML string
with user-defined attributes
xml_parse
Converts an XML string into Matlab data
xml_parseany
Converts an XML string with attributes
into Matlab data
xml_load
Loads an XML file and returns Matlab
data
xml_save
Saves Matlab data into an XML file
xml_help
Displays help for each xml_ function
Table 1 XML Toolbox functions
- 1
- 2
- 3
- 4
- 5
- 6
前往页