File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do i surpass DTD Entry while Parsing XML

 
Praveen Indraiah
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to avoid parsing .xml file using SAXON by not reading DTD entry.My XML file doesnt has DTD entry (niether Internal nor External).So when i try to parse the xml i am getting exception from SAXON. Is there is any way that i can avoid looking for DTD entry and Parse XML file.The urgent help required.

Lot Thanks in Advance.

Praveen
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your XML contains a reference to a DTD that can't be resolved? Then write an EntityResolver and apply it to your parser by calling setEntityResolver. Your EntityResolver should be just like the example in the API documentation for org.xml.sax.EntityResolver, but it should return
 
Praveen Indraiah
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul,

No.. here my XML doesnt have any DTD reference. I have removed DTD entry for some reason.And when i try to parse this xml the parser tries to find associated DTD and when it doesnt find entry it just throws exception.

Regards,
Praveen
[ March 15, 2006: Message edited by: Praveen Indraiah ]
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try what I suggested?
 
Amy Medrat
Greenhorn
Posts: 15
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you can resolve this by seting the validation false.

SAXParserFactoryObject.setValidating(false) // if you are using SAX parser
or
DocumentBuilderFactoryObject.setValidating(false) //if using DOM parser

Hope this helps.
[ March 17, 2006: Message edited by: Amy Medrat ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic