[xml] XPath partially not working on doc built from xmlParseFile



I may be missing something obvious here as I'm fairly new to libxml. If
so, please be gentle :)

I've got an application using libxml which builds a document from
scratch (converting a proprietary configuration file) with xmlNewDoc(),
xmlNewDocNode(), xmlNewChild(), etc. Every imaginable expression I've
fed to xmlXPathEvalExpression() returns sensible results using the root
of that doc as the context.

The app also reads an XHTML file from disk with xmlParseFile(). Some
XPath expressions return the expected nodeset results, but others don't.
For example, "//*" or "/descendant::*" returns a nodeset with everything
from the doc built from the file, "/*" returns <html>, and
"/child::*/child::*" returns <head> and <body>. But any element
reference fails - for example, "//input" or "/descendant::table" returns
zero nodes.

I'm baffled by this behavior and at a loss as to how to go about
debugging it. The only two differences I can see between the two docs
are that one is build by hand while the other comes out of
xmlParseFile(), and that the misbehaving doc is (well-formed) html (from
htmltidy).

-- 
Guy Finney
gfinney symmetry-health com
602-840-1910 x107



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