[
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 09:24:49 -0700
- Cc: <xmlschema-dev@w3.org>
- Thread-index: AcHmJDEHNiyWRpxyTv6K5oQpIgBkbAABHVzB
- Thread-topic: [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
|