
<!DOCTYPE spec SYSTEM "spec.dtd" [

<!-- $Id: xml.sgm,v 1.47 1997/07/16 23:41:46 cmsmcq Exp cmsmcq $ -->

<!-- The words 'FINAL EDIT' in comments mark places where changes
need to be made after approval of the document by the ERB, before
publication.  -->

<!ENTITY XML.version "1.0">
<!ENTITY doc.date "19 January 1998">
<!ENTITY iso6.doc.date "19980119">
<!ENTITY w3c.doc.date "19-Jan-1998">

<!ENTITY xmlspec "http://www.w3.org/TR/PR-xml" >
<!ENTITY xmlpio "'&lt;?XML'">
<!ENTITY pic    "'?>'">
<!ENTITY br     "<BR>">
<!ENTITY mdash  "--"> <!-- was: <!ENTITY mdash  "&#38;#151;"> -->
<!ENTITY com    "--">
<!ENTITY como   "--">
<!ENTITY comc   "--">
<!ENTITY hcro   "&amp;#X">
<!-- <!ENTITY nbsp " "> -->
<!ENTITY nbsp   "&#160;">
<!ENTITY IDEOSPACE "3000" >
<!ENTITY magicents "<code>amp</code>,
<code>lt</code>,
<code>gt</code>,
<code>apos</code>,
<code>quot</code>">
 
<!-- audience and distribution status:  for use at publication time -->
<!--  -->
<!ENTITY doc.audience "public review and discussion">
<!ENTITY doc.distribution "may be distributed freely, as long as
all text and legal notices remain intact">

]>

<!-- for Panorama *-->
<!-- ?VERBATIM "scrap"> -->
<?VERBATIM "eg" ?>

<spec>
<header>
<title>Name Spaces in XML</title>
<version>Version 1.0</version>
<w3c-designation>Note-xml-names-&iso6.doc.date;</w3c-designation>
<w3c-doctype>World Wide Web Consortium Note</w3c-doctype>
<pubdate><day>19</day><month>January</month><year>1998</year></pubdate>
<notice><p>This draft is for public discussion.</p></notice>
<publoc>
<loc  href="http://www.w3.org/TR/NOTE-xml-names-&iso6.doc.date;">
http://www.textuality.com/xml/xml-names-&iso6.doc.date;</loc></publoc>
<authlist>
<author><name>Tim Bray</name>
<affiliation>Textuality and Netscape</affiliation>
<email 
href="mailto:tbray@textuality.com">tbray@textuality.com</email></author>
<author><name>Dave Hollander</name>
<affiliation>Hewlett-Packard Company</affiliation>
<email href="mailto:dmh@corp.hp.com">dmh@corp.hp.com</email></author>
<author><name>Andrew Layman</name>
<affiliation>Microsoft</affiliation>
<email href="mailto:andrewl@microsoft.com">andrewl@microsoft.com</email></author>
</authlist>
<status>
<p>This document is a NOTE made available by the W3 Consortium
for discussion only. This indicates no endorsement of its content,
nor that the Consortium has, is, or will be allocating any
resources to the issues addressed by the NOTE.</p>
<p>This work is part of the <loc 
href="http://www.w3.org/MarkUp/XML/Activity">W3C XML
Activity</loc>.</p>
<p>The XML WG solicits comments from W3C member companies and W3C 
working groups that use the namespace mechanism described
in this Note.  In particular, comments on open issues are 
very welcome, and should be sent to the editors.</p>
</status> 
<abstract>
<p>XML Namespaces is a proposal for a simple method to be used for qualifying
names used in Extensible Markup Language (XML) documents by associating them
with schemas, identified by URI.</p>
</abstract>
<sourcedesc>
<p>Created in electronic form.</p>
</sourcedesc>
<langusage>
<language id='EN'>English</language>
<language id='ebnf'>Extended Backus-Naur Form (formal grammar)</language>
</langusage>
<revisiondesc>
<slist>
<sitem>1997-10-10 : TB : Assembled Andrew's material and mine</sitem>
</slist>
</revisiondesc>
</header>
<body> 
<div1 id='sec-intro'>
<head>Motivation and Summary</head>

<p>We envision applications of XML in which a document 
instance may contain markup defined in multiple schemas.
These schemas may have been authored independently.
<!--
whose types are not all defined in a
single schema but instead are defined in several schemas. -->
One
motivation for this is that writing good schemas is hard, so it
is beneficial to reuse parts from existing, well-designed schemas.
Another is the advantage of allowing search engines or other
tools to operate over a range of documents that vary in many
respects but use common names for common element types. </p>


<p>These considerations require that document <!-- elements and attributes -->
constructs
should have universal names, <!-- independent of-->
whose scope extends beyond their
containing document. This specification proposes a mechanism,
<emph>XML Namespaces</emph>, to accomplish this.</p>

<p>XML Namespaces are based on the use of
<termref def='dt-qname'>qualified names</termref>,
similar to those long used <!-- successfully --> in programming languages.
Names are permitted to contain a colon, separating the name into
two parts, the 
<termref def='dt-namespace-name'>namespace name</termref> and the 
<termref def='dt-localname'>local name</termref>.
The namespace name identifies a schema's URI. 
The combination of
the universally-managed URI namespace and the local schema namespace
produces names that are guaranteed universally unique.
<!--
The
<emph>particular-name</emph>
is that of an element or attribute from within that schema. Since
URIs are a universally managed namespace and names within a
schema are locally unique, the combination of the two parts is
guaranteed to be universally unique.-->
</p>

<p>XML syntax does not allow direct use of a URI as a
namespace name,
because URIs can contain characters not allowed in names.
Consequently, the 
namespace name serves as a proxy for a URI.
A special processing instruction described below is used
to <termref def='dt-NSDecl'>declare</termref> the association of the namespace
name with a URI; 
software which supports this namespace proposal must
recognize and act on it.
</p>
</div1>
<div1 id='sec-syntax'>
<head>Namespace Syntax</head>
<div2 id='ns-decl'>
<head>Declaring Namespaces</head>
<p><termdef id='dt-NSDecl' term='Namespace Declaration'>A namespace is 
<term>declared</term> using a reserved
<xtermref href="&xmlspec;#dt-pi">processing
instruction</xtermref> as follows:
<scrap lang='ebnf'>
<head>Namespace Declaration PI</head>

<prod id='NT-NDPI'><lhs>NamespacePI</lhs>
<rhs>'&lt;?xml:namespace' 
<xnt href="&xmlspec;#NT-S">S</xnt>
'name=' 
<xnt href="&xmlspec;#NT-SystemLiteral">SystemLiteral</xnt>
<xnt href="&xmlspec;#NT-S">S</xnt>
'href=' <xnt href="&xmlspec;#NT-SystemLiteral">SystemLiteral</xnt>
<xnt href="&xmlspec;#NT-S">S</xnt>
'as=' 
<nt def='NT-NSName'>NSName</nt> 
<xnt href="&xmlspec;#NT-S">S</xnt>?
'?>'
</rhs>
</prod>
<prod id='NT-NSName'><lhs>NSName</lhs>
<rhs>' <xnt href="&xmlspec;#NT-Name">Name</xnt> '
| " <xnt href="&xmlspec;#NT-Name">Name</xnt> "</rhs>
</prod>
</scrap>
</termdef>
<termdef id='dt-schema' term='Schema'>
The "name" <xnt href="&xmlspec;#NT-SystemLiteral">SystemLiteral</xnt>
is a URI which uniquely identifies the namespace.  
<!--
is a URI identifying a namespace. It may also identify a document
(<term>schema</term>) coextensive with the namespace. 
-->
The "href"
<xnt href="&xmlspec;#NT-SystemLiteral">SystemLiteral</xnt> 
is an optional URI which may be used to retrieve the schema, if one
is provided.
Some namespaces need no
schemas; this specification does not depend on their existence, or on the use
of any particular machine- or human-readable syntax in the schema.
</termdef>
</p>

<p><termdef id='dt-namespace-name' term='Namespace Name'>The 
<nt def='NT-NSName'>NSName</nt> gives the <term>namespace name</term>
which will be used as a link to associate names in an XML document
with this schema.</termdef>
Examples of Namespace Declarations:

<eg><![CDATA[<?xml:namespace name='http://www.microsoft.com/' as='ms' ?>
<?xml:namespace name='urn:ISBN:0-395-36341-6/' as='bk' ?>
<?xml:namespace name='urn:uuid:C4ED1820-6207-11d1-A29F-00AA00C14882/'
                href='http://www.w3c.org' as='w3c' ?>]]></eg>




</p>
</div2>
<div2 id='ns-decl-loc'>
<head>Placing Declarations in Documents</head>
<p><termref def='dt-NSDecl'>Namespace declarations</termref>
must be located in the 
<loc href='&xmlspec;#sec-prolog-dtd'>prolog</loc>
of an XML document, after the 
<xtermref href='&xmlspec;#dt-xmldecl'>XML
Declaration</xtermref> (if any) and before the
<xtermref href='&xmlspec;#dt-dtd'>DTD</xtermref>
(if any).
This effectively makes the scope of <termref def='dt-namespace-name'>namespace
names</termref> global to the whole document, including the DTD.
It also means that should a processor wish to insert its own qualified
names, it need only read the namespace declarations from the prolog 
to be sure of generating a new, unique, namespace name.</p>
<p>To accomplish this, the production for
<xnt href='&xmlspec;#NT-prolog'>prolog</xnt>
is replaced as follows:
<scrap lang='ebnf'>
<head>Prolog with Namespace Declarations</head>
<prod id='NT-prolog'><lhs>prolog</lhs>
<rhs><xnt href='&xmlspec;#NT-XMLDecl'>XMLDecl</xnt>? 
<xnt href="&xmlspec;#NT-S">S</xnt>?
<nt def='NT-NDPI'>NamespacePI</nt>*
<xnt href='&xmlspec;#NT-Misc'>Misc</xnt>* 
(<xnt href='&xmlspec;#NT-doctypedecl'>doctypedecl</xnt> 
<xnt href='&xmlspec;#NT-Misc'>Misc</xnt>*)?</rhs>
<wfc def='wfc-cleanDecl'/>
</prod>
</scrap>
<wfcnote id='wfc-cleanDecl'>
<head>Unique Namespace Names</head>
<p>No <termref def='dt-namespace-name'>namespace name</termref> may be
declared more than once.</p>
</wfcnote>
</p>
</div2>
<div2 id='ns-qualnames'>
<head>Qualified Names</head>
<p><termdef id='dt-qname' term='Qualified Name'>Within the document, some
names 
(constructs corresponding to the nonterminal 
<xnt href="&xmlspec;#NT-Name">Name</xnt>)
are replaced by <term>qualified names</term>, defined as follows:
<scrap lang='ebnf'>
<head>Qualified Name</head>
<prod id='NT-QName'><lhs>QName</lhs>
<rhs>
(<nt def='NT-NSPart'>NSPart</nt> ':')? 
<nt def='NT-LocalPart'>LocalPart</nt></rhs></prod>
<prod id='NT-NSPart'><lhs>NSPart</lhs>
<rhs><xnt href="&xmlspec;#NT-Name">Name</xnt></rhs>
<wfc def='wfc-NSDeclared'/></prod>
<prod id='NT-LocalPart'><lhs>LocalPart</lhs>
<rhs><xnt href="&xmlspec;#NT-Name">Name</xnt></rhs>
</prod></scrap></termdef>
The 
<nt def='NT-NSPart'>NSPart</nt> provides the 
<termref def='dt-namespace-name'>namespace name</termref>
part of the qualified name, and may be associated with defining schema
through the URI in the applicable
<termref def='dt-NSDecl'>namespace declaration</termref>.</p>
<p>
<termdef id='dt-localname' term='Local Name'>
The <nt def='NT-LocalPart'>LocalPart</nt> provides the
<term>local name</term> part of the qualified name.</termdef>
</p>
<wfcnote id='wfc-NSDeclared'>
<head>Namespace Name Declared</head>
<p>The namespace name, unless it is "<code>xml</code>", must have been
declared in a <termref def='dt-NSDecl'>namespace declaration</termref>.
The namespace name <code>xml</code> is reserved, and considered to
have been implicitly declared.
</p>
</wfcnote>
</div2>
<div2 id='ns-using'>
<head>Using Qualified Names</head>
<p>To enable the proper use of <termref def='dt-qname'>qualified
names</termref>, it is necessary to banish colons from all 
<xnt href="&xmlspec;#NT-Name">Name</xnt>s which are not
qualified; two productions are replaced as follows:
<scrap lang='ebnf'>
<head>Name</head>
<prod id='NT-Name'><lhs>Name</lhs>
<rhs>(<xnt href='&xmlspec;#NT-Letter'>Letter</xnt> | '_' )
(<xnt href='&xmlspec;#NT-NameChar'>NameChar</xnt>)*</rhs></prod>
<prod id='NT-MiscName'><lhs>MiscName</lhs>
<rhs>'.' | '-' | '_'
| <xnt href='&xmlspec;#NT-CombiningChar'>CombiningChar</xnt>
| <xnt href='&xmlspec;#NT-Ignorable'>Ignorable</xnt>
| <xnt href='&xmlspec;#NT-Extender'>Extender</xnt></rhs>
</prod></scrap>
</p>
<p>Element types may be given as
<termref def='dt-qname'>qualified names</termref>.  
To do this, the productions for start-, end-, and empty-element
tags (<xnt href="&xmlspec;#NT-STag">STag</xnt>,
<xnt href="&xmlspec;#NT-ETag">ETag</xnt>, and
<xnt href="&xmlspec;#NT-EmptyElement">EmptyElement</xnt>)
are replaced as follows:
<scrap lang='ebnf'>
<head>Start-tag</head>
<prod id='NT-STag'><lhs>STag</lhs>
<rhs>'&lt;' <nt def='NT-QName'>QName</nt> 
(<xnt href='&xmlspec;#NT-S'>S</xnt> 
<xnt href='&xmlspec;#NT-Attribute'>Attribute</xnt>)* 
<xnt href='&xmlspec;#NT-S'>S</xnt>? '>'
</rhs>
</prod>
<prod id='NT-ETag'><lhs>ETag</lhs>
<rhs>'&lt;/' <nt def='NT-QName'>QName</nt> 
<xnt href='&xmlspec;#NT-S'>S</xnt>? '>'</rhs></prod>
<prod id='NT-EmptyElement'><lhs>EmptyElement</lhs>
<rhs>'&lt;' <nt def='NT-QName'>QName</nt> 
(<xnt href='&xmlspec;#NT-S'>S</xnt>
<xnt href='&xmlspec;#NT-Attribute'>Attribute</xnt>)* 
<xnt href='&xmlspec;#NT-S'>S</xnt>? '/>'</rhs>
</prod>
</scrap>
</p>
<p>
Attribute names are given as 
<termref def='dt-qname'>qualified names</termref>.  
To do this, the production for 
<xnt href="&xmlspec;#NT-Attribute">Attribute</xnt>
is replaced as follows:
<scrap lang='ebnf'>
<head>Attribute</head>
<prod id='NT-Attribute'><lhs>Attribute</lhs>
<rhs><nt def='NT-QName'>QName</nt> <xnt href='&xmlspec;#NT-Eq'>Eq</xnt> 
<xnt href='&xmlspec;#NT-AttValue'>AttValue</xnt></rhs>
</prod>
</scrap>
</p>
</div2>
</div1>

<div1 id='sec-example'>
<head>Examples</head>
<div2 id='motivation-eg'>
<head>Operational Scenarios</head>
<div3 id='math-eg'>
<head>Mathematical Expressions</head>
<p>
I have to write a schema for manuals.  As manuals have
mathematical expressions, my schema has to allow them.
</p><p>
Fortunately, W3C has a schema called MathML.  As I know
little about mathematical expressions, I would like to use
MathML as is.  I do not even want to read what is defined in
MathML.  If a better schema for mathematical expressions
appears later, I will switch to that schema.
</p><p>
Although I do not care about internal structures of mathematical
expressions, I do want to restrict where they may appear.
I do not allow them in footnotes.  I only allow
them as direct subordinates of sections and subsections.
</p><p>
Writers will use XML editors to edit manuals.  In the
near future, mathematical expression editors for MathML
will show up in the market.  My writers will use such
editors to edit mathematical expressions in manuals.
While editing manuals with XML editors, writers can
introduce mathematical expressions, provided that my
schema allows mathematical expressions there.  Then,
mathematical expression editors are automatically
invoked.  After creating mathematical expressions,
writers close math editor windows, and resume editing
in XML editors.
</p><p>
Observe that implementation of XML editors does not
require implementation of mathematical expressions, and
that mathematical expression editors are dedicated to
MathML.  Neither editor need know the entire document or
schema.
</p>
</div3>
<div3 id='metadata-eg'>
<head>Metadata</head>
<p>
I have to write a schema for on-line novels.  Because of
some regulation, each novel has to have metadata.  The
schema of such metadata is already defined by somebody (the
government, for example).  I have to use that metadata schema
as is.  No change is allowed.
</p><p>
As in the previous case, I do not care about the internal
structure of metadata.  But I allow metadata to appear as the eldest
child of the novel element only. 
</p><p>
Writers write novels with XML editors.  The editors use my
schema.  But writers do not provide metadata.  Writers 
see no metadata.
</p><p>
Somebody examines each novel and then creates metadata.  If
that novel is a pornography, he or she will specify this
information in the metadata.  But the novel is not modified
at all.  The only change is metadata.  Therefore, metadata
editing tools do not provide editing of novels, but only
provide metadata editing.
</p><p>
If the schema for metadata is revised by the
government, I simply reference to the new schema.
Writers do not rewrite novels.  If the revision is
backward-compatible, existing metadata (embedded within
novels) remains valid.  If not, metadata has to be
edited manually or converted automatically.
</p>
</div3>
<div3 id='table-eg'>
<head>Tables</head>
<p>
My schema for manuals should provide tables.  But I do
not want to study columns and rows.  I would like to
use somebody's schema for tables.  I simply refer
to that schema.
</p><p>
Although I do not care about columns and rows, I do care
permissible about subordinates of entries.  I would like to
allow data characters, phrase elements, and
mathematical expressions only.  Nothing else can appear
within entries.
</p><p>
Editing of tables is similar to that of mathematical
expresssions, but we need recursive editing.  A writer
edits a manual with an XML editor.  When he or she
introduces a table, a table editor is automatically
invoked.  The table editor is dedicated to tables, and
does not use my schema.  After creating rows, columns,
and entries, the XML editor is recursively invoked to
create subordinates of entries.
</p>
</div3>
</div2>
<div2 id='syntax-eg'>
<head>Syntax Example: The On-line Bookstore</head>
<p>Imagine an XML document representing an invoice for books. If
public schemas exist for elements and attributes describing
books, electronic transactions and digital signatures, the
invoice author should be able to use these, rather than inventing
new element and attribute types. Any reader of the invoice
document should be able to infer a consistent meaning to its
contents, the same meaning as if the elements and attributes had
appeared in a different kind of document (such as an invoice for
automotive parts, or an inventory of books or a digital signature
on a legal contract). Any search tool should locate the elements,
regardless of the document in which they reside. Further, since
several schemas may choose the same name (e.g. &quot;size&quot;)
for elements or attributes with different meanings, these must be
distinguished if used within the same document.</p>

<eg><![CDATA[<?xml:namespace name="http://books.org/schema/" as="B"?>
<?xml:namespace name="http://ecommerce.org/schema/" as="E"?>
<?xml:namespace name="http://digitalSignatures.org/schema/" as="dsig"?>
<?namespace name="urn:uuid:C2F41010-65B3-11d1-A29F-00AA00C14882/" as="dt"?>

<E:ORDER>
 <dsig:DSIG>
   <MANIFEST>80183589575795589189518915</MANIFEST>
   <SIG href="http://XYX/Joe@company.com"/>
 </dsig:DSIG>
 <E:SOLD-TO>
   <E:LASTNAME>Layman</E:LASTNAME>
   <E:FIRSTNAME>Andrew</E:FIRSTNAME>
 </E:SOLD-TO>
 <E:SOLD-ON dt:type="date.iso8601">1997-03-17</E:SOLD-ON>
 <E:ITEM E:PRICE="5.95">
   <B:BOOK TITLE="Number, the Language of Science" 
           AUTHOR="Dantzig, Tobias"/>
 </E:ITEM>
 <E:ITEM E:PRICE="12.95">
   <B:BOOK TITLE="Introduction to Objectivist Epistemology"
           AUTHOR="Rand, Ayn"/>
 </E:ITEM>
</E:ORDER>]]></eg>
</div2>
</div1>
<div1 id='sec-open'>
<head>Issues Open for Discussion</head>
<p>The namespace syntax presented in this working draft is intended 
to support the namespace needs expressed by other W3C activities, to 
enable interoperability and to provide for future enhancements to the 
XML specification. Unfortunately, the syntax presented is not sufficiently 
robust to describe the blind interchange of validated documents which 
contain elements and attributes whose types are defined in several 
schemas. Therefore, to provide insight into the intent of the namespace 
syntax, this draft includes a brief summary of the SIG discussion and 
rationale. This section will not attempt to present detailed technical 
discussion nor will it document the individual contributions of those 
who participated in the discussion. These details are available in the 
<loc href="http://lists.w3.org/Archives/Member/w3c-xml-sig/">W3C XML SIG 
Mail Archives</loc> 
(/http://lists.w3.org/Archives/Member/w3c-xml-sig/).</p>
<p>The namespace discussion has resulted in no changes to the XML 1.0 
syntax; colons continue to be valid name characters. Our intent is to 
enable the development of namespace aware applications without adding 
large passages to the XML specification and without adding significant 
burden to XML application developers. In developing this proposal we 
have avoided several features and functions we believe will be included 
in the full namespace specification in a future release of the XML 
specification.</p>

<p>Specifically, this working draft does not establish semantics for 
validating document instances against multiple schemas, the mechanics 
for minimizing namespace names, address whether qualified attributes 
should be constrained, or if there should be constraints placed on 
other name characters. It is anticipated this proposal will promote 
the development of industry experience in regards to multiple schema 
validation, inheritance, sub-classing, editing and cut-and-pastepaste
operation, and  
application behaviors that will be reflected in future versions of 
the XML specification.</p>

<p>This working draft does add constraints to the XML syntax by limiting 
the use of colons in names and establishing a convention for 
namespace declarations. It is the intent of these constraints to limit 
the namespace syntax sufficiently that future extensions can be defined 
to resolve remaining namespace issues. It is expected that legacy data 
conforming to this note will be compatible with these solutions. Note: 
there is no guarantee that any namespace mechanism will be adopted for 
XML, nor that the mechanism will in fact be compatible with the syntax 
described in this working draft.</p>
<div2 id='QAttrs'>
<head>Which Names Should be Subject to Qualification</head>

<p>The XML specification uses
<xnt href='&xmlspec;#NT-Name'>Name</xnt> in the following 
contexts:
<ulist>
<item><p>PI target</p></item>
<item><p>Root element type in doctype declaration</p></item>
<item><p>Element type in start-, empty-element, and end-tags, and
in element type declarations</p></item>
<item><p>Attribute names, in start-tags, and in attribute list
declarations</p></item>
<item><p>As the value of ID, IDREF(S), and ENTITY(IES) attributes
(note that the values in NMTOKEN(S) attributes are NMTOKENS, not names)</p></item>
<item><p>Entity names, in declarations and references (general and parameter
entities)</p></item> 
<item><p>Notation names, in NDATA entity declarations and Notation
declarations</p></item>
<item><p>(As LatinName) as the encoding name in an XML declaration</p></item>
</ulist>
There is an open question as to which of these should exist in their qualified
form.
The instance of <code>Name</code> that is the first and least
controversial candidate for qualification is the element type.</p>

<p>Existing SGML practice shows that attributes are often used
for much the same purposes as elements, with the choice
determined by evolutionary history and design aesthetics as often
as by differences in element and attribute capabilities.
Also, certain kinds of attributes are used on a wide range
of element types (for example, those employed in XML Links, those
that might indicate the datatype of an element, etc.).
Thus, attribute names are a strong candidate for qualification.</p> 
<p>Furthermore, on the basis of consistency and simplicity, it might be argued
that if one instance of Name is to be qualified, all should be.</p>

<p>On the other hand, attributes are already qualified by element types;
that is, permissible values, defaults, and semantics of attributes
depend on element types.  It has been argued that further
qualification of attributes by namespaces is unnecessary, and is even
harmful for validation (see 4.2).  Those attributes (e.g., xml:lang)
which apply to all element types should rather be captured by a
different mechanism (e.g.,#ALL in the WebSGML adaptation), as their
permissible values, defaults, and semantics do not depend on element
types.</p>

</div2>

<div2 id='validation'>
<head>Validation</head>

<p>Perhaps the most complicated issue surrounding namespaces is validation. 
In the discussion, many viewed validation as any process that verified 
document instance against a schema while others often referred to 
validation as &quot;plain old DTD-wise validation with an XML processor, 
not any other kind of validation with an application&quot;. This white 
paper tries to support both <emph>schema validation </emph>and <emph>XML 
validation</emph> where XML validation is a special case of schema 
validation in which an XML processor uses a schema expressed in SGML 
DTD syntax. Furthermore, it tries to support XML validation with the
minimum of change to existing XML processors, and to provide for qualified 
names for both element types and attribute names. </p>

<p>For generic schema validation it is anticipated that applications 
will validate against a set of semantics that are either predefined 
in an application standard or expressed in machine readable syntax. 
The system literal in the namespace declaration should be used to 
identify the specific schema and any associated data resources. </p>

<p>The two most commonly discussed approaches to XML validation were 
fragment merging and validation of a grove of independent fragments. 
These methods differ in how the the validation process is implemented,
and should yield the same result.
This specification most directly supports validation by fragment 
merging. Fragment merging validates the document instance against a 
DTD created by merging elements from the constituent DTD fragments. 
The merged-DTD may be created either by man or machine, on the fly 
or prior to validation. This approach has the advantage that once 
the merged-DTD is created, the validation process is unchanged from 
current SGML/XML practice.</p>

<p>XML validation using a <emph>grove</emph> of independent fragments 
involves decomposing a document into fragments, each of which can be 
validated with a component schema. Each fragment is a subtree such 
that every element in it comes from a single schema. The entire document 
is valid with respect to the entire schema exactly when each fragment 
is valid with respect to the component schema. &nbsp;This approach has 
the advantage that the validation process uses unmodified DTDs. However, 
it was troubling to realize that supporting qualified attribute names 
precludes using a grove of independent fragments, due to the fact that 
attributes in each fragment could be from a different namespace and 
therefore must be validated against a different schema.</p>

<p>In considering the validation issues, it became apparent to many 
that we have not arrived at an consensus about what it means, in the 
general case, to apply an attribute from one schema to an element 
from another schema. Coupled with a growing concern about detailed 
meaning of multiple schema validation and a desire to develop an XML 
based syntax to express a superset of the SGML DTD semantics, it was 
decided to support the most straight forward XML validation technique 
that supported the requirements and which will also foster an environment 
where application developers can evolve working models of multiple 
namespace validation with various schema syntaxes.</p>
</div2>

<div2 id='QualVsURI'>
<head>Qualified Names vs. Reserved Attribute</head>
<p>Two mechanisms were discussed to associate between&nbsp;elements 
and namespace schemas; qualified names and a reserved attribute. While many 
in the discussion admired the simplicity of the reserved-attribute approach 
which required no namespace declaration and no new syntax, the 
qualified namespace prefix syntax was chosen because it supports two 
requirements not possible with URI attributes. In addition, namespace 
qualifiers may be more compact, more meaningful to a reader, easier 
to understand, describe and use than a reserved attribute.</p>

<p>Qualified names support the requirement to identify the schema for 
an attribute and to be able to apply an attribute from one document 
fragment to an element from another document fragment. The use of URI 
attributes would not allow an attribute from one namespace to be applied 
to an element from a different namespace fragment. Additionally, many 
believe qualifiers are needed for other names; id, idrefs, and 
enumerated attribute values and perhaps should be permitted on all 
names. This qualified name syntax will not need to change if we decide 
to support additional name types in the future.</p>

<p>This working draft does not specify how the URI system literal in
the Namespace Declaration PI is to be used, aside from saying that
it identifies the namespace schema.
We anticipate that
validating 
XML processors will use the QName for validation. Other
applications are free to choose whether and how the URI,LocalPart pair are
interpreted. Note: a future version of the namespace specification
that addresses schema validation semantics may require the interpretation
of the URI, LocalPart pair to be formalized.</p>

<p>A validating XML processor must be able to disambiguate between
QNames that have the same LocalParts. One intent is to support the ability 
to merge two document fragments that have contain same generic identifier 
while still performing XML validation against the original content models. 
This ability to differentiate may also ease the deployment of stylesheets
and the development other processing applications. Finally, because
applications need only to control the NSPart prefix, qualified names
simplify avoiding namespace collisions.</p>

</div2>
<div2 id='NsDeclIssues'>
<head>Namespace Declaration</head>
<p>The syntax presented in this working draft uses a reserved processing 
instruction (PI) to associate a namespace qualifier with a network 
resource. In the discussions many alternatives were offered, including 
using a new declaration type, system notations or XLL links. While many 
considered PIs as the least desirable long term option, it was chosen for 
this draft because it is the most compatible with existing processing 
systems and should prove easy to migrate to another syntax in the future.</p>

<p>The ability to associate support multiple schemas with a name space 
qualifier was discussed. The multiple associations could provide both 
machine and human readable schemas or even multiple machine schemas. 
The namespace syntax in this working draft requires that there be 
exactly one namespace declaration PI for each namespace name. 
Future namespace 
specifications may establish conventions which support multiple 
associations as well as a mechanism to qualify a particular attribute 
of a specific element in a namespace. </p>
</div2>
<div2 id='QNameIssues'>
<head>Qualified names</head>
<p>The namespace syntax presented in this working draft severely 
constrains qualified names. The following constraints were chosen 
based on an understanding of the immediate requirements of other W3C 
actives and to reserve syntactical constructs to support extensions 
of the namespace mechanisms. </p>

<p><emph>There is at most one colon per name.</emph> This working 
draft does not support the use of multiple colons to designate 
hierarchical namespaces, multiple inheritance or other semantics. It 
is anticipated that multi-part names will be discussed as mechanics 
to support implementing these features in a future version of the XML 
specification.</p>

<p><emph>QNames use a single colon as a separator.</emph> The use 
of a double colon was discussed as a way to improve compatibility with 
the CSS specification even though most people preferred the single colon 
from a subjective and aesthetic perspective. 
After further investigation
it was not shown that double colons would actually simplify the
development of CSS compatible XML namespace aware applications.
The single colon QName syntax used in this working draft is intended to 
support the use of CSS stylesheets in namespace aware XML applications.</p>

<p><emph>The NSPart must not be empty. </emph>An empty 
NSPart could signal a processing semantic such as minimization. In this 
working draft, name parts must not be null for a document to be well 
formed. Future versions of the XML specification may establish the use 
empty QNames as a signal for namespace minimization. </p>
</div2>
</div1>
</body>
<back>
 
<div1 id='sec-xml-and-sgml'>
<head>Acknowledgements</head>
 
<p>This work reflects input from a very large number of people, 
including especially the members of the World Wide
Web Consortium XML Working Group and Special Interest Group.</p>
<p>In particular, Murata Makoto contributed the operational 
scenarios in the examples section.</p>
</div1>
</back>
</spec>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-default-dtd-file:"~/sgml/spec.ced"
sgml-omittag:t
sgml-shorttag:t
End:
-->
