XML解析问题. [英] problem in parsing XML....
本文介绍了XML解析问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在标签之间有一个带有标签值(``<>'')的XML,并且在解析该XML时出错.
验证时出错-元素的内容必须包含格式正确的字符数据或标记"
我已经为该标签定义了dataType-type =''xs:String''.....
有没有人可以帮我解决这个问题,请使用此值来解析XML.
Hi,
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.
推荐答案
如果我正确地理解了您的意思,则希望使用大于和小于XML数据中的字符.
为此,您有2个选项:对它们进行编码或使用CDATA.
第一个很简单:替换<"与& lt;"和>"与& gt"一起使用,因此<tag>></tag>
变为<tag>></tag>
第二种方法是将其包装在以<![CDATA ["和]]>"开头的CDATA块中,该块可以包含任何内容(CDATA结束序列]]>"除外),因此前面的示例将成为<tag><![CDATA[>]]></tag>
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 "<" and ">" with ">", so<tag>></tag>
becomes<tag>></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>
这篇关于XML解析问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文