开发者

Add CData to improperly formed XML element [duplicate]

This question already has answers here: 开发者_StackOverflow中文版 Closed 11 years ago.

Possible Duplicate:

Best way to convert xml to have CDATA around text (in java)

Hello I have the following code which is parsing some XML by element name.

NodeList title = element.getElementsByTagName("title");
Element line = (Element) title.item(0);

The "title" of each node is improperly formed XML, it is not wrapped in CDATA, which leads to all sorts of errors when there are special characters. I am unable to manipulate the XML from the source. How would I go about fixing the element before I begin to use it?


Ask the provider of that XML document to fix it, if it's not proper XML.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜