xmlwrite - Serialize XML Document Object Model node
Syntax
xmlwrite(filename, DOMnode)
str = xmlwrite(DOMnode)
Description
xmlwrite(filename, DOMnode) serializes the Document Object Model node DOMnode to the file specified by filename. The filename input is a string enclosed in single quotes.
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/.
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, xslt
 | xmlread | | xor |  |
Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
Get the Interactive Kit