Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] problem with Aelfred parser

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: "Michael Kay" <mike AT saxonica.com>
  • To: "'Alex Ivanov'" <alexivanov AT cra.com>, <xom-interest AT lists.ibiblio.org>
  • Subject: Re: [XOM-interest] problem with Aelfred parser
  • Date: Fri, 2 Sep 2005 14:42:07 +0100

There are several versions of AElfred around, the code has forked at least
once. You need to be clear which you are using. (And probably, find a list
that's more appropriate than this one...)

Michael Kay
http://www.saxonica.com/


> -----Original Message-----
> From: xom-interest-bounces AT lists.ibiblio.org
> [mailto:xom-interest-bounces AT lists.ibiblio.org] On Behalf Of
> Alex Ivanov
> Sent: 02 September 2005 14:07
> To: xom-interest AT lists.ibiblio.org
> Subject: [XOM-interest] problem with Aelfred parser
>
> Hi,
>
> I'm using a default XML reader to set an entity resolver for
> a DTD. First, I
> wrote a library to read an XML file. I tested it and it worked fine.
> It turned out it was using Crimson parser as a default. Then
> I used the same
> library in my application. It threw an exception saying that
> it couldn't resolve dtd. I checked in the debugger and it
> turned out that
> picked up an Aelfred parser somewhere on the classpath. I inserted
> a print statement to check if it was calling it at all and it wasn't.
> However, when I set a Xerces parser explicitly in my code
> everything worked
> fine both in the library and in the application. It leads me
> to believe that
> Aelfred parser is not adding the DTD handler properly.
>
>
> xmlReader=XMLReaderFactory.createXMLReader(); //works in
> the library,
> doesn't work in the application
> //xmlReader =
> XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SA
> XParser");
> //works in both
>
>
> // set resolver for DTD
> xmlReader.setEntityResolver(docHandler);
> xmlReader.setErrorHandler(docHandler);
>
>
> private final DocHandler docHandler = new DocHandler();
>
> private final class DocHandler extends DefaultHandler
> {
> public InputSource resolveEntity(String publicId, String systemId)
> {
>
> System.out.println("******************************************
> ********"+syst
> emId);
>
> InputStream input = locateDtd(systemId);
> InputSource source = null;
> if (input != null)
> source = new InputSource(input);
> else
> System.out
> .println("Could not find DTD file: " + systemId/*
> .substring(systemId.lastIndexOf('/')+1) */);
>
> return source;
> }
>
>
> Thanks
>
> Alex
> _______________________________________________
> XOM-interest mailing list
> XOM-interest AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/xom-interest
>






Archive powered by MHonArc 2.6.24.

Top of Page