jwalt 2003/09/19 03:08:04
Modified: lib/Apache/AxKit/Language XPathScript.pm Log: - reverted provider registry patch Revision Changes Path 1.12 +38 -9 xml-axkit/lib/Apache/AxKit/Language/XPathScript.pm Index: XPathScript.pm =================================================================== RCS file: /home/cvs/xml-axkit/lib/Apache/AxKit/Language/XPathScript.pm,v retrieving revision 1.11 retrieving revision 1.12 diff -u -r1.11 -r1.12 --- XPathScript.pm 17 Sep 2003 21:58:38 -0000 1.11 +++ XPathScript.pm 19 Sep 2003 10:08:04 -0000 1.12 @@ -324,17 +324,46 @@ my $results = XML::XPath::NodeSet->new(); my $uri = $params[0]; my $newdoc; - eval { - $newdoc = $parser->parse(Apache::AxKit::Provider::get_uri($uri)); - }; - if (my $E = $@) { - if ($E->isa('Apache::AxKit::Exception::IO')) { - AxKit::Debug(2, $E); - } - else { - throw Apache::AxKit::Exception::Error(-text => "Parse of '$uri' failed: $E"); + if ($uri =~ /^axkit:/) { + $newdoc = $parser->parse( AxKit::get_axkit_uri($uri) ); + } elsif ($uri =~ /^xmldb:/) { + $newdoc = $parser->parse( Apache::AxKit::Provider::XMLDB::get_xmldb_uri($uri) ); + } + elsif ($uri =~ /^\w\w+:/) { # assume it's scheme://foo uri + eval { + # warn "Trying to parse $params[0]\n"; + $newdoc = $parser->parse( + $Apache::AxKit::Language::XPathScript::local_ent_handler->( + undef, undef, $uri + ) + ); + # warn "Parsed OK into $newdoc\n"; }; + if (my $E = $@) { + if ($E->isa('Apache::AxKit::Exception::IO')) { + AxKit::Debug(2, $E); + } + else { + throw Apache::AxKit::Exception::Error(-text => "Parse of '$uri' failed: $E"); + }; + } + } + else { + AxKit::Debug(3, "Parsing local: $uri\n"); + + # create a subrequest, so we get the right AxKit::Cfg for the URI + my $apache = AxKit::Apache->request; + my $sub = $apache->lookup_uri(AxKit::FromUTF8($uri)); + local $AxKit::Cfg = Apache::AxKit::ConfigReader->new($sub); + + my $provider = Apache::AxKit::Provider->new_content_provider($sub); + + $newdoc = get_source_tree($provider, $parser); + undef $provider; + undef $apache; + undef $sub; } + $results->push($newdoc) if $newdoc; #AxKit::Debug(8, "XPathScript: document() returning"); return $results;