Connecting Tech Pros Worldwide Forums | Help | Site Map

Special Character inside XML string data

Norman Uhlenkott
Guest
 
Posts: n/a
#1: Nov 22 '05
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
Guest
 
Posts: n/a
#2: Nov 22 '05

re: Special Character inside XML string data



"Norman Uhlenkott" <NBUhlenk@gapac.com> wrote in message
news:050301c3bb7b$bb0f75f0$a101280a@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.


vMike
Guest
 
Posts: n/a
#3: Nov 22 '05

re: Special Character inside XML string data


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

"Norman Uhlenkott" <NBUhlenk@gapac.com> wrote in message
news:050301c3bb7b$bb0f75f0$a101280a@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]


vMike
Guest
 
Posts: n/a
#4: Nov 22 '05

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&moredatahere"
"vMike" <Michael.George@gewarren.com.nospam> wrote in message
news:bqr1d1$hah$1@ngspool-d02.news.aol.com...[color=blue]
> You could try somthing like this. I think it will work.
> <![CDATA[somedatahere&moredatahere]]> for example
>
> "Norman Uhlenkott" <NBUhlenk@gapac.com> wrote in message
> news:050301c3bb7b$bb0f75f0$a101280a@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]


Alan Pretre
Guest
 
Posts: n/a
#5: Nov 22 '05

re: Special Character inside XML string data


"Norman Uhlenkott" <NBUhlenk@gapac.com> wrote in message
news:050301c3bb7b$bb0f75f0$a101280a@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


Alan Pretre
Guest
 
Posts: n/a
#6: Nov 22 '05

re: Special Character inside XML string data


"Norman Uhlenkott" <NBUhlenk@gapac.com> wrote in message
news:050301c3bb7b$bb0f75f0$a101280a@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


Closed Thread


Similar .NET Framework bytes