<xml>
   <ch1></ch1>
   <ch2></ch2>
   <ch3></ch3>
   <ch4></ch4>
   <ch5></ch5>
   <ch6></ch6>
   <ch7></ch7>
   <ch8></ch8>
</xml>
请问如何删除<ch6>这个节点呢?如何写这条语句呢?

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    var
      DocIntf:IXMLDocument;
      nodeIntf:IXMLNode;
      SourceDoc,DestDoc:String;
    begin  SourceDoc:=Memo1.Text;//取出源文档  //---------处理过程---------------
      docintf:=TXMLDocument.Create(nil);
      try
        docintf.XML.Text:=SourceDoc;
        DocIntf.Active:=true;
        DocIntf.ChildNodes.First.ChildNodes.Delete(5);
        DestDoc:=DocIntf.XML.Text;  finally
        DocIntf:=nil;
      end;
        //---------------------------  Memo2.Text:=DestDoc; //显示目标文档.end;