Re: [xml] Xpath issues with libxml2

Alex -
With out examples of what you've tried, it's hard to diagnose the problem.
However, seeing 'namespaces' and 'never returns anything' makes me think you're
having issues with the default namespace concept. While XML documents have a
default namespace, XPaths do not. Once you use namespaces in an xml document,
all your xpaths will need to use namespace declarations for all the path parts,
even for tags that are defaulted in the document. So, you'll need to declare
a namespace prefix that matches the default namespace in the doc. Give us
a small example that you've tried that doesn't work, we'll fix it.


On Fri, Jan 30, 2015 at 08:44:15AM -0500, Alex Boese wrote:
Forgive me if this is a deprecated approach (as I am not fully aware), but I was utilizing "default" 
libxml2 bindings (not lxml) in Python to retrieve xml fragments via xpath functions. Normally this seems to 
work fine, but with namespace declarations this seems especially problematic as nothing ever returns and 
nothing errors. Would it be possible to confirm what correct functions and order of operations would be for 
this? Even if the example is C, I can translate that to Python.

Ross Reedstrom, Ph.D.                                 reedstrm rice edu
Systems Engineer & Admin, Research Scientist        phone: 713-348-6166
Connexions                    fax: 713-348-3665
Rice University MS-375, Houston, TX 77005
GPG Key fingerprint = F023 82C8 9B0E 2CC6 0D8E  F888 D3AE 810E 88F0 BEDE

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