Special Character inside XML string data

  • Thread starter Thread starter Norman Uhlenkott
  • Start date Start date
N

Norman Uhlenkott

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.
 
Norman Uhlenkott said:
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.

No, you can't store it this way, use XmlWriter.
 
You could try somthing like this. I think it will work.
<![CDATA[somedatahere&moredatahere]]> for example
 
Let me clarify that a bit more. the somedatahere and the moredatehere is
straight text. The example would add the literal "somedatahere&moredatahere"
vMike said:
You could try somthing like this. I think it will work.
<![CDATA[somedatahere&moredatahere]]> for example

Norman Uhlenkott said:
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.
 
Norman Uhlenkott said:
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

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

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

-- Alan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top