-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
org.xml.sax.SAXParseException: The entity "reg" was referenced, but not declared. #9
Comments
Assuming you are talking about detecting differences, you can configure the Is it enough to set it to be non.validating - http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#setValidating(boolean) ? |
Following two versions of the code are throwing the same exception. I have tried with 2.2.1 and 2.30 versions
and
|
Hmm, I thought http://docs.oracle.com/javase/7/docs/api/javax/xml/parsers/DocumentBuilderFactory.html#setExpandEntityReferences(boolean) looks promising, or you may need to provide an |
For the time being I have done a horrible hack to make it work. Following is the code. the code for
|
If there is no DTD that defines the entities then your documents are not well-formed XML documents, strictly speaking. If you cannot change the document to reference the DTD (HTML, likely) I'm afraid your hack is the only way to go. An equally ugly alternative would be to inject an internal DTD block that defined the entities by doing something similar to https://github.com/xmlunit/xmlunit/blob/master/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/DoctypeInputStream.java which inserts a DOCTYPE declaration into the stream (or replaces an existing one). BTW, Do you think there is anything XMLUnit could be doing to help in your case? |
I guess, the only thing xmlunit can do is to provide an option to inject external DTDs before the validation. |
I've created xmlunit/xmlunit#90 for this as it may get more visibility over there, closer to the code. Please take a look at the issue and yell in case I've forgotten anything. Thanks. |
For the following xml node,
<REGISTEREDNAME indication="something" country="European Union" company="abcd">cde®</REGISTEREDNAME>
Following exception is thrown :
org.xml.sax.SAXParseException: The entity "reg" was referenced, but not declared.
How do I disable entity validation in xmlunit. In my case, I cannot modify the xml.
The text was updated successfully, but these errors were encountered: