Skip Menu |
 

This queue is for tickets about the XML-LibXML CPAN distribution.

Report information
The Basics
Id: 41272
Status: resolved
Priority: 0/
Queue: XML-LibXML

People
Owner: Nobody in particular
Requestors: kawas7 [...] hotmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: canonicalize xml
Download (untitled) / with headers
text/plain 583b
Hi, libxml has the ability to canonicalize xml using expressions like the one that get_xpath() below returns. Could LibXML add that functionality? Thanks, Eddie #---- Example Code----# use XML::LibXML; my $xpath = get_xpath(); my $xml = 'example.xml'; #attached my $parser = XML::LibXML->new(); my $doc = $parser->parse_file( $xml ); my $CanonicalForm =$doc->toStringEC14N( 0, $xpath, [''] ); sub get_xpath { return <<EOF; <XPath xmlns:wsa="http://www.w3.org/2005/08/addressing"> (//. | //@* | //namespace::*)[ancestor-or-self::wsa:MessageID] </XPath> EOF }
Subject: example.xml
Download example.xml
text/xml 1.7k
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:wsrl="http://docs.oasis-open.org/wsrf/rl-2" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:Profile="urn:ehealth:profiles:timestamping:1.0" xmlns:tsa="http://www.behealth.be/webservices/tsa" xmlns:urn="urn:oasis:names:tc:dss:1.0:core:schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsrp="http://docs.oasis-open.org/wsrf/rp-2" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header><wsa:Action wsu:Id="Action">http://www.behealth.be/webservices/tsa/TSConsultTSBagRequest</wsa:Action><wsa:To wsu:Id="To">https://www.ehealth.fgov.be/timestampauthority_1_5/timestampauthority</wsa:To><wsa:MessageID wsu:Id="MessageID">urn:www.sve.man.ac.uk-54690551758351720271010843310</wsa:MessageID><wsa:ReplyTo wsu:Id="ReplyTo"><wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address></wsa:ReplyTo></soapenv:Header><soapenv:Body wsu:Id="myBody"><TSConsultTSBagRequest xmlns="http://www.behealth.be/webservices/tsa"><tsa:IDHospital>tsa_0406798006_01</tsa:IDHospital><tsa:TSList><tsa:sequenceNumber>80300231753732</tsa:sequenceNumber><tsa:dateTime>1226995312781</tsa:dateTime></tsa:TSList></TSConsultTSBagRequest></soapenv:Body></soapenv:Envelope>
Download (untitled) / with headers
text/plain 773b
Show quoted text
> libxml has the ability to canonicalize xml using expressions like the > one that get_xpath() below returns. Could LibXML add that > functionality?
Show quoted text
> Thanks, > Eddie > > <XPath xmlns:wsa="http://www.w3.org/2005/08/addressing"> > (//. | //@* | //namespace::*)[ancestor-or-self::wsa:MessageID] > </XPath>
Which libxml2 function takes XPath in the above XML syntax? Anyway, currently toStringE14N does not support namespace prefixes, so you have to rewrite your expression as (//. | //@* | //namespace::*) [ancestor-or-self::*[local-name()='MessageID' and namespace-uri()='http://www.w3.org/2005/08/addressing'] In some future version I'll either add an extra argument for namespace prefix mapping or add a method that takes a nodeset instead of XPath. -- Petr
Download (untitled) / with headers
text/plain 159b
Hi, in the SVN version, XML::LibXML::XPathContext can be passed to the c14n methods so that namespace prefixes get mapped to namespace URIs correctly. -- Petr


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.