Re: Entities and Namespaces

Ian Hickson wrote:
> 
> Hi.
> 
> Can entities be namespaced?

In a word: no. Details...

> 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).

Exactly.

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

Bingo again.

> 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>
> 
> Will this ever be possible? (Is it possible now?)

The current W3C Recommendations don't specify any way to do this.

I make no claims about the future.

> Will Schema cover this?

Good question. It's discussed in the recent draft:

"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."
http://www.w3.org/TR/xmlschema-1/#conformance-schemaValidity

> If you are not the appropriate people to answer this, could you point
> me to an appropriate mailing list? Thanks.

If you have a comment/question on the schema spec, please
send it to the address on the title page:
www-xml-schema-comments@w3.org
(public archive at
http://lists.w3.org/Archives/Public/www-xml-schema-comments/)

> 
> --
> 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


-- 
Dan Connolly, W3C
http://www.w3.org/People/Connolly/

Received on Tuesday, 28 September 1999 15:42:04 UTC