Click here to Skip to main content
15,797,721 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I have an XML with tag's value ('<>') between the tags and I m getting error while parsing this XML.

Error while validating - 'The content of elements must consist of well-formed character data or markup'

I have defined dataType for that Tag - type='xs:String' .....

could any 1 help me out, hw to parse XML with this value.
Updated 1-Nov-12 6:03am
Maciej Los 1-Nov-12 11:16am    
We need more details: example data, your code, etc.

1 solution

If I'm understanding you correctly, you want to use greater than and less than characters in your XML data.

For this you have 2 options: encode them or use CDATA.

The first is simple: replace "<" with "&lt;" and ">" with "&gt;", so <tag>></tag> becomes <tag>&gt;</tag>

The second is to wrap it in CDATA blocks which start with "<![CDATA[" and and with "]]>", which can contain anything (except the CDATA end sequence "]]>"), so the previous example would become <tag><![CDATA[>]]></tag>
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900