本帖最后由 bcrun 于 2010-07-13 14:02:31 编辑

解决方案 »

  1.   

    格式是这样的:
    - <Order>
      <TransID>10001</TransID> 
       .
       .
     -<Item>
        <ItemID>1001</ItemID> 
         .
         .
       -<condiment>
         .
      

  2.   

    oDOM.LoadXML Session '<--
    oDOM.save "C:\PTout\12.xml"
      

  3.   

    '        添加一个子节点
            Dim aElement As IXMLDOMElement
            Set aElement = xmlDoc.createElement("xxxxyyyy") '节点名称
            aElement.nodeTypedValue = "ddddddddd" '节点值
            xmlDoc.documentElement.childNodes.Item(0).childNodes(0).childNodes(2).childNodes(0).appendChild aElement
    保存用.save 方法
      

  4.   

    使用loadXML 方法吧,参考官方帮助中的这些节选:loadXML Method
    Loads an XML document using the supplied string.Res
    Calling load or loadXML on an existing document immediately discards the content of the document. The loadXML() will work only with UTF-16 or UCS-2 encodings.This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).[Visual Basic] 
    Visual Basic Syntax
    boolValue = oXMLDOMDocument.loadXML(bstrXML)
    Parameters
    bstrXML 
    String containing the XML string to load into this XML document object. This string can contain an entire XML document or a well-formed fragment. 
    Return Value
    Boolean. Returns True if the XML load succeeded. Returns False and sets the documentElement property of the DOMDocument to Null if the XML load failed.Example
    The following Microsoft® Visual Basic® example creates a DOMDocument object, and then uses its loadXML method to load the specified XML before displaying it.Dim xmlDoc As New Msxml2.DOMDocument
    xmlDoc.async = False
    xmlDoc.loadXML ("<customer><first_name>Joe</first_name><last_name>Smith</last_name></customer>")
    MsgBox xmlDoc.xml
      

  5.   

    首先要保证XML的结构是正确的.
      

  6.   

    在你的程序末尾加上
    oDOM.Save “您的文件路径”
      

  7.   

    晕  早上才有空来看这个帖子。保存12.XML文件,什么都没有.
      

  8.   

    LoadXML 之后查看一下 ParseError 属性,看看是什么错误?
    估计 createProcessingInstruction 应该在 LoadXML 之后使用。
      

  9.   

    ParseError是-1072896659 session有值。12.XML是0KB的。
      

  10.   

    PareError 是个对象,下面的属性有错误的位置和描述!