[
Lists Home |
Date Index |
Thread Index
]
- To: "Paul Hermans" <paul_hermans@protext.be>,<xml-dev@lists.xml.org>
- Subject: RE: [xml-dev] which xml schema tools do it right concerning including attributes xml:lang and xml:space
- From: "Dare Obasanjo" <dareo@microsoft.com>
- Date: Wed, 17 Apr 2002 11:58:42 -0700
- Cc: <xmlschema-dev@w3.org>
- Thread-index: AcHmJDEHNiyWRpxyTv6K5oQpIgBkbAABHVzBAAUUolA=
- Thread-topic: [xml-dev] which xml schema tools do it right concerning including attributes xml:lang and xml:space
*sigh*
After confering with some of our schema folks something was brought up which adds a caveat to my comments.
A problem arises because the normative schema for Schema (sForS) imports the schema for the XML namespace already. This means that a conformant XSD implementation acts as if the XSD for the "http://www.w3.org/2001/XMLSchema" and "http://www.w3.org/XML/1998/namespace" were imported into any schema it validates. However, Paul is attempting to re-import that namespace using a different schemaLocation and XSD. According to the W3C XML Schema recommendation[0]
"NOTE: The above is carefully worded so that multiple <import>ing of the same schema document will not constitute a violation of clause 2 of Schema Properties Correct (§3.15.6), but applications are allowed, indeed encouraged, to avoid <import>ing the same schema document more than once to forestall the necessity of establishing identity component by component. Given that the schemaLocation [attribute] is only a hint, it is open to applications to ignore all but the first <import> for a given namespace, regardless of the ·actual value· of schemaLocation, but such a strategy risks missing useful information when new schemaLocations are offered."
So this means it is possible for a conformant implementation to ignore a schema author's attempt to re-import the XML namespace and redefine its components. Currently the Microsoft .NET implementation does this but does not issue any warning when it does.
[0] http://www.w3.org/TR/xmlschema-1/#composition-schemaImport
--
PITHY WORDS OF WISDOM
Lynch's Law: When the going gets tough, everyone leaves.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2002 Microsoft Corporation. All rights reserved.
> -----Original Message-----
> From: Dare Obasanjo [mailto:dareo@microsoft.com]
> Sent: Wednesday, April 17, 2002 9:25 AM
> To: Paul Hermans; xml-dev@lists.xml.org
> Cc: xmlschema-dev@w3.org
> Subject: RE: [xml-dev] which xml schema tools do it right
> concerning including attributes xml:lang and xml:space
>
>
> Interesting, I was going to suggest looking at the schema For
> Schema(sForS)[0] as a guide as to the best way of doing this
> since it doesn't look like the W3C XML Schema recommendation
> (prose version) clearly spells this out. On looking at the
> sForS it looks like
> it assumes that the XML namespace
> (http://www.w3.org/XML/1998/namespace) is bound to the prefix
> "xml" without ever declaring this prefix-namespaceURI
> matching. This is in line with the XML namespaces recommendation[1].
>
> So as for your first question
>
> 1. "Now wanting to use these attributes in other schemas some
> tools require that the
> namespace ="http://www.w3.org/XML/1998/namespace" is
> explicitly declared and using the xml prefix
> is OK."
>
> This is incorrect because by definition any tool that
> supports XML namespaces assumes that namespace is defined for
> a well-formed XML document. You shouldn't have to explicitly
> map the "xml" prefix to the
> "http://www.w3.org/XML/1998/namespace
> <http://www.w3.org/XML/1998/namespace> " namespace.
>
> 2. "Other tools refuse the prefix xml since it is reserved
> for W3C needs and then the following works"
>
> This is a two part answer. (a.) The XML namespaces
> recommendation doesn't specify what should happen if one
> tries to redefine the prefix-namespace mapping for the "xml"
> prefix so it is understandable for a processor to disallow
> although a clever one might just allow it if the mapping is
> too the XML namespace (and thus a NOOP). (b.) If the
> processor requires the XML namespace to be declared then the
> behavior is incorrect, see the answer to (1.) above.
>
> 3. "Still other tools don't want the namespace declaration at all"
>
> This is the behavior most consistent with that of the
> normative sForS and the XML namespace recommendation.
>
> However, I suggest waiting for Jeni or Henry T to pipe in
> before taking my word for any of this. :)
>
> PS: xmlschema-dev is a better list for schema questions.
>
> [0] http://www.w3.org/TR/xmlschema-1/#normative-schemaSchema
> [1] http://www.w3.org/TR/1999/REC-xml-names-19990114/#nsc-NSDeclared
>
> -----Original Message-----
> From: Paul Hermans [mailto:paul_hermans@protext.be]
> Sent: Wed 4/17/2002 8:14 AM
> To: 'xml-dev@lists.xml.org'
> Cc:
> Subject: [xml-dev] which xml schema tools do it right
> concerning including attributes xml:lang and xml:space
>
>
>
> Having in a separate schema file
> <?xml version="1.0"?>
> <schema targetNamespace="http://www.w3.org/XML/1998/namespace"
> xmlns:xml="http://www.w3.org/XML/1998/namespace"
> xmlns="http://www.w3.org/2001/XMLSchema" >
>
> <attribute name="lang" type="language"/>
>
> <attribute name="space" default="preserve">
> <simpleType>
> <restriction base="NCName">
> <enumeration value="default"/>
> <enumeration value="preserve"/>
> </restriction>
> </simpleType>
> </attribute>
>
> <attributeGroup name="specialAttrs">
> <attribute ref="xml:lang"/>
> <attribute ref="xml:space"/>
> </attributeGroup>
> </schema>
>
> Now wanting to use these attributes in other schemas
> some tools require that the
> namespace ="http://www.w3.org/XML/1998/namespace" is
> explicitly declared and using the xml prefix
> is OK.
>
> <schema targetNamespace="XXXX"
> xmlns:xxx="XXXX"
> xmlns="http://www.w3.org/2001/XMLSchema"
> --> xmlns:xml="http://www.w3.org/XML/1998/namespace"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>
> <import
> namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_tva.xsd"/>
>
>
> Other tools refuse the prefix xml since it is reserved
> for W3C needs and then the following works
>
> <schema targetNamespace="XXXX"
> xmlns:xxx="XXXX"
> xmlns="http://www.w3.org/2001/XMLSchema"
> --> xmlns:x="http://www.w3.org/XML/1998/namespace"
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>
> <import
> namespace="http://www.w3.org/XML/1998/namespace"
> schemaLocation="xml_tva.xsd"/>
>
> Still other tools don't want the namespace declaration at all
>
> <schema targetNamespace="XXXX"
> xmlns:xxx="XXXX"
> xmlns="http://www.w3.org/2001/XMLSchema"
> -->
> elementFormDefault="qualified"
> attributeFormDefault="unqualified">
>
> Which one is the correct way ?
>
>
> Paul
>
>
>
>
|