In my experience, Catalogs is a standard that hardly anyone actually
uses. To do this in a JAXP compatible way, without using Xerces-specific
functionality, I would stick to the JAXP parser interfaces

http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/parsers/package-summary.html

and instead of a Catalog, implement a custom EntityResolver  (see
DocumentBuilder.setEntityResolver()) to recognize your DTD's system
identifier and load it from a locally configured location.

Eric


Mark H. Wood wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> So, because I'm a *stubborn* idiot:
>
>     builder.getDomConfig().setParameter("resource-resolver",
>         new XMLCatalogResolver(
>             System.getProperty("xml.catalog.files").split("\\s")));
>
> This seems to work and keeps unnecessary magic out of the code.  Thanks!
>
> Follow-up question:  is there a better way?  Given that:
>
> o  I want a DOM Document from which to pluck things randomly;
> o  I want to avoid unnecessary use of methods specific to Xerces (and
>     the Commons Resolver);
> o  I want to keep local knowledge (like where to find a DTD) out of the
>     code;
> o  I have no control over the unhelpful composition of the input document
>
> is there another sequence of methods that someone would consider
> better choices?  I'm brand-new to XML processing in Java (and very
> nearly new to XML altogether) so I'd like to learn more of how to
> think about such problems.
>
> - -- 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/
>
> iD8DBQFE4xwes/NR4JuTKG8RApxgAJwKdPySviFz9/Du8/DJgHjqiy+wDgCfVGTt
> S6mV4P4zTncecNYmF8IjClY=
> =ReoL
> -----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]

Reply via email to