<root>
<A qq="1001" qqname="Test1" >
<B code="1001001">
<i1 AA="001" BB="50" CC="10"></i1>
<i1 AA="002" BB="50" CC="5"></i1>
<i2 V="12345658"></i2>
<i2 V="1001001"></i2>
</B>
<B code="1001002">
<i1 AA="LC001" BB="50" CC="20"></i1>
<i1 AA="LC002" BB="50" CC="10"></i1>
<i2 V="12345698"></i2>
<i2 V="1001002"></i2>
</B>
</A></root>如何使用MSXML.DOMDocument生成上面有层次格式的XML文件?
<A qq="1001" qqname="Test1" >
<B code="1001001">
<i1 AA="001" BB="50" CC="10"></i1>
<i1 AA="002" BB="50" CC="5"></i1>
<i2 V="12345658"></i2>
<i2 V="1001001"></i2>
</B>
<B code="1001002">
<i1 AA="LC001" BB="50" CC="20"></i1>
<i1 AA="LC002" BB="50" CC="10"></i1>
<i2 V="12345698"></i2>
<i2 V="1001002"></i2>
</B>
</A></root>如何使用MSXML.DOMDocument生成上面有层次格式的XML文件?
Set b = doc.createNode(NODE_ELEMENT, "test2", "")Call doc.appendChild(a)
Call a.appendChild(b)
xmlDoc.async = False
root = "<?xml version=""1.0"" encoding=""utf-8"" ?>" & vbCrLf & "<ConstructProject></ConstructProject>"
If xmlDoc.LoadXML(root) Then
Set rootNode = xmlDoc.documentElement '获得根节点
............
end if
Set rootNode = xmlDoc.documentElement '获得根节点
rootnode.setAttribute "qq","1001"
end if
找不到SetAttribute的方法
Dim item_node As IXMLDOMNode40
Dim item_node As IXMLDOMElement 你再试试