how to ocnvert string to XML file
-
HI I have a string which has text like in XML format. but i need to store this string as an XML file. How can i do this? Help me, SAnthapur
Santhapur wrote:
I have a string which has text like in XML format
No such thing as "like in XML format". It's either well formed XML or not, period.
Santhapur wrote:
but i need to store this string as an XML file. How can i do this?
Do you know how to write files to disk? If you do then do it, if you don't then your problem has nothing to do with XML.
led mike
-
Santhapur wrote:
I have a string which has text like in XML format
No such thing as "like in XML format". It's either well formed XML or not, period.
Santhapur wrote:
but i need to store this string as an XML file. How can i do this?
Do you know how to write files to disk? If you do then do it, if you don't then your problem has nothing to do with XML.
led mike
-
Santhapur wrote:
I have a string which has text like in XML format
No such thing as "like in XML format". It's either well formed XML or not, period.
Santhapur wrote:
but i need to store this string as an XML file. How can i do this?
Do you know how to write files to disk? If you do then do it, if you don't then your problem has nothing to do with XML.
led mike
This is the content of my string <?xml version="1.0"?> <PatientUpdate> <MSH> <MSH.1>|</MSH.1> <MSH.2>^~\&</MSH.2> <MSH.3> <EI.1>REGADT</EI.1> </MSH.3> <MSH.4> <EI.1>MCM</EI.1> </MSH.4> <MSH.5> <EI.1>RSP1P8</EI.1> </MSH.5> <MSH.6> <EI.1>MCM</EI.1> </MSH.6> <MSH.7>19960105153000+0000</MSH.7> <MSH.8>SEC</MSH.8> <MSH.9> <CM_MSH.1>ADT</CM_MSH.1> <CM_MSH.2>A44</CM_MSH.2> </MSH.9> <MSH.10>00000007</MSH.10> <MSH.11> <PT.1>P</PT.1> </MSH.11> <MSH.12>2.3</MSH.12> </MSH> <PID> <PID.3> <CX.1>MR2</CX.1> <CX.4> <HD.1>XYZ</HD.1> </CX.4> </PID.3> <PID.5> <XPN.1>JONES</XPN.1> <XPN.2>WILLIAM</XPN.2> <XPN.3>A</XPN.3> <XPN.4>JR</XPN.4> </PID.5> <PID.7>19501010000000+0000</PID.7> <PID.8>M</PID.8> <PID.11> <XAD.1>123 EAST STREET</XAD.1> <XAD.3>NY</XAD.3> <XAD.4>NY</XAD.4> <XAD.5>10021</XAD.5> </PID.11> <PID.13> <XTN.1>(212)111-3333</XTN.1> </PID.13> <PID.16>S</PID.16> <PID.18> <CX.1>ACCT1</CX.1> </PID.18> </PID> </PatientUpdate>
-
i am getting a string the content of the string will be well formatted XML document. i need to store the whole content of the string to a XML file and save it to the disk. Did u get my problem
Santhapur wrote:
i need to store the whole content of the string to a XML file and save it to the disk. Did u get my problem
Yes, did you read my reply?
led mike wrote:
Do you know how to write files to disk? If you do then do it, if you don't then your problem has nothing to do with XML.
led mike
-
This is the content of my string <?xml version="1.0"?> <PatientUpdate> <MSH> <MSH.1>|</MSH.1> <MSH.2>^~\&</MSH.2> <MSH.3> <EI.1>REGADT</EI.1> </MSH.3> <MSH.4> <EI.1>MCM</EI.1> </MSH.4> <MSH.5> <EI.1>RSP1P8</EI.1> </MSH.5> <MSH.6> <EI.1>MCM</EI.1> </MSH.6> <MSH.7>19960105153000+0000</MSH.7> <MSH.8>SEC</MSH.8> <MSH.9> <CM_MSH.1>ADT</CM_MSH.1> <CM_MSH.2>A44</CM_MSH.2> </MSH.9> <MSH.10>00000007</MSH.10> <MSH.11> <PT.1>P</PT.1> </MSH.11> <MSH.12>2.3</MSH.12> </MSH> <PID> <PID.3> <CX.1>MR2</CX.1> <CX.4> <HD.1>XYZ</HD.1> </CX.4> </PID.3> <PID.5> <XPN.1>JONES</XPN.1> <XPN.2>WILLIAM</XPN.2> <XPN.3>A</XPN.3> <XPN.4>JR</XPN.4> </PID.5> <PID.7>19501010000000+0000</PID.7> <PID.8>M</PID.8> <PID.11> <XAD.1>123 EAST STREET</XAD.1> <XAD.3>NY</XAD.3> <XAD.4>NY</XAD.4> <XAD.5>10021</XAD.5> </PID.11> <PID.13> <XTN.1>(212)111-3333</XTN.1> </PID.13> <PID.16>S</PID.16> <PID.18> <CX.1>ACCT1</CX.1> </PID.18> </PID> </PatientUpdate>
Hai I found the Solution... here it is String fileName = @"\XMLFile.xml"; Some XML file path in which u want to store.... File.Delete(fileName); <red>Every time your are deleting the file to avoid appending the text for every execution.</red> File.AppendAllText(fileName,XmlFormat); Coping the string value into the xml file.. Santhapur