XML.orgXML.org
FOCUS AREAS |XML-DEV |XML.org DAILY NEWSLINK |REGISTRY |RESOURCES |ABOUT
OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

[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)

Another option if you don't care about DTD features like entities is to 
write a URI resolver that simply returns an empty document (Source?) for 
everything, or maybe everything ending '.dtd'.  Based on my research in 
various mailing lists, this seems to be the way to use standard XML 
tools while completely disabling DTD processing.  It'll only be useful 
in special circumstances, though.

-Mike

On 06/29/2010 09:36 AM, Liam R E Quin wrote:
> 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
>
>    


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]


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

Copyright 1993-2007 XML.org. This site is hosted by OASIS