[xml] Newbie question on libxml

Being new to libXML, and I have the following question:
Say I have the following XML file representing a collection of system configuration files (a manifest) such as /etc/foo.conf, /etc/goo.conf that needs to be copied, deleted, etc based on the operation (COPY, RESET, RESTORE).

<?xml version="1.0" ?>
<!DOCTYPE object
       <!ELEMENT object (name, type, op+)>
       <!ELEMENT name (#PCDATA)>
       <!ELEMENT type (#PCDATA)>
       <!ELEMENT op (action, src, dst)>
       <!ELEMENT action (#PCDATA)>
       <!ELEMENT src (#PCDATA)>
       <!ELEMENT dst (#PCDATA)>


I have learned how to read/parse this file via xmlReadFile with XML_PARSE_NOBLANKS | XML_PARSE_DTDVALID. I have also manged to walk the tree and print node name and content.
Here is what I want to be able to do:
An operation specific C function (such as processManifestCopy()) would read/parse this file and then proceed to identify all the objects (or files) whose op.action is COPY and then do the appropriate thing.

My question is:
Is there any libxml function that can do some of this work for me. The only way that I know how to do this at this point is to walk the tree with xmlDocGetRootElement(), and xmlNode and put each object in a struct, then examine the op.action, if this is what I want, then move on to the next object, else reuse this struct, such that at the end of the day, I have a link list of structures. I'm sure libXML is more powerfull than ... here is a xmlDocPtr, now take it from here....

As a suggestion, perhaps xmlsoft.org site's author could provide some SEE ALSO links in the description area of functions. Currently one learns about a function such as xmlReadFile() but what do you do with that, where do you go from here....not there...basically the old unix man page recommendations.

Thanks everyone ...

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