0

I am trying to convert an Xml String to XML DOM object using Xerces (xercesImpl-2.8.1.jar).

But it seems that it provides only following methods, it does not offer a method that would take an XML string and convert it to an Object.

  • parse(File f)
  • parse(InputSource is)
  • parse(InputStream is)
  • parse(String uri)

Any pointers would be great.

1 Answer 1

3

One can convert the XML string to a Reader

java.io.StringReader xmlReader = new java.io.StringReader(xml);
Document doc = docBuilder.parse(new InputSource(xmlReader));
Sign up to request clarification or add additional context in comments.

1 Comment

java.io.FileNotFoundException: (The system cannot find the path specified), on Document line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.