W3C home > Mailing lists > Public > www-xml-schema-comments@w3.org > July to September 1999

Entities, Namespaces, and Schemas

From: Ian Hickson <py8ieh@bath.ac.uk>
Date: Wed, 29 Sep 1999 00:54:58 +0100 (BST)
To: www-xml-schema-comments@w3.org
Message-ID: <Pine.GSO.4.04.9909290036150.17284-100000@mary.bath.ac.uk>

SUMMARY:

   Entities should also be namespaced. For example:

    <characters xmlns="http://.../special"
                xmlns:html="http://www.w3.org/..."
                xmlns:math="http://www.w3.org/Math...">
       &pi; &html:pi; &math:pi;
    </characters


The current draft document says [1]:
#  The provision within XML Schema: Structures of a mechanism for
#  defining parsed entities presents problems for the relationship
#  between schema-validity and XML 1.0 well-formedness, since
#  references to entities declared only in a schema are undefined from
#  the XML 1.0 perspective. Strictly speaking, a well-formed XML
#  document may contain references to undefined entities only if it is
#  declared as standalone='no' and contains either an external subset
#  or one or more references to external parameter entities in their
#  internal subset. We get around this by [Definition:] defining a
#  nearly well-formed XML document to be one which either is
#  well-formed per XML 1.0, or which fails to be well-formed only
#  because of undefined general entity references, but which would be
#  well-formed if it were standalone='no' and identified an external
#  subset. We consider this justified on the grounds that the use of a
#  namespace declaration which refers to a schema functions rather as
#  an external subset, and from the XML 1.0 perspective such a
#  reference almost of necessity renders the document non-standalone
#  when schema-validation is applied.

The issue of entities becomes quite important especially when
involving many namespaces. For example, take the following XHTML
document:

   <html xmlns="http://www.w3.org/TR/xhtml1/strict">

     <head>
       <title>Mozilla Tests: XML namespace</title>
     </head>

     <body>

       <h1>Relationships between &theta; and &pi;</h1>

       <math xmlns="http://www.w3.org/Math/MathML">
          <mrow>
            <mi>&theta;</mi>
            <mo>=</mo> 
            <mn>&pi;</mn>
          </mrow>
       </math>

       <relationships xmlns="http://ns.ieh.ch/relationships/dtd">
          <equals type="numeric">
             <i>&theta;</i>
             <i>&pi;</i>
          </equals>
       </relationships>

     </body>

   </html>

It has a section that is namespaced as MathML, and another that is
namespaced as a fictional "relationships" fragment, and each of the
three namespaces (XHTML, MathML, relationships) have different
expansions for their respective &theta; and &pi; entities.

Currently, the above document is not even well-formed, because the
entities have not been declared (after all, there is no DOCTYPE).

Per the draft schema spec it would be "nearly-well-formed". (!)

But even if they _were_ declared, there would still be no way to make
"&theta;" mean something different depending on the active namespace!

And the following is even less possible:

       <math xmlns="http://www.w3.org/Math/MathML">
          <mrow>
            <mi>&theta;</mi>
            <mo>=</mo> 
            <mn>&pi;</mn>
          </mrow>
          <mtext xmlns:html="http://www.w3.org/TR/xhtml1/strict">
             <html:p>This is how &html:theta and &html:pi; are equal.</html:p>
          </mtext>
       </math>

Dan Connolly suggested I propose this in this forum, so here goes.

It would be very useful for entities to be "declared" by references to
a namespace in the form xmlns="...", much like elements are currently
"declared" by the xmlns attribute. (Pardon my dodgy terminology, I'm a
CSS guy, not an XML guy...)

It would further be useful to be able to explicitly qualify entities
using the same form as elements and attributes are qualified now:

   &html:pi;

Assuming that the namespace prefix is defined by a xmlns:html=""
attribute on a parent element, of course.


What is the likelihood of XML Schemas, XML 2, or XML Namespaces 2
covering such an extension?


---- References ----
[1] paragraph containing http://www.w3.org/TR/xmlschema-1/#key-nearly-wf

Cheers,
-- 
Ian Hickson
: Is your JavaScript ready for Nav5 and IE5?
: Get the latest JavaScript client sniffer at 
: http://developer.netscape.com/docs/examples/javascript/browser_type.html
Received on Tuesday, 28 September 1999 19:55:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Sunday, 6 December 2009 18:12:46 GMT