Re: Using schema in files

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 UTC