[xml] query - append DOM tree, identify leaf node

I read through some of the basic API's for building the DOM tree using libxml2
and I understood the examples for tree and xpath, by executing the same.
I would like to learn to use the API's in my application accordingly.
(I'm rephrasing my question in the previous thread)
1. Suppose if I have a pointer xmlDoc *doc1 to a DOM tree, built using xmlReadFile( ) or xmlParseFile( ) for file1.xml.
    Is it possible to add another DOM tree to this existing tree?
    Like, if *doc2 points to another DOM tree of file2.xml, can this be appended to the *doc1.
2. Using xmlXPathEvalExpression( ), I could search for a tree structure exists in the DOM tree or not.
    But how do I find that is the leaf node.
     Here I can search for "//node//n1" or "//node//n1//n11" using the above api.
     But how to confirm the leaf node. Here the second search is the leaf node.
     Using this xmlXPathObjectPtr--->xmlNodeSetPtr--->xmlNodePtr--->xmlElementType,
     we can say is it an element, or an attribute or a text node. But how to identify it as a leaf node.

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