[xml] Repetitive use of XPATH eval



I am real new to using LIBXML and have a question about XPATH evaluations.  The question may show a real ignorance of the LIBXML structure, don’t so assume I know what I am talking about.


I am trying to use the XPATH functions to pull the data for individual data elements.  The order of the elements whose value I must find are not necessarily contiguous in the XML document.  So walking the tree will not work. 


I have figured out how to make the call to xmlXPathEvalExpression function with a full XPATH starting at the root of the document.  But the documents I am working with are so large that this can be too slow for my purpose. 


I can identify a child node of the whole document that I know that several values I need to find are below.  Can I use the xmlXPathEvalExpression to find the branch I need to work with, then by manipulating the context or the XPATH object of the xmlXPathEvalExpression call to then do further calls to xmlXPathEvalExpression to find specific elements in the branch?  I am thinking that I would be working with a much smaller tree and the XPATH evaluations would work much faster.


Is this doable?




Bart Torbert

bart torbert ihsenergy com



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