我把一个XML文件读入到XmlDataDocument中,然后想把这个XML文件的所有内容(一字不差)地读入到一个string变量中,请问该怎么做呢? 

解决方案 »

  1.   

    ---例如:
    var
       xmlDoc :TXMLDocument;
    begin
        OutXML :=TEnterRecipeDeatil(aptr)(QnSendXML.S_MZRegBalancePay(
                          I_IFPAY,I_PERSONCODE,I_SICKCODE,I_OPERATOR,
                          I_INVOICENO,I_DOFLAG),InCDS,OutCDS);               try
                     try
                         XmlDoc:=TXMLDocument.Create(Application);
                         XmlDoc.XML.Text :=OutXML;
                         XmlDoc.Active   :=true;
                         RetCode:=XmlDoc.DocumentElement.ChildNodes['RETCODE'].NodeValue;
                        if RetCode<>'0' then
                         begin
                           O_ErrorInfo :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['INFO'].NodeValue,'');
                           exit;
                         end
                        else
                          Result:=true;                     O_BILLNO  :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['BILLNO'].NodeValue,'');
                         O_FEEALL  :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['FEEALL'].NodeValue,'0');
                         O_FUNDPAY :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['FUNDPAY'].NodeValue,'0');
                         O_ACCTPAY :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['ACCTPAY'].NodeValue,'0');
                         O_CASHPAY :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['CASHPAY'].NodeValue,'0');
                         O_BIGPAY  :=VarToStrDef(xmlDoc.DocumentElement.ChildNodes['BIGPAY'].NodeValue,'0');
     
                     except
                     end;
                 finally
                  xmlDoc.Free;
                 end;
              end;