Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Java
saxparser ignore <!doctype> line
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Rashmi L, post: 5166132, member: 84584"] Hi, In my XML i have the content <!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"[URL]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\[/URL]">. Hence while parsing i m getting [B]SAXParseException: doctype not allowed in content. [/B] So i tried using factory.setFeature("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"[URL]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\[/URL]">", false); But it gave [B]org.xml.sax.SAXNotRecognizedException: [/B] So i override the method resolveEntity method in my custom handler as shown below. @Override public InputSource resolveEntity(String publicId, String systemId) { if (systemId.contains("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"[URL]http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\[/URL]">")) { return new InputSource(new StringReader("")); } else { return null; } } But this method is not getting called in parsing. May i know the details about this method when this method will be called? Please answer anybody. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Java
saxparser ignore <!doctype> line
Top