Add CData to improperly formed XML element [duplicate]
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.
精彩评论