Re: [xml] Canonicalization (C14N) of an XML element

I am a newbie to libxml2, and I am not familiar with XPath, nor
libxml2's NodeSet.
Hm... I am sorry but I have to ask if you really want to
write xmldsig implementation yourself. I did it once
( and it is not an exercise
I can recommend for "a newbie to libxml2".

These functions take the parameter 'xmlNodeSetPtr nodes', described as
"The nodes set to be included in the canonized image, or NULL if all document nodes should be included."

So I built a node set, consisting of my single element node.
Should I build a node set including all sub-nodes?
Yes. You have to add all the nodes that you want to get
canonicalized. However, in this particular case there is
a better way. The xmlC14NExecute function allows one to
provide a callback that would be called to determine if
a given node is "visible" (i.e. included in c14n output)
or not. To canonicalize just a given node (with all the
attributes and children nodes) you can write a callback
function that would return "true" for your node, its attributes,
namespaces and children nodes and "false" for all other
nodes in the document.


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