MATLAB Function Reference |
Serialize XML Document Object Model node
Syntax
Description
xmlwrite(filename, DOMnode)
serializes the Document Object Model node DOMnode
to the file specified by filename
.
str = xmlwrite(DOMnode)
serializes the Document Object Model node DOMnode
and returns the node tree as a string, s
.
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.
Example
% Create a sample XML document. docNode = com.mathworks.xml.XMLUtils.createDocument... ('root_element') docRootNode = docNode.getDocumentElement; for i=1:20 thisElement = docNode.createElement('child_node'); thisElement.appendChild... (docNode.createTextNode(sprintf('%i',i))); docRootNode.appendChild(thisElement); end docNode.appendChild(docNode.createComment('this is a comment')); % Save the sample XML document. xmlFileName = [tempname,'.xml']; xmlwrite(xmlFileName,docNode); edit(xmlFileName);
See Also
xmlread | xor |
© 1994-2005 The MathWorks, Inc.