parsing special characters in xml
i have an response xml with contains the line as
<Description>DVD +/- RW Drive (read/write CD & DVD)</Description>
when try to read this xml response and load it to xml document it is throwing error as An error occurred while parsing EntityName.
i have changed the above line as
<Description>DVD +/- RW Drive (read/write CD and DVD)</Description>
still the error exists can any one guide me where开发者_如何学编程 i have gone wrong
you can use Apache Commons Lang class StringEscapeUtils escapeXML method handle to non-ASCII characters in XML Apache Commons
Your XML generator must replace &
with &
.
You can process the XML as XPL. XPL has the same structure as XML - the only difference is that the parser allows special characters in text fields. You can use the XPL process on its own or as a pre-processor into valid XML (i.e. transforms your special characters for you and other things). There's even a recent article explaining the use of Java Concurrency to eliminate the performance cost of pre-processing (into SAX). eXtensible Process Language
精彩评论