# Tests that XML Literals are working OK. use Test::More tests => 8; BEGIN { use_ok('RDF::RDFa::Parser') }; BEGIN { use_ok('XML::LibXML') }; my $xhtml = <

Albert Einstein

EOF $parser = RDF::RDFa::Parser->new($xhtml, 'http://example.com/einstein'); ok(lc($parser->dom->documentElement->tagName) eq 'html', 'DOM Tree returned OK.'); ok($parser->consume, "Parse OK"); my $model; ok($model = $parser->graph, "Graph retrieved"); my $iter = $model->get_statements( RDF::Trine::Node::Resource->new('http://example.com/einstein#topic'), RDF::Trine::Node::Resource->new('http://xmlns.com/foaf/0.1/name'), undef); my $st = $iter->next; ok(defined $st, "Literal found"); ok($st->object->literal_datatype eq 'http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral', "XML seems to have correct datatype"); SKIP: { skip("If you care about XML canonicalisation, upgrade to at least libxml 2.6.23.", 1) unless XML::LibXML::LIBXML_VERSION >= 20623; ok($st->object->literal_value eq 'Albert Einstein', "XML seems to have correct literal value (with ec14n)"); }