0

Midified the xml file using DomDocument object?

Have a file.xml

 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <Document xmlns="urn:iso:std">
 <content>
 <GrpHdr>
   <MsgId>xxxxxx </MsgId>
   <CreDtTm>2010-07-05T16:48:00</CreDtTm>
   <BtchBookg>false</BtchBookg>
   <NbOfTxs>2</NbOfTxs>
   <CtrlSum>56653</CtrlSum>
   <Grpg>Old</Grpg>
   <InitgPty>
   <Nm> Name </Nm>
   </InitgPty>
 </GrpHdr>
 </content>
 <Document>

How can modified the xml data and save back to file.xml (for example )

 <NbOfTxs>1</NbOfTxs>
 <CtrlSum>1223</CtrlSum>
 <Grpg>NEW</Grpg>
hakre
  • 184,866
  • 48
  • 414
  • 792
kn3l
  • 18,459
  • 28
  • 85
  • 123
  • 2
    possible duplicate of [How to modify xml file using PHP](http://stackoverflow.com/questions/1193528/how-to-modify-xml-file-using-php) – Pekka Dec 28 '10 at 11:03

1 Answers1

1

Use save() function of the DomDocument Object, for example:

$dom->save("newfile.xml")

Look here for further details

Shamim Hafiz - MSFT
  • 20,466
  • 38
  • 110
  • 169