W3C home > Mailing lists > Public > www-dom@w3.org > July to September 2001

Re: Using schema in files

From: Joseph Kesselman <keshlam@us.ibm.com>
Date: Wed, 15 Aug 2001 10:23:02 -0400
To: "XML DOM mailing list" <www-dom@w3.org>
Message-ID: <OF33504D05.C3C343F3-ON85256AA9.004C3114@pok.ibm.com>

This isn't a DOM question; it's a parser implementation question. But since
it's a common point of confusion:



Beware of confusing namespaces and schemas. A namespace URI is only a name,
and in basic namespace processing is _never_ actually dereferenced.  So
unless your system implements one of the experimental
namespace-points-to-schema solutions, specifying the namespace causes _not_
network activity

> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>Am I, in theory allowed to use a file?

Not if you want it to mean the same thing. Namespaces are generally treated
as "well-known names", and changing the namespace means selecting a
different set of semantics -- which may or not mean the same thing to your
applicaiton that the original namespace did. So switching the namespace
_would_ probably keep your file from being recognized as a schema.

There have been proposals that the namespace URI should point at the schema
which defines the language described by this namespace -- but there have
also been proposals that it point at other data, and last I checked there
was no consensus on that. Both the Namespace spec and the Schema spec
deliberately avoided making a firm decision. The "Semantic Web" effort is
supposedly trying to nail this down; I don't know their current status.


If your specific application or parser does insist on dereferencing the
namespace URI and you want to make sure it does so locally, there may be
workarounds.  SAX allows installing an EntityResolver, which can be used to
implement redirection and/or local caching (which is basically what you
want to do). Most DOM parsers I've seen have either adopted that or created
something similar, and I think the DOM's Load/Save APIs support this idea.
(If they don't, they probably should). Check the documentation for the
software you're using to see if you can use that approach.

But you're probably worrying unnecessarily.

______________________________________
Joe Kesselman  / IBM Research
Received on Wednesday, 15 August 2001 10:25:35 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 22 June 2012 06:13:49 GMT