Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Special charecters handling while Converting XML string to DOM

921967Feb 18 2013 — edited Feb 18 2013
Hi,

I am using the following approach for converting XML string to DOM, but due to Special characters like "&", I am getting Exceptions:

String xmlString;
DocumentBuilderFactory factory =
DocumentBuilderFactory.newInstance();

DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new InputSource(new StringReader(xmlString)));


Can anyone please help me out on how to handle the Special characters in the above code.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2013
Added on Feb 18 2013
4 comments
243 views