0

I'm trying to parse XML document as String by using the following

Document parse = DocumentBuilderFactory.newInstance().newDocumentBuilder()
                .parse(new InputSource(new StringReader(xmlFile)));

but I'm getting this error

[Fatal Error] The entity "Ouml" was referenced, but not declared.

I tried escape and unescape xmlFile String using Apache StringEscapeUtils but still having errors

3
  • Its telling you theres something wrong with the xml, at an element named "Ouml". By the sounds of your question, you should be treating the file as a regular file (java.util.Scanner?) rather than using an xml parser? Commented Mar 20, 2015 at 10:06
  • Cant really add much more without seeing the xml file. Commented Mar 20, 2015 at 10:06
  • source file of gazetevatan.com/rss/gundem.xml Commented Mar 20, 2015 at 10:17

1 Answer 1

2

HTML 4.0 knows 252 predefined character-entities like Ö, ß etc.

XML on the other hand only has 5:

"
&
'
<
>

You can't use named character-entities from html other than those without defining them first.

So when using StringEscapeUtils make sure you use escapeXml() instead of escapeHtml4().

Sign up to request clarification or add additional context in comments.

Comments

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.