Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. how to ocnvert string to XML file

how to ocnvert string to XML file

Scheduled Pinned Locked Moved XML / XSL
questionxmlhelptutorial
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aslesh
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • A Aslesh

      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

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      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

      A 2 Replies Last reply
      0
      • L 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

        A Offline
        A Offline
        Aslesh
        wrote on last edited by
        #3

        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

        L 1 Reply Last reply
        0
        • L 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

          A Offline
          A Offline
          Aslesh
          wrote on last edited by
          #4

          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>

          A 1 Reply Last reply
          0
          • A Aslesh

            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

            L Offline
            L Offline
            led mike
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • A Aslesh

              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>

              A Offline
              A Offline
              Aslesh
              wrote on last edited by
              #6

              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

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups