[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]
Re: [xml-dev] How to open XML file that reference entity resolver(DTD)
- From: Liam R E Quin <liam@w3.org>
- To: Jack Bush <netbeansfan@yahoo.com.au>
- Date: Tue, 29 Jun 2010 09:36:44 -0400
On Tue, 2010-06-29 at 01:00 -0700, Jack Bush wrote:
[...]
> Looks like it is the default Sax parser possibly via JAXP that does
> not come with the XHTML DTDs and with an XML catalog set up to use
> them instead of going to www.w3.org each time.
> I am still waying through the references to use XML Catalog but it
> doesn't appears to provide every facets to a Java solution. It would
> great if you could provide some example of how everything are
> interconnected together.
When the XML parser sees it needs to fetch an external entity such as
the document type definition, it gets a SYSTEM identifier, and often (as
in this case) a PUBLIC identifier too.
There is a piece of code that maps the (PUBLIC, SYSTEM) pair into a data
stream. This code is usually called the entity resolver.
The default entity resolver will look up the SYSTEM and PUBLIC
identifiers in an external file, an XML Catalog, to see if they map
to a pre-configured local copy.
If not, the default entity resolver will treat the SYSTEM identifier as
a URI (relative to the actual document in which it occurred, just like a
link in an HTML document) and try to fetch it.
So you have several choices to avoid network access:
(1) add entries to the system XML Catalog
(2) add your own XML Catalog file
(3) override the default entity resolver
(4) edit the document.
> The 3rd option you have suggested by turning off validation with
> SAXBuilder.setValidating(false) does not prevent the process of
> resolving DTD document.
OK. Others have said that too, although I've seen it work -- you do
probably want the DTD loaded, though, with XHTML, so that entities work.
There are plenty of examples of options 1 to 3 floating around, using
Java.
Liam
--
Liam Quin - XML Activity Lead, W3C, http://www.w3.org/People/Quin/
Pictures from old books: http://fromoldbooks.org/
Ankh: irc.sorcery.net irc.gnome.org www.advogato.org
[Date Prev]
| [Thread Prev]
| [Thread Next]
| [Date Next]
--
[Date Index]
| [Thread Index]