Commits

Dorian Taylor committed 635b7ee

fixed initial parser context for XML::LibXML 1.88

Comments (0)

Files changed (3)

lib/RDF/RDFa/Parser.pm

 	# Rationalise $markup and set $dom
 	# ================================
 	Carp::croak("Need to provide markup to parse.") unless defined $markup;
-	
+
 	my $dom;
 	eval {
 		if (blessed($markup) && $markup->isa('XML::LibXML::Document'))
 		else
 		{
 			my $parser  = XML::LibXML->new;
-			
 			my $catalogue = dist_file('RDF-RDFa-Parser', 'catalogue/index.xml');
 			$parser->load_catalog($catalogue)
 				if -r $catalogue;
 			$parser->validation(0);
 			#$parser->recover(1);
-			
+
 			$dom = $parser->parse_string($markup);
 		}
 	};
-	
+
 	# Rationalise $store
 	# ==================
 	$store = RDF::Trine::Store::Memory->temporary_store
 	
 	my $NEW_SUBJECT_DEFAULTS = sub
 	{
-		if ($current_element == $current_element->ownerDocument->documentElement)
+        if ($current_element->parentNode->isa('XML::LibXML::Document'))
 		{
 			return ($self->uri(undef, {'element'=>$current_element,'xml_base'=>$hrefsrc_base}), $current_element);
 		}
 # Test the very basics.
 
-use Test::More tests => 6;
+use Test::More tests => 7;
 BEGIN { use_ok('RDF::RDFa::Parser') };
 
 use RDF::Trine;
 	return $_[3];
 }});
 
+ok($parser->dom, 'Parser has a DOM object');
+
 ok(lc($parser->dom->documentElement->tagName) eq 'html', 'DOM Tree returned OK.');
 
+#diag('hurr');
+
 $parser->consume;
+
+#diag('wat');
+
 my $model = $parser->graph;
 
 ok($model->count_statements(
 # Tests that base URLs are working OK.
 
-use Test::More tests => 12;
+use Test::More tests => 13;
 BEGIN { use_ok('RDF::RDFa::Parser') };
 
 my $xhtml_rdfa_10 = RDF::RDFa::Parser::Config->new('xhtml','1.0');
 #	diag $st->as_string;
 #}
 
+ok($model->size, 'Model has nonzero size');
+
 ok($model->count_statements(
 		RDF::Trine::Node::Resource->new('http://example.com/ns#r1/foo'),
 		undef,