Re: Support for integration with XML is broken

Ivan Herman wrote:
> Ie: it would not be impossible to redo my implementation with full
> glory namespace support but yes, it would require some extra and non
> negligible work...

Shane McCarron wrote:
> I agree that we discussed this.  What I remember is that people
> didn't want to have to have their parsers support namespaced
> attributes because it would mean a lot more work.  Manu?

It's really not much work.

Just replace all:

	hasAttribute('foo')
	getAttribute('foo')
	setAttribute('foo', 'val')

with:

	hasAttributeNS($RDFANS, 'foo')
	getAttributeNS($RDFANS, 'foo')
	setAttributeNS($RDFANS, 'foo', 'val')

where $RDFANS is a variable that you set right at the beginning of the
parsing, upon detecting the host language. e.g. if the host language is
XHTML or HTML or SVG, you'd set it to null; if the host language is
OpenDocument, you'd set it to "http://www.w3.org/1999/xhtml".

This is what I did - took about ten minutes. Of the three major changes
I needed to make to support OpenDocument's flavour of RDFa, it was the
simplest. (The others were: OpenDocument is a collection of *zipped*
XML files; and OpenDocument supports literals that start half-way
through a paragraph and end somewhere outside the paragraph.)

Of course this doesn't allow a host language to place some RDFa
attributes in one namespace, and other RDFa attributes in another
namespace. But anyone who wants to do that with their host language
needs to be taken out back and "re-educated" by a couple of heavies
with cricket bats.

-- 
Toby A Inkster
<mailto:mail@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

Received on Friday, 21 October 2011 09:50:33 UTC