OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   Re: [xml-dev] Problem parsing XML file with Xerces-J

[ Lists Home | Date Index | Thread Index ]
  • To: Michael Kay <mike@saxonica.com>
  • Subject: Re: [xml-dev] Problem parsing XML file with Xerces-J
  • From: Midsummer Sun <midsummer.sun@gmail.com>
  • Date: Thu, 31 Mar 2005 19:07:38 +0530
  • Cc: xml-dev@lists.xml.org
  • Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=piFav+YWVJHgjhTPG3hql5LHqeJ1hZZd+Cb8S7/0sEM60hzw11DEiY0JG9OLEl1MFi8CgJ/cSbPQLPaqwmCtV14XNvKjdWq0odxoC7ZHQlE90MbbWZJkT5leOHCnNZCNRBrW11n42Mz8sXzIdHMz6w28yFd83v4ZzacouQI5Kgk=
  • In-reply-to: <424bf1b7.2c2ff2a5.67bd.ffffa56dSMTPIN_ADDED@mx.gmail.com>
  • References: <bb5e8b860503310420acf590f@mail.gmail.com> <424bf1b7.2c2ff2a5.67bd.ffffa56dSMTPIN_ADDED@mx.gmail.com>
  • Reply-to: Midsummer Sun <midsummer.sun@gmail.com>

I am sorry if I am breaching the protocol of the list. But can you
please tell whether just this method call "within resolveEntity method
(shown in my last post)"

return new InputSource();

shall achive "return an InputSource pointing to an empty DTD" you suggested..
Or do I have to do something else?

I'll try to solve the exception handling error myself..

Best regards,

On Thu, 31 Mar 2005 13:48:41 +0100, Michael Kay <mike@saxonica.com> wrote:
> I'm not the right person, and this isn't the right place, to teach you Java
> programming.
> 
> Michael Kay
> http://www.saxonica.com/
> 
> > -----Original Message-----
> > From: Midsummer Sun [mailto:midsummer.sun@gmail.com]
> > Sent: 31 March 2005 13:20
> > To: Michael Kay
> > Cc: xml-dev@lists.xml.org
> > Subject: Re: [xml-dev] 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@saxonica.com> 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/
> >
> 
>




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS