Re: [xml] Streaming XPATH and xmlPatternCompile



On Thu, Oct 25, 2007 at 01:58:58PM +0200, Aron Stansvik wrote:
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 ?

  Conditionals are not supported 
It is restricted to IDC patterns from XML Schemas
which are normal XPath 1.0 paths I think
   [5]    Path    ::=    ('.//')? ( Step '/' )* ( Step | '@' NameTest ) 
basically you can use it as a selector to select just the
nodes you are interested into. But if you have 2 millions records 
with exactly the same structure it won't help that much.

Seems to work just fine here:
[...]
[astan franz ~]$ xmllint --shell test.xml
/ > xpath //bar[baz = 'aaa']

  Well actually --shell is not streaming it uses the normal XPath
document tree :-)

Daniel

-- 
Red Hat Virtualization group http://redhat.com/virtualization/
Daniel Veillard      | virtualization library  http://libvirt.org/
veillard redhat com  | libxml GNOME XML XSLT toolkit  http://xmlsoft.org/
http://veillard.com/ | Rpmfind RPM search engine  http://rpmfind.net/



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