W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2008

implicit change of default namespace

From: Ben Liblit <liblit@cs.wisc.edu>
Date: Wed, 27 Feb 2008 16:38:28 -0600
Message-ID: <47C5E664.6020306@cs.wisc.edu>
To: xmlschema-dev@w3.org

I am trying to formalize a family of documents which use a local, custom 
structure at and near the document root, but which eventually use XHTML 
block elements further down.  For example:

	<my:root
	  xmlns:my="http://example.com/my"
	  xmlns:html="http://www.w3.org/1999/xhtml">

	  <my:product>
	    <my:description>
	      <html:p>...</html:p>
	      <html:ul>...</html:ul>
	    </my:description>

	    <my:summary>
	      <html:div>...</html:div>
	    </my:summary>
	  </my:product>

	</my:root>

I know that I could make either "http://example.com/my" or 
"http://www.w3.org/1999/xhtml" a default namespace and then omit the 
"my:" or "html:" prefixes on element tags.  However, what I'd really 
like to do is omit *both* namespace prefixes, while still avoiding any 
xmlns="..." attributes on elements below the root:

	<root ...>

	  <product>
	    <description>
	      <p>...</p>
	      <ul>...</ul>
	    </description>

	    <summary>
	      <div>...</div>
	    </summary>
	  </product>

	</root>

There is no overlap in element names between the two namespaces, so 
there ought to be an unambiguous interpretation of this document.  I've 
been able to do this in the past using DTDs by giving every HTML element 
a fixed xmlns="http://www.w3.org/1999/xhtml" attribute.  This can be 
done easily by redefining an appropriate DTD element which modular XHTML 
offers as an extension point.

However, I cannot figure out how to do this using XML Schemas.  I've 
found a similar modular XHTML extension point: it is the 
xhtml.Core.extra.attrib named attribute group, which could be redefined 
to give every XHTML element additional attributes.  But my validator 
explicitly forbids using this to define an "xmlns" attribute.

Is there any way at all to accomplish this using XML Schemas?  Or will I 
be forced to use either namespace prefixes or xmlns="..." attributes 
whenever I want to change default namespaces?

Thanks,
Ben
Received on Thursday, 28 February 2008 02:56:04 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:15:02 GMT