From: Petr P. <pa...@us...> - 2003-05-29 14:28:32
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext In directory sc8-pr-cvs1:/tmp/cvs-serv22150 Modified Files: XPathContext.xs XPathContext.pm Log Message: added lookupNs method Index: XPathContext.xs =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/XPathContext.xs,v retrieving revision 1.34 retrieving revision 1.35 diff -u -d -r1.34 -r1.35 --- XPathContext.xs 21 May 2003 10:30:15 -0000 1.34 +++ XPathContext.xs 29 May 2003 14:28:29 -0000 1.35 @@ -563,6 +563,23 @@ } SV* +lookupNs( pxpath_context, prefix ) + SV * pxpath_context + SV * prefix + PREINIT: + xmlXPathContextPtr ctxt = NULL; + INIT: + ctxt = (xmlXPathContextPtr)SvIV(SvRV(pxpath_context)); + if ( ctxt == NULL ) { + croak("XPathContext: missing xpath context"); + } + xpc_LibXML_configure_xpathcontext(ctxt); + PPCODE: + RETVAL = xpc_C2Sv(xmlXPathNsLookup(ctxt, SvPV_nolen(prefix))); + OUTPUT: + RETVAL + +SV* getVarLookupData( self ) SV * self INIT: @@ -783,9 +800,8 @@ if (found != NULL) { nodelist = found->nodesetval; } else { - nodelist = NULL; + nodelist = NULL; } - xmlFree(xpath); sv_2mortal( xpc_LibXML_error ); @@ -832,8 +848,8 @@ /* prevent libxml2 from freeing the actual nodes */ if (found->boolval) found->boolval=0; xmlXPathFreeObject(found); - } - else { + } + else { xmlXPathFreeObject(found); xpc_LibXML_croak_error(); } Index: XPathContext.pm =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/XPathContext.pm,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- XPathContext.pm 21 May 2003 12:19:38 -0000 1.27 +++ XPathContext.pm 29 May 2003 14:28:29 -0000 1.28 @@ -166,6 +166,9 @@ my $value = $xc->findvalue($xpath); my $value = $xc->findvalue($xpath, $context_node); + my $namespace_uri = $xc->lookupNs($prefix); + + =head1 DESCRIPTION This module augments L<XML::LibXML|XML::LibXML> by providing Perl |