You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Hans Ulrich Niedermann <ni...@isd.uni-stuttgart.de> on 2000/07/25 16:43:46 UTC

DTD PUBLIC ID resolution

Hi,

I'd like to have a mechanism that maps some known PUBLIC IDs from the
<!DOCUMENT> declaration to the corresponding local URIs (similar to
SGML catalog files). This would allow one to write XML files with the
"canonical" URI for the used DTDs and still use a local copy for
validation and default value gathering, which increases both
reliability and speed. 

Do you think such a mechanism makes sense?
Has anybody seen such a thing implemented yet?
Where could/should such a thing be hooked into the C2 processing chain?
Where and how should the configuration, i.e. the mapping from PUBLIC
to SYSTEM be stored?

I don't mean to distract you from important things but perhaps we
should think about it before every API and config file spec is set
into stone.

I'd be willing to contribute some code if/when I can figure out how
the C2 internals really are supposed to work.

Uli

Re: [Cocoon Devel]DTD PUBLIC ID resolution

Posted by Hans Ulrich Niedermann <ni...@isd.uni-stuttgart.de>.
Brian May <ba...@snoopy.apana.org.au> writes:

> >>>>> "Hans" == Hans Ulrich Niedermann <ni...@isd.uni-stuttgart.de> writes:
> 
>     Hans> Hi, I'd like to have a mechanism that maps some known PUBLIC
>     Hans> IDs from the <!DOCUMENT> declaration to the corresponding

s/UMENT/TYPE/ of course. Sorry.

>     Hans> local URIs (similar to SGML catalog files). This would allow
> 
> I am not familiar with SGML catalog files, so may have misunderstood
> something...

SGML catalogs roughly look like

PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN" "where/ever/strict.dtd"

so an SGML tool looking for the HTML 4.0 Strict DTD will look in
where/ever/strict.dtd instead of the URI in the <!DOCTYPE>. There are
also other resolution capabilities for entities and cascading
catalogs, but we probably don't need this with XML. (I'm no SGML
expert. I just think a local PUBLIC ID -> SYSTEM ID resolution
capability is great.)

>     Hans> one to write XML files with the "canonical" URI for the used
>     Hans> DTDs and still use a local copy for validation and default
>     Hans> value gathering, which increases both reliability and speed.
> 
> Is it <!DOCUMENT> or <!DOCTYPE>???

<!DOCTYPE>, of course. Sorry, it was 3:00 in the morning... :-)

> Personally, I have modified the DOCTYPE specs to point to the local
> copy of the DTD, using a relative path.

This is the only way to prevent the canonical server from breaking
down - as most people do not use a HTTP proxy for java.net.* stuff.

> Probably not a good idea for distributing copies of the XML document
> elsewhere....
> 
> Are there any other advantages?

Perhaps that changing the location of a DTD is easier: you don't have
to change every single file. But I think the easier distribution of
such files when using the "canonical" URI for the DTD is the main
advantage.

Uli

Re: [Cocoon Devel]DTD PUBLIC ID resolution

Posted by Brian May <ba...@snoopy.apana.org.au>.
>>>>> "Hans" == Hans Ulrich Niedermann <ni...@isd.uni-stuttgart.de> writes:

    Hans> Hi, I'd like to have a mechanism that maps some known PUBLIC
    Hans> IDs from the <!DOCUMENT> declaration to the corresponding
    Hans> local URIs (similar to SGML catalog files). This would allow

I am not familiar with SGML catalog files, so may have misunderstood
something...

    Hans> one to write XML files with the "canonical" URI for the used
    Hans> DTDs and still use a local copy for validation and default
    Hans> value gathering, which increases both reliability and speed.

Is it <!DOCUMENT> or <!DOCTYPE>???

    Hans> Do you think such a mechanism makes sense?  Has anybody seen
    Hans> such a thing implemented yet?  Where could/should such a
    Hans> thing be hooked into the C2 processing chain?  Where and how
    Hans> should the configuration, i.e. the mapping from PUBLIC to
    Hans> SYSTEM be stored?

Personally, I have modified the DOCTYPE specs to point to the local
copy of the DTD, using a relative path.

Probably not a good idea for distributing copies of the XML document
elsewhere....

Are there any other advantages?
-- 
Brian May <ba...@snoopy.apana.org.au>

Re: DTD PUBLIC ID resolution

Posted by Giacomo Pati <Gi...@pwr.ch>.
Stefano Mazzocchi wrote:
> 
> Hans Ulrich Niedermann wrote:
> >
> > I'd be willing to contribute some code if/when I can figure out how
> > the C2 internals really are supposed to work.
> 
> Same here :)
> 
> Anyway, I'll dive into C2 very soon, expect tons of
> "what-the-hell-is-this?" :)

I would totally appreciate that :-)
Feel free to ask!

Giacomo

-- 
PWR GmbH, Organisation & Entwicklung      Tel:   +41 (0)1 856 2202
Giacomo Pati, CTO/CEO                     Fax:   +41 (0)1 856 2201
Hintereichenstrasse 7                     Mailto:Giacomo.Pati@pwr.ch
CH-8166 Niederweningen                    Web:   http://www.pwr.ch

Re: DTD PUBLIC ID resolution

Posted by Stefano Mazzocchi <st...@apache.org>.
Hans Ulrich Niedermann wrote:
> 
> Hi,
> 
> I'd like to have a mechanism that maps some known PUBLIC IDs from the
> <!DOCUMENT> declaration to the corresponding local URIs (similar to
> SGML catalog files). This would allow one to write XML files with the
> "canonical" URI for the used DTDs and still use a local copy for
> validation and default value gathering, which increases both
> reliability and speed.
> 
> Do you think such a mechanism makes sense?

Sure it does, it's called "catalog" and it goes back to the old SGML
days.

> Has anybody seen such a thing implemented yet?

I'm pretty sure all good parsers implement one (I know Xerces does)

> Where could/should such a thing be hooked into the C2 processing chain?

If we use Xerces, we can use their API and provide the catalog
ourselves.... or use directly SAX EntityResolver...hmmmm, probably
better using SAX anyway...

> Where and how should the configuration, i.e. the mapping from PUBLIC
> to SYSTEM be stored?

Good question. I haven't thought about it (yet). Should the sitemap
contain the semantics to describe schema catalogs as well?

> I don't mean to distract you from important things but perhaps we
> should think about it before every API and config file spec is set
> into stone.

Totally. Thanks for bringing this up.
 
> I'd be willing to contribute some code if/when I can figure out how
> the C2 internals really are supposed to work.

Same here :)

Anyway, I'll dive into C2 very soon, expect tons of
"what-the-hell-is-this?" :)

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<st...@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------