<%
Set xmlDoc = Server.CreateObject("MSXML2.DOMDOCUMENT")
xmlDoc.loadXML( "<response />" )
Set node = xmlDoc.createElement("account")
xmlDoc.documentElement.AppendChild node
Set node = xmlDoc.createElement("type")
node.Text = "TheType"
xmlDoc.documentElement.AppendChild node
Set node = Nothing
%>
这将创建一个如下所示的 XML 文档:
<response>
<account></account>
<type>TheType</type>
</response>
如何将“type”节点作为子节点附加到“newaccount”节点,使其看起来像这样:
<response>
<account>
<type>TheType</type>
</account>
</response>