文档

xmlwrite

写XML文档对象模型节点

句法

XMLWRITE(文件名,domnode)
chr = xmlwrite(domnode)

描述

xmlwrite(文件名,,,,domnode写文档对象模型(DOM)节点domnode到文件文件名

chr= xmlwrite(domnode返回序列化的DOM节点作为字符向量。

输入参数

文件名

指定本地文件或URL名称的字符向量。

domnode

文档对象模型节点,由万维网联盟定义。有关更多信息,请参阅什么是XML文档对象模型(DOM)?

输出参数

chr

字符向量包含XML文件中显示的序列化DOM节点。

例子

创建并查看XML文档:

docnode = com.mathworks.xml.xmlutils.createdocument ...('root_element')docRootnode = docnode.getDocumentElement;docRootnode.setAttribute('attr_name','attr_value');对于i = 1:20 thisElement = docnode.createelement('child_node');thiselement.AppendChild ...(docNode.CreateTextNode(sprintf('%i',i)));docRootnode.appendchild(thisElement);end docnode.appendchild(docnode.createcomment('this是评论'));xmlfileName = [tempname,'。xml'];XMLWRITE(XMLFILENAME,DOCNODE);type(xmlfileName);

在R2006a之前引入

这个话题有帮助吗?