Re: RDFa and Web Directions North 2009

On Feb 18, 2009, at 16:15, Sam Ruby wrote:

> Henri Sivonen wrote:
>> While HTML5 parsing as defined today supplies namespace information  
>> for each element and attribute name, it doesn't supply xmlns:foo- 
>> based namespace mapping context for resolving prefixes in attribute  
>> content on the application layer.
>
> If you could put aside your understandable dislike for prefixes in  
> any form for a moment:
>
>    How would renaming xmlns:foo="bar" to prefix="foo=bar" (or
>    whatever) address the issue you describe above?


Case xmlns:foo="bar" gets the following treatment:

With XML parsing and the XOM model, there is no attribute "xmlns:foo".  
That is, there'd be no arguments for getAttributeValue() (on an  
Element object) that would return "bar". However,  
getNamespaceURI("foo") would return "bar".

With HTML parsing and the XOM model, getNamespaceURI("foo") would  
return null. Depending on parser configuration, there either would be  
nothing in the model corresponding to xmlns:foo="bar" or  
getAttributeValue("xmlnsU00003Afoo") would return "bar".

Thus, the model would be inconsistent in the HTML and XHTML cases.  
(Unless HTML5 parsing is changed to accommodate RDFa.)

Case prefix="foo=bar" would get the following treatment both for XML  
and HTML parsing:
In XOM, getNamespaceURI("foo") would return null.  
getAttributeValue("prefix") would return "foo=bar".

Hence, the model would be consistent in the HTML and XHTML cases  
without changes to HTML5 parsing.

SAX2 would work in an analogous way.

-- 
Henri Sivonen
hsivonen@iki.fi
http://hsivonen.iki.fi/

Received on Wednesday, 18 February 2009 14:27:52 UTC