[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Problem parsing XML file with Xerces-J
I am obliged by your help. So I have done this change to my Java class (which extends DefaultHandler) i.e. added this method definition.. public InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId) throws java.io.IOException, SAXException { return new InputSource(); } I guess that "return new InputSource()" method call will return an InputSource pointing to an empty DTD(you suggested this workaround). Please correct me if I am wrong. But the program is giving error: XYZ.java:125: resolveEntity(java.lang.String,java.lang.String) in XYZ cannot override resolveEntity(java.lang.String,java.lang.String) in org.xml. sax.helpers.DefaultHandler; overridden method does not throw java.io.IOException public InputSource resolveEntity(java.lang.String publicId, ^ 1 error Now this seems to be a Java exception handling problem.. I am good at Java but not too good! Please tell the remedy. Best regards, On Thu, 31 Mar 2005 12:26:54 +0100, Michael Kay <mike@s...> wrote: > You need to do two things > > (a) register your EntityResolver with the parser - you've done this > > (b) use your EntityResolver to resolve URI references - you seem to have > omitted this step. > > This means you need to implement the resolveEntity() method to do something > useful when presented with the system ID of the external DTD - like > returning an InputSource pointing to an empty DTD. > > The default implementation of resolveEntity() in DefaultHandler does > nothing, you need to override it. > > Michael Kay > http://www.saxonica.com/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|