[xml] question about how to set namespace in libxml



Currently I am reading in the following xml document (through a ruby wrapper)
LibXML::XML::Document.string( saml_plain)

<ds:SignedInfo>
<ds:CanonicalizationMethod Algorithm='http://www.w3.org/2001/10/xml-exc-c14n#'/>
<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>
<ds:Reference URI='#FYQBldG6i_i18gy6gJfhOh7.u_T'>
<ds:Transforms>
<ds:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>
<ds:Transform Algorithm='http://www.w3.org/2001/10/xml-exc-c14n#'/>
</ds:Transforms>
<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>
<ds:DigestValue>KpuhfX2q6nR660VW/dS0vIrVtSg=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>

The problem when it is read in that all of the ds namespaces are stripped and errors occur
<SignedInfo>
<CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></CanonicalizationMethod>
<SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></SignatureMethod>
<Reference URI="#FYQBldG6i_i18gy6gJfhOh7.u_T">
<Transforms>
<Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></Transform>
<Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></Transform>
</Transforms>
<DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></DigestMethod>
<DigestValue>KpuhfX2q6nR660VW/dS0vIrVtSg=</DigestValue>
</Reference>
</SignedInfo>

Is there a way I can set the 'ds' namespace as 'http://www.w3.org/2000/09/xmldsig#' so it would be read in as:
<ds:SignedInfo xmlns:ds="http://www.w3.org/2000/09/xmldig#">
<ds:CanonicalizationMethod Algorithm='http://www.w3.org/2001/10/xml-exc-c14n#'/>
<ds:SignatureMethod Algorithm='http://www.w3.org/2000/09/xmldsig#rsa-sha1'/>
<ds:Reference URI='#FYQBldG6i_i18gy6gJfhOh7.u_T'>
<ds:Transforms>
<ds:Transform Algorithm='http://www.w3.org/2000/09/xmldsig#enveloped-signature'/>
<ds:Transform Algorithm='http://www.w3.org/2001/10/xml-exc-c14n#'/>
</ds:Transforms>
<ds:DigestMethod Algorithm='http://www.w3.org/2000/09/xmldsig#sha1'/>
<ds:DigestValue>KpuhfX2q6nR660VW/dS0vIrVtSg=</ds:DigestValue>
</ds:Reference>
</ds:SignedInfo>

thanks!
-dan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]