Re: [xml] Is there an API for obtaining xmlNodeSetPtr for all the nodes within a xml sub-tree ?



Hi,

The idea of having xmlNodeSetPtr  for all children nodes of a xml subtree, is to pass xmlNodeSetPtr  to the Canonical function -  xmlC14NDocDumpMemory. Here i want to cannonicalise only the required xml-subtree.

For example .. I want to canonicalise only the <soap:Body> and all its child nodes in the following xml file :

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2001/12/soap-envelope" soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding ">
    <soap:Header>
        <m:Trans xmlns:m=" http://www.w3schools.com/transaction/" soap:mustUnderstand="1">234</m:Trans>
    </soap:Header>
    <soap:Body>
        <n:GetPrice xmlns:n=" http://www.w3schools.com/prices">
            <n:Item>Apples</n:Item>
        </n:GetPrice>
    </soap:Body>
</soap:Envelope>


If what I am trying to do is not efficient, then what is the best way to do canonicalise all child nodes of <soap:Body> of the above example in Libxml ?

Thank you,
Chetan Raj




On 4/14/06, Daniel Veillard <veillard redhat com> wrote:
On Fri, Apr 14, 2006 at 12:07:42PM +0530, Chetan Raj wrote:
> Hi All,
>
> I am new to Libxml. I am trying to find an API in Libxml that can give me
> xmlNodeSetPtr  for all the children nodes of a xml subtree.

  A node set can be one of the results of an XPath query. So you would
have to make an XPath query corresponding to the childrens. But that sounds
wrong to me, if you want to walk the children of a node it's part of the
tree structure so why spend time to create artificially an extra structure
for this !

Daniel

--
Daniel Veillard      | Red Hat http://redhat.com/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/



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