Skip to content
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

SAXNotRecognizedException #42

Open
foobnix opened this issue Mar 17, 2024 · 3 comments
Open

SAXNotRecognizedException #42

foobnix opened this issue Mar 17, 2024 · 3 comments

Comments

@foobnix
Copy link

foobnix commented Mar 17, 2024

Please help to fix for Android, there is an exception

Caused by: org.xml.sax.SAXNotRecognizedException: http://apache.org/xml/features/disallow-doctype-decl
at org.apache.harmony.xml.parsers.SAXParserFactoryImpl.setFeature(SAXParserFactoryImpl.java:93)

java.lang.RuntimeException: org.xml.sax.SAXNotRecognizedException: http://apache.org/xml/features/disallow-doctype-decl
at org.zwobble.mammoth.internal.xml.parsing.SimpleSax.parseInputSource(SimpleSax.java:67)
at org.zwobble.mammoth.internal.xml.parsing.SimpleSax.parseStream(SimpleSax.java:24)
at org.zwobble.mammoth.internal.xml.parsing.XmlParser.parseStream(XmlParser.java:24)
at org.zwobble.mammoth.internal.docx.OfficeXml.parseXml(OfficeXml.java:38)

@mwilliamson
Copy link
Owner

It appears that the implementation of the SAX parser doesn't support disabling DTDs, which prevents XML entity attacks. If possible, I'd suggest switching to a SAX parser that supports the feature.

@foobnix
Copy link
Author

foobnix commented Mar 17, 2024

I am using implementation 'javax.xml.stream:stax-api:1.0-2' and it's works fine with the old version of your library
I have try implementation 'xerces:xercesImpl:2.12.2' - it's not helped.
Could you please suggest a sax parser that supports this feature?
or
Can you configure the library not to crash if the parser does not support this feature?

@mwilliamson
Copy link
Owner

Could you please suggest a sax parser that supports this feature?

Xerces should support the feature: https://xerces.apache.org/xerces2-j/features.html

Can you configure the library not to crash if the parser does not support this feature?

The feature avoids a security vulnerability, so I would be reluctant to ignore errors from enabling the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants