Re: [xml] Streaming XPATH and xmlPatternCompile



2007/10/17, s kum <boha4100 yahoo com>:
Hi,

We are looking for a way to process XPATH expressions on very large xml
documents. Because of the size of the documents, we like to use stream
processing – something along the lines of XPathReader from MS. Searching the
archive, we found we could possibly use xmlPatternCompile along with
xmlTextReader* APIs to do the same. We are getting compilation errors on
several XPATH expressions when we do this.

Are there limitations to XPATH expressions supported by xmlPatternCompile ?
If so, what are those? Can it support author[first-name = "Bob"] and
degree[ from != "Harvard"] kind of conditional expressions ?

Seems to work just fine here:

[astan franz ~]$ cat test.xml
<foo>
        <bar a="a">
                <baz>aaa</baz>
        </bar>
</foo>
[astan franz ~]$ xmllint --shell test.xml
/ > xpath //bar[baz = 'aaa']
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT bar
    ATTRIBUTE a
      TEXT
        content=a
/ > xpath //bar[ a = 'a']
Object is a Node Set :
Set contains 1 nodes:
1  ELEMENT bar
    ATTRIBUTE a
      TEXT
        content=a
/ >

Please provide a minimal example (code and XML instance) which does
not work for you, and always try with the latest libxml2 version.

Regards,
Aron



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