Re: Distributed Extensibility

Sam Ruby wrote:
> Julian Reschke wrote:
>> Sam Ruby wrote:
>>>> Finally, there's also Internet Explorer's <xml> element.
>>>
>>> I recall that being generously described as "undocumented".  Has that 
>>> changed?
>> 
>> Such as <http://msdn2.microsoft.com/en-us/library/ms535918.aspx>?
> 
> That's a bit... sparse ... on detail.

IE5+ also does namespaced tags outside of <xml>, which are perhaps 
interesting - http://msdn2.microsoft.com/en-us/library/ms535160.aspx and 
http://msdn2.microsoft.com/en-us/library/ms531076.aspx give some 
incomplete and incorrect information. Rough experimentation suggests the 
following:

Tags with a colon (more specifically, those that match the pattern 
([a-zA-Z][^:>/\s]*):([^>/\s]+) or something close) anywhere in the 
document are treated as XML-like tags. They're mostly parsed the same 
way as <div>, <span>, etc, e.g. you can get a non-tree DOM by doing 
<a:a>1<b:b>2</a:a>3</b:b>. A trailing slash makes it parse as an empty 
element, as in XML. Everything else seems the same as normal HTML parsing.

Elements created from XML-like tags have interesting properties 
"scopeName", "tagName", "tagUrn". tagUrn comes from namespace declarations:

Putting an xmlns:foo="bar" attribute on an <html> tag (regardless of 
where that tag occurs in the document, or how many such tags you have) 
declares a namespace with the given scope name and URN. A tag (either 
start or end) with an unrecognised scope name implicitly declares a 
namespace with an empty URN. xmlns:foo on any other tag is ignored. 
(There are some complications if you define a namespace multiple times.)

document.namespaces is an array of namespace objects (for all the 
explicitly- and implicity-declared namespaces in the document), each 
with properties "name" and "urn". (There's also "tagNames" but that 
always gives me a 'Not implemented' error. And there's also 
"onreadystatechange" and "readyState".)

CSS selectors like "x\:y { ... }" match <x:y> elements. 
getElementsByTagName matches on the tagName, independent of the scopeName.


If namespaces were added to HTML, I expect it would be quite beneficial 
to do it in a way that's sufficiently compatible with IE's 
implementation - the basic details appear to be vaguely sane, and must 
already be compatible with the existing web content (of which ~2% 
already uses namespaces, specifically Office's <o:p> plus a 
not-insignificant number of <v:...> and <st1:...> tags presumably also 
from Office).

-- 
Philip Taylor
philip@zaynar.demon.co.uk

Received on Thursday, 2 August 2007 18:05:16 UTC