Hi Mark, The settings of system properties for the xml-commons resolver have no effect on an XMLCatalogResolver. This is by design [1]. You need to set the catalog list [2] on each instance of XMLCatalogResolver you create.
Thanks. [1] http://mail-archives.apache.org/mod_mbox/xerces-j-users/200401.mbox/[EMAIL PROTECTED] [2] http://xerces.apache.org/xerces2-j/javadocs/xerces2/org/apache/xerces/util/XMLCatalogResolver.html#setCatalogList(java.lang.String[]) Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] "Mark H. Wood" <[EMAIL PROTECTED]> wrote on 08/15/2006 04:32:27 PM: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > I'm trying to parse some statistical data from a device that sends me back > a document starting like this: > > <?xml version="1.0" ?> > <!DOCTYPE statistics SYSTEM "statistics-1.0.dtd" > > > Rather than have to have a copy of the DTD in the current working > directory whenever I run my app., I'd like to slap a copy of it somewhere, > point a catalog entry to it, and let a resolver find it. > > After banging my head against the doco. for two days, I tracked down > XMLCatalogResolver, which seems to be the sort of thing that an LSParser > would want: > > DOMImplementationLS impl; > LSParser builder; > LSInput input; > > System.setProperty(DOMImplementationRegistry.PROPERTY, > "org.apache.xerces.dom.DOMImplementationSourceImpl"); > > try { > DOMImplementationRegistry registry = > DOMImplementationRegistry.newInstance(); > > impl = (DOMImplementationLS)registry.getDOMImplementation("LS"); > > builder = impl.createLSParser( > DOMImplementationLS.MODE_SYNCHRONOUS, null); > } catch (Exception e) { > System.err.println(e.getMessage()); > return; > } > > input = impl.createLSInput(); > input.setByteStream(in); > > builder.getDomConfig().setParameter("resource-resolver", > new XMLCatalogResolver()); > > Document document = builder.parse(input); > > But it acts as though I'd never set a resource-resolver: it still > requires that the DTD be present in `cwd`. I 'strace'd it and saw no > attempt to open the catalog. (I started java with: > > -Dxml.catalog.files=file:///etc/xml/catalog \ > -Dxml.catalog.verbosity=99 > > ) > > What have I missed? > > - -- > Mark H. Wood, Lead System Programmer [EMAIL PROTECTED] > Typically when a software vendor says that a product is "intuitive" he > means the exact opposite. > > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.4 (GNU/Linux) > Comment: pgpenvelope 2.10.2 - http://pgpenvelope.sourceforge.net/ > > iD8DBQFE4i9is/NR4JuTKG8RAq1HAJ0T0DajedBo9Y3xT5RwA3TwPCvAbACcCwGj > HmorNk8+QBhpoDx2Cnhra5k= > =MD/W > -----END PGP SIGNATURE----- > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
