MATLAB Function Reference Previous page   Next Page
xmlread

Parse XML document and return Document Object Model node

Syntax

Description

DOMnode = xmlread(filename) reads a URL or filename and returns a Document Object Model node representing the parsed document. The node can be manipulated by using standard DOM functions.

A properly parsed document displays to the screen as

Remarks

Find out more about the Document Object Model at the World Wide Web Consortium (W3C) Web site, http://www.w3.org/DOM/. For specific information on using Java DOM objects, visit the Sun Web site, http://www.java.sun.com/xml/docs/api.

Examples

Example 1

All XML files have a single root element. Some XML files declare a preferred schema file as an attribute of this element. Use the getAttribute method of the DOM node to get the name of the preferred schema file:

Example 2

Each info.xml file on the MATLAB path contains several listitem elements with a label and callback element. This script finds the callback that corresponds to the label 'Plot Tools':

Example 3

This function parses an XML file using methods of the DOM node returned by xmlread, and stores the data it reads in the Name, Attributes, Data, and Children fields of a MATLAB structure:

See Also

xmlwrite, xslt


Previous page  xlswrite xmlwrite Next page

© 1994-2005 The MathWorks, Inc.