Special Character inside XML string data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Norman Uhlenkott

    #1

    Special Character inside XML string data

    I would like to be able to put in special character inside
    an xml data string (#, <, >, &).
    when it trys to parses out the XML String it errors out

    strXML = "<?xml version='1.0'?> " & vbCRLF
    strXML = strXML + "<WO_Step>" & vbCRLF
    strXML = strXML + "<Test>Test Special Characters #, %, &,
    <, > </Test>
    strXML = strXML + "</WO_Step>"

    What is the best way to pass this type of information?
    Would changing the encoded of the XML string work.
  • Ayende Rahien

    #2
    Re: Special Character inside XML string data


    "Norman Uhlenkott" <NBUhlenk@gapac .com> wrote in message
    news:050301c3bb 7b$bb0f75f0$a10 1280a@phx.gbl.. .[color=blue]
    > I would like to be able to put in special character inside
    > an xml data string (#, <, >, &).
    > when it trys to parses out the XML String it errors out
    >
    > strXML = "<?xml version='1.0'?> " & vbCRLF
    > strXML = strXML + "<WO_Step>" & vbCRLF
    > strXML = strXML + "<Test>Test Special Characters #, %, &,
    > <, > </Test>
    > strXML = strXML + "</WO_Step>"
    >
    > What is the best way to pass this type of information?
    > Would changing the encoded of the XML string work.[/color]

    No, you can't store it this way, use XmlWriter.


    Comment

    • vMike

      #3
      Re: Special Character inside XML string data

      You could try somthing like this. I think it will work.
      <![CDATA[somedatahere&mo redatahere]]> for example

      "Norman Uhlenkott" <NBUhlenk@gapac .com> wrote in message
      news:050301c3bb 7b$bb0f75f0$a10 1280a@phx.gbl.. .[color=blue]
      > I would like to be able to put in special character inside
      > an xml data string (#, <, >, &).
      > when it trys to parses out the XML String it errors out
      >
      > strXML = "<?xml version='1.0'?> " & vbCRLF
      > strXML = strXML + "<WO_Step>" & vbCRLF
      > strXML = strXML + "<Test>Test Special Characters #, %, &,
      > <, > </Test>
      > strXML = strXML + "</WO_Step>"
      >
      > What is the best way to pass this type of information?
      > Would changing the encoded of the XML string work.[/color]


      Comment

      • vMike

        #4
        Re: Special Character inside XML string data

        Let me clarify that a bit more. the somedatahere and the moredatehere is
        straight text. The example would add the literal "somedatahere&m oredatahere"
        "vMike" <Michael.George @gewarren.com.n ospam> wrote in message
        news:bqr1d1$hah $1@ngspool-d02.news.aol.co m...[color=blue]
        > You could try somthing like this. I think it will work.
        > <![CDATA[somedatahere&mo redatahere]]> for example
        >
        > "Norman Uhlenkott" <NBUhlenk@gapac .com> wrote in message
        > news:050301c3bb 7b$bb0f75f0$a10 1280a@phx.gbl.. .[color=green]
        > > I would like to be able to put in special character inside
        > > an xml data string (#, <, >, &).
        > > when it trys to parses out the XML String it errors out
        > >
        > > strXML = "<?xml version='1.0'?> " & vbCRLF
        > > strXML = strXML + "<WO_Step>" & vbCRLF
        > > strXML = strXML + "<Test>Test Special Characters #, %, &,
        > > <, > </Test>
        > > strXML = strXML + "</WO_Step>"
        > >
        > > What is the best way to pass this type of information?
        > > Would changing the encoded of the XML string work.[/color]
        >
        >[/color]


        Comment

        • Alan Pretre

          #5
          Re: Special Character inside XML string data

          "Norman Uhlenkott" <NBUhlenk@gapac .com> wrote in message
          news:050301c3bb 7b$bb0f75f0$a10 1280a@phx.gbl.. .[color=blue]
          > I would like to be able to put in special character inside
          > an xml data string (#, <, >, &).
          > when it trys to parses out the XML String it errors out[/color]

          For the following special chars in the 1st column use the sequences in the
          2nd column.
          & &amp;
          < &lt;[color=blue]
          > &gt;[/color]
          " &quot;
          ' &apos;
          [color=blue]
          > strXML = strXML + "</WO_Step>"[/color]

          For example,
          strXML = strXML + "&lt;/WO_Step&gt;"

          -- Alan


          Comment

          Working...