OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help



   Re: [xml-dev] A plea for Sanity

[ Lists Home | Date Index | Thread Index ]

Eric van der Vlist wrote:

> What about declaring those documents?
> <?sanity type="normal|sane|neurotic|psychotic"?>
> with a default value of psychotic (unfortunately, but you can't assume
> documents to be normal nor even sane) would allow consumers to adapt
> their behavior or even to reject documents they don't like...

I'm not sure how much a declaration would help.
If a consumer is prepared to adapt its behaviour --
using a simple algorithm if the document is sane and
a complex one otherwise -- it might as well just implement
the complex algorithm and use it for all cases.
If it's going to reject documents with a namespace pathology,
it might as well raise an exception when the pathology
is detected; a PI in the document prolog would only enable
a "fast failure" mode but not much else.

(Besides that, I don't think it's usually a good idea to include
declarations for properties that can be determined from
the document instance.  What do you do when the declaration
is incorrect?  What if it's missing?)

I like Evan's suggestion (from later in the thread) better.
The important criterion is whether or not the namespace
environment is significant (which is mostly determined
by whether or not there are QNames in content).  The sanity
or otherwise of the source document only affects how difficult
it is for an application to achieve this.

Even so, I don't think an '<?xmlns preserve="yes|no"?>' declaration
would be helpful either.  Whether or not the namespace environment
must be preserved is not a property of the document instance; it's
determined by the source markup vocabulary and the nature of the
transformation.  For example, consider an XSLT pretty-printer
that renders an XSLT stylesheet as XHTML.  The namespace environment
is significant when interpreting XSLT *as XSLT*,  but the
output of the pretty-printer will only contain elements in
the XHTML namespace.

I think the important question is whether or not an *application*
preserves the namespace environment, and under what circumstances.
"Always", "never", and "for {sane|non-neurotic|non-psychotic} documents
only" are possible answers.  It's the user's responsibility not
to feed a document to an application that can't process it correctly.
For instance if an XML database only guarantees namespace preservation
for sane documents, you mustn't use it to store neurotic XSLT stylesheets.

--Joe English



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

Copyright 2001 XML.org. This site is hosted by OASIS