Re: FPWD Review Request: HTML+RDFa

Hi Philip,

These are not standard DOM methods though.

And anyway, as discussed in my other thread with Henri, the RDFa
algorithm doesn't rely on some XML namespace processor to keep track
of 'in-scope' mappings, since it does this itself. (I.e., it's written
into the RDFa spec.)

Regards,

Mark

On Thu, Sep 3, 2009 at 4:58 PM, Philip Taylor<pjt47@cam.ac.uk> wrote:
> Shane McCarron wrote:
>>
>> [...] If you want to implement an RDFa processor such that it is truly
>> namespace aware, discovering the namespace prefix mappings via [in-scope
>> namespaces] property... you are certainly free to do so.  I have yet to find
>> a DOM implementation I can get to in Perl that makes this easy to do (my
>> RDFa processor is written in Perl).
>
> Does XML::LibXML's DOM not make it adequately easy?
>
>  use XML::LibXML;
>  my $p = new XML::LibXML;
>  my $doc = $p->parse_string('<foo xmlns="http://www.w3.org/...">
>    <foo xmlns:ns="http://example.com"><foo/></foo></foo>');
>  for my $e ($doc->getElementsByTagName('foo')) {
>    print "$e\n";
>    for my $ns ($e->getNamespaces) {
>      print '  ', $ns->name, ' = ', $ns->value, "\n";
>    }
>    print '  lookup(ns) = ', ($e->lookupNamespaceURI('ns') || ''), "\n";
>  }
>
> (Obviously this won't work if you're constructing a DOM from an HTML parser
> (rather than an XML parser), because the XML Namespaces spec doesn't apply
> to non-XML HTML at all. But when you're doing everything with real XML, the
> namespace mappings should all work easily, as far as I'm aware.)
>
> --
> Philip Taylor
> pjt47@cam.ac.uk
>
>



-- 
Mark Birbeck, webBackplane

mark.birbeck@webBackplane.com

http://webBackplane.com/mark-birbeck

webBackplane is a trading name of Backplane Ltd. (company number
05972288, registered office: 2nd Floor, 69/85 Tabernacle Street,
London, EC2A 4RR)

Received on Friday, 4 September 2009 11:11:21 UTC