Re: [xml] XPath attribute namespace pattern



On Thu, Oct 06, 2011 at 09:09:44PM +0200, Joachim Zobel wrote:
On Wed, 2011-10-05 at 20:55 +0200, Joachim Zobel wrote:
    patternc = xmlPatterncompile(pattern, NULL, XML_PATTERN_XPATH ,
NULL);

However I ca't understand what this code could do wrong. I also tried 0
instead of XML_PATTERN_XPATH, no success.

I would be relly grateful if someone has an enlightening idea.

  Late, but hopefully still useful !

  Patterns works only on a subset of XPath, they are minimalist but
allow to stream and filter without building a full tree in memory.
Instead of trying to express namespaces in the XPath expression
use them at pattern compilation time, something like:


const char *ns[4] = {"http://xml.zope.org/namespaces/i18n";, "i18n",
                     NULL, NULL};
pattern= "//*[ i18n:*]"

p = xmlPatterncompile(pattern, NULL, XML_PATTERN_XPATH, &ns);

this should work and be less convoluted

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel veillard com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/



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