[xml] Streaming XPath in libxml2


Please help me regarding a query on streaming XPath.

The version of libxml2 and the OS on which it is deployed is displayed

shell$ xml2-config --version

shell$ cat /proc/version
Linux version 2.6.9-1.667smp (bhcompile tweety build redhat com) (gcc
version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)) #1 SMP Tue Nov 2 14:59:52
EST 2004

I have attached a code sample, which uses streaming XPath using
xmlReader and xmlPattern. The inputs to this program are:

1). A XML message, which is well-formed, would be passed to this code
fragment for XPath matching.
2). A XPath expression.

Could you please review the code and let me know your feedback?

There are two issues. Please clarify.

1). The webpage shows an enum for the XML pattern flags.

Enum xmlPatternFlags {
    XML_PATTERN_DEFAULT = 0 : simple pattern match
    XML_PATTERN_XPATH = 1 : standard XPath pattern
    XML_PATTERN_XSSEL = 2 : XPath subset for schema selector
    XML_PATTERN_XSFIELD = 4 : XPath subset for schema field

Using 'XML_PATTERN_XPATH' results in compilation error.
Search for this string in the code base failed, which implies 
that it is not supported.

So currently I am passing a value of '1'.

2). The function "xmlPatternCompile" seems to compile valid and invalid

      patternc = xmlPatterncompile(
                    (const xmlChar *) pattern,

Could you please provide me a few invalid XPaths to test my code?
I assume that invalid XPath would result in a NULL return.

Thanks a lot for your help.


Attachment: streamXPath.c
Description: Text Data

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