wood burning stoves 2.0*
The moose likes XML and Related Technologies and the fly likes How do i surpass DTD Entry while Parsing XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "How do i surpass DTD Entry while Parsing XML " Watch "How do i surpass DTD Entry while Parsing XML " New topic
Author

How do i surpass DTD Entry while Parsing XML

Praveen Indraiah
Greenhorn

Joined: Aug 16, 2005
Posts: 2
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


Praveen T I<br />Technical Associate,<br />Mahindra - British Telecom,<br />Pune - 411004
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

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

Joined: Aug 16, 2005
Posts: 2
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
Bartender

Joined: Oct 14, 2005
Posts: 18907
    
    8

Did you try what I suggested?
Amy Medrat
Greenhorn

Joined: Mar 05, 2006
Posts: 15
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 ]

medRat
 
 
subject: How do i surpass DTD Entry while Parsing XML