summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam M. Brack <wbrack@src.gnome.org>2005-06-06 13:49:18 +0000
committerWilliam M. Brack <wbrack@src.gnome.org>2005-06-06 13:49:18 +0000
commitfbb619f4762fd50630e3ec22589838d089cd2f08 (patch)
treec6f4f820e03e8cafd15b4610f36241a95530f546
parent0b13a091e82e5dfcc08c9e809af950b3b304db2a (diff)
downloadlibxml2-fbb619f4762fd50630e3ec22589838d089cd2f08.tar.gz
Enhanced xmlXPathRunStreamEval, fixed handling of depth/level for cases
* xpath.c, pattern.c: Enhanced xmlXPathRunStreamEval, fixed handling of depth/level for cases like union operator (bug #306348 reported by Bob Stayton). Also enhanced several comments throughout pattern.c. * doc/apibuild.py: fixed problem in handling of 'signed' declaration. Rebuilt the docs.
-rw-r--r--ChangeLog9
-rw-r--r--doc/APIchunk11.html4
-rw-r--r--doc/APIchunk13.html1
-rw-r--r--doc/APIchunk20.html2
-rw-r--r--doc/APIchunk25.html1
-rw-r--r--doc/APIchunk5.html2
-rwxr-xr-xdoc/apibuild.py4
-rw-r--r--doc/html/libxml-pattern.html8
-rw-r--r--doc/libxml2-api.xml10
-rw-r--r--doc/libxml2-refs.xml10
-rw-r--r--pattern.c58
-rw-r--r--xpath.c9
12 files changed, 70 insertions, 48 deletions
diff --git a/ChangeLog b/ChangeLog
index 34e62713..a5c154d8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Jun 6 06:43:33 PDT 2005 William Brack <wbrack@mmm.com.hk>
+
+ * xpath.c, pattern.c: Enhanced xmlXPathRunStreamEval, fixed
+ handling of depth/level for cases like union operator
+ (bug #306348 reported by Bob Stayton). Also enhanced
+ several comments throughout pattern.c.
+ * doc/apibuild.py: fixed problem in handling of
+ 'signed' declaration. Rebuilt the docs.
+
Tue May 31 20:35:27 PDT 2005 William Brack <wbrack@mmm.com.hk>
* xinclude.c: Enhanced handling of xml:base for included
diff --git a/doc/APIchunk11.html b/doc/APIchunk11.html
index 510648fe..89d4ef12 100644
--- a/doc/APIchunk11.html
+++ b/doc/APIchunk11.html
@@ -362,6 +362,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-dict.html#xmlDictCreateSub">xmlDictCreateSub</a><br />
<a href="html/libxml-dict.html#xmlDictReference">xmlDictReference</a><br />
<a href="html/libxml-hash.html#xmlHashCreateDict">xmlHashCreateDict</a><br />
+<a href="html/libxml-pattern.html#xmlPatterncompile">xmlPatterncompile</a><br />
<a href="html/libxml-pattern.html#xmlStreamPush">xmlStreamPush</a><br />
<a href="html/libxml-pattern.html#xmlStreamPushAttr">xmlStreamPushAttr</a><br />
</dd><dt>dictionnary</dt><dd><a href="html/libxml-parser.html#_xmlParserCtxt">_xmlParserCtxt</a><br />
@@ -375,9 +376,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-dict.html#xmlDictQLookup">xmlDictQLookup</a><br />
<a href="html/libxml-dict.html#xmlDictReference">xmlDictReference</a><br />
<a href="html/libxml-dict.html#xmlDictSize">xmlDictSize</a><br />
-<a href="html/libxml-pattern.html#xmlPatterncompile">xmlPatterncompile</a><br />
-<a href="html/libxml-pattern.html#xmlStreamPush">xmlStreamPush</a><br />
-<a href="html/libxml-pattern.html#xmlStreamPushAttr">xmlStreamPushAttr</a><br />
</dd><dt>did</dt><dd><a href="html/libxml-schemasInternals.html#XML_SCHEMAS_TYPE_BLOCK_DEFAULT">XML_SCHEMAS_TYPE_BLOCK_DEFAULT</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderGetRemainder">xmlTextReaderGetRemainder</a><br />
<a href="html/libxml-xmlreader.html#xmlTextReaderStandalone">xmlTextReaderStandalone</a><br />
diff --git a/doc/APIchunk13.html b/doc/APIchunk13.html
index d29634a0..83e51b3f 100644
--- a/doc/APIchunk13.html
+++ b/doc/APIchunk13.html
@@ -268,6 +268,7 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-HTMLparser.html#htmlSAXParseFile">htmlSAXParseFile</a><br />
<a href="html/libxml-tree.html#xmlNodeListGetRawString">xmlNodeListGetRawString</a><br />
<a href="html/libxml-tree.html#xmlNodeListGetString">xmlNodeListGetString</a><br />
+<a href="html/libxml-pattern.html#xmlPatterncompile">xmlPatterncompile</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathStringFunction">xmlXPathStringFunction</a><br />
</dd><dt>formatted</dt><dd><a href="html/libxml-xmlwriter.html#xmlTextWriterWriteFormatAttribute">xmlTextWriterWriteFormatAttribute</a><br />
<a href="html/libxml-xmlwriter.html#xmlTextWriterWriteFormatAttributeNS">xmlTextWriterWriteFormatAttributeNS</a><br />
diff --git a/doc/APIchunk20.html b/doc/APIchunk20.html
index a4e20b03..82ab2820 100644
--- a/doc/APIchunk20.html
+++ b/doc/APIchunk20.html
@@ -492,8 +492,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-parser.html#xmlCtxtResetPush">xmlCtxtResetPush</a><br />
<a href="html/libxml-xmlIO.html#xmlParserInputBufferPush">xmlParserInputBufferPush</a><br />
<a href="html/libxml-pattern.html#xmlStreamPop">xmlStreamPop</a><br />
-<a href="html/libxml-pattern.html#xmlStreamPush">xmlStreamPush</a><br />
-<a href="html/libxml-pattern.html#xmlStreamPushAttr">xmlStreamPushAttr</a><br />
<a href="html/libxml-xpathInternals.html#xmlXPathEvalExpr">xmlXPathEvalExpr</a><br />
</dd><dt>pushed</dt><dd><a href="html/libxml-xmlregexp.html#xmlRegExecErrInfo">xmlRegExecErrInfo</a><br />
<a href="html/libxml-xpath.html#xmlXPathFunction">xmlXPathFunction</a><br />
diff --git a/doc/APIchunk25.html b/doc/APIchunk25.html
index 045ce695..2c7f5318 100644
--- a/doc/APIchunk25.html
+++ b/doc/APIchunk25.html
@@ -117,7 +117,6 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xinclude.html#xmlXIncludeProcessTree">xmlXIncludeProcessTree</a><br />
<a href="html/libxml-xinclude.html#xmlXIncludeProcessTreeFlags">xmlXIncludeProcessTreeFlags</a><br />
</dd><dt>wether</dt><dd><a href="html/libxml-xpath.html#_xmlNodeSet">_xmlNodeSet</a><br />
-<a href="html/libxml-pattern.html#xmlPatternMatch">xmlPatternMatch</a><br />
</dd><dt>what</dt><dd><a href="html/libxml-catalog.html#xmlCatalogGetDefaults">xmlCatalogGetDefaults</a><br />
<a href="html/libxml-catalog.html#xmlCatalogSetDefaults">xmlCatalogSetDefaults</a><br />
<a href="html/libxml-parserInternals.html#xmlParseNamespace">xmlParseNamespace</a><br />
diff --git a/doc/APIchunk5.html b/doc/APIchunk5.html
index 7a82a2c9..f91da3d8 100644
--- a/doc/APIchunk5.html
+++ b/doc/APIchunk5.html
@@ -229,6 +229,8 @@ A:link, A:visited, A:active { text-decoration: underline }
<a href="html/libxml-xmlregexp.html#xmlRegExecPushString">xmlRegExecPushString</a><br />
<a href="html/libxml-xmlregexp.html#xmlRegExecPushString2">xmlRegExecPushString2</a><br />
<a href="html/libxml-relaxng.html#xmlRelaxNGValidatePushElement">xmlRelaxNGValidatePushElement</a><br />
+<a href="html/libxml-pattern.html#xmlStreamPush">xmlStreamPush</a><br />
+<a href="html/libxml-pattern.html#xmlStreamPushAttr">xmlStreamPushAttr</a><br />
<a href="html/libxml-valid.html#xmlValidatePushElement">xmlValidatePushElement</a><br />
</dd><dt>Pushes</dt><dd><a href="html/libxml-parserInternals.html#inputPush">inputPush</a><br />
<a href="html/libxml-parserInternals.html#namePush">namePush</a><br />
diff --git a/doc/apibuild.py b/doc/apibuild.py
index 518c93ca..56862389 100755
--- a/doc/apibuild.py
+++ b/doc/apibuild.py
@@ -1201,7 +1201,9 @@ class CParser:
return token
while token[0] == "name" and (
- token[1] == "const" or token[1] == "unsigned"):
+ token[1] == "const" or \
+ token[1] == "unsigned" or \
+ token[1] == "signed"):
if self.type == "":
self.type = token[1]
else:
diff --git a/doc/html/libxml-pattern.html b/doc/html/libxml-pattern.html
index f06fcd41..e9b5a69e 100644
--- a/doc/html/libxml-pattern.html
+++ b/doc/html/libxml-pattern.html
@@ -44,17 +44,17 @@ The content of this structure is not made public by the API.
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the precompiled pattern</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if true, 0 if false and -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlPatternGetStreamCtxt" id="xmlPatternGetStreamCtxt"></a>Function: xmlPatternGetStreamCtxt</h3><pre class="programlisting"><a href="libxml-pattern.html#xmlStreamCtxtPtr">xmlStreamCtxtPtr</a> xmlPatternGetStreamCtxt (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)<br />
</pre><p>Get a streaming context for that pattern Use <a href="libxml-pattern.html#xmlFreeStreamCtxt">xmlFreeStreamCtxt</a> to free the context.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the precompiled pattern</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>a pointer to the context or NULL in case of failure</td></tr></tbody></table></div><h3><a name="xmlPatternMatch" id="xmlPatternMatch"></a>Function: xmlPatternMatch</h3><pre class="programlisting">int xmlPatternMatch (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp, <br /> <a href="libxml-tree.html#xmlNodePtr">xmlNodePtr</a> node)<br />
-</pre><p>Test wether the node matches the pattern</p>
+</pre><p>Test whether the node matches the pattern</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the precompiled pattern</td></tr><tr><td><span class="term"><i><tt>node</tt></i>:</span></td><td>a node</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if it matches, 0 if it doesn't and -1 in case of failure</td></tr></tbody></table></div><h3><a name="xmlPatternMaxDepth" id="xmlPatternMaxDepth"></a>Function: xmlPatternMaxDepth</h3><pre class="programlisting">int xmlPatternMaxDepth (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)<br />
</pre><p>Check the maximum depth reachable by a pattern</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the precompiled pattern</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-2 if no limit (using //), otherwise the depth, and -1 in case of error</td></tr></tbody></table></div><h3><a name="xmlPatternStreamable" id="xmlPatternStreamable"></a>Function: xmlPatternStreamable</h3><pre class="programlisting">int xmlPatternStreamable (<a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> comp)<br />
</pre><p>Check if the pattern is streamable i.e. xmlPatternGetStreamCtxt() should work.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>comp</tt></i>:</span></td><td>the precompiled pattern</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>1 if streamable, 0 if not and -1 in case of error.</td></tr></tbody></table></div><h3><a name="xmlPatterncompile" id="xmlPatterncompile"></a>Function: xmlPatterncompile</h3><pre class="programlisting"><a href="libxml-pattern.html#xmlPatternPtr">xmlPatternPtr</a> xmlPatterncompile (const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * pattern, <br /> <a href="libxml-dict.html#xmlDict">xmlDict</a> * dict, <br /> int flags, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> ** namespaces)<br />
</pre><p>Compile a pattern.</p>
-<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pattern</tt></i>:</span></td><td>the pattern to compile</td></tr><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>an optional dictionnary for interned strings</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>compilation flags, undefined yet</td></tr><tr><td><span class="term"><i><tt>namespaces</tt></i>:</span></td><td>the prefix definitions, array of [URI, prefix] or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the compiled for of the pattern or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlStreamPop" id="xmlStreamPop"></a>Function: xmlStreamPop</h3><pre class="programlisting">int xmlStreamPop (<a href="libxml-pattern.html#xmlStreamCtxtPtr">xmlStreamCtxtPtr</a> stream)<br />
+<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>pattern</tt></i>:</span></td><td>the pattern to compile</td></tr><tr><td><span class="term"><i><tt>dict</tt></i>:</span></td><td>an optional dictionary for interned strings</td></tr><tr><td><span class="term"><i><tt>flags</tt></i>:</span></td><td>compilation flags, undefined yet</td></tr><tr><td><span class="term"><i><tt>namespaces</tt></i>:</span></td><td>the prefix definitions, array of [URI, prefix] or NULL</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>the compiled form of the pattern or NULL in case of error</td></tr></tbody></table></div><h3><a name="xmlStreamPop" id="xmlStreamPop"></a>Function: xmlStreamPop</h3><pre class="programlisting">int xmlStreamPop (<a href="libxml-pattern.html#xmlStreamCtxtPtr">xmlStreamCtxtPtr</a> stream)<br />
</pre><p>push one level from the stream.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>the stream context</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 0 otherwise.</td></tr></tbody></table></div><h3><a name="xmlStreamPush" id="xmlStreamPush"></a>Function: xmlStreamPush</h3><pre class="programlisting">int xmlStreamPush (<a href="libxml-pattern.html#xmlStreamCtxtPtr">xmlStreamCtxtPtr</a> stream, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * ns)<br />
-</pre><p>push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionnary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</p>
+</pre><p>Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>the stream context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the current name</td></tr><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>the namespace name</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.</td></tr></tbody></table></div><h3><a name="xmlStreamPushAttr" id="xmlStreamPushAttr"></a>Function: xmlStreamPushAttr</h3><pre class="programlisting">int xmlStreamPushAttr (<a href="libxml-pattern.html#xmlStreamCtxtPtr">xmlStreamCtxtPtr</a> stream, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * name, <br /> const <a href="libxml-xmlstring.html#xmlChar">xmlChar</a> * ns)<br />
-</pre><p>push new <a href="libxml-SAX.html#attribute">attribute</a> data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionnary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</p>
+</pre><p>Push new <a href="libxml-SAX.html#attribute">attribute</a> data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</p>
<div class="variablelist"><table border="0"><col align="left" /><tbody><tr><td><span class="term"><i><tt>stream</tt></i>:</span></td><td>the stream context</td></tr><tr><td><span class="term"><i><tt>name</tt></i>:</span></td><td>the current name</td></tr><tr><td><span class="term"><i><tt>ns</tt></i>:</span></td><td>the namespace name</td></tr><tr><td><span class="term"><i><tt>Returns</tt></i>:</span></td><td>-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.</td></tr></tbody></table></div><p><a href="../bugs.html">Daniel Veillard</a></p></td></tr></table></td></tr></table></td></tr></table></td></tr></table></td></tr></table></body></html>
diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml
index 1cf70684..16f7437b 100644
--- a/doc/libxml2-api.xml
+++ b/doc/libxml2-api.xml
@@ -11618,7 +11618,7 @@ actually an xmlCharEncoding'/>
</function>
<function name='xmlPatternMatch' file='pattern' module='pattern'>
<cond>defined(LIBXML_PATTERN_ENABLED)</cond>
- <info>Test wether the node matches the pattern</info>
+ <info>Test whether the node matches the pattern</info>
<return type='int' info='1 if it matches, 0 if it doesn&apos;t and -1 in case of failure'/>
<arg name='comp' type='xmlPatternPtr' info='the precompiled pattern'/>
<arg name='node' type='xmlNodePtr' info='a node'/>
@@ -11638,9 +11638,9 @@ actually an xmlCharEncoding'/>
<function name='xmlPatterncompile' file='pattern' module='pattern'>
<cond>defined(LIBXML_PATTERN_ENABLED)</cond>
<info>Compile a pattern.</info>
- <return type='xmlPatternPtr' info='the compiled for of the pattern or NULL in case of error'/>
+ <return type='xmlPatternPtr' info='the compiled form of the pattern or NULL in case of error'/>
<arg name='pattern' type='const xmlChar *' info='the pattern to compile'/>
- <arg name='dict' type='xmlDict *' info='an optional dictionnary for interned strings'/>
+ <arg name='dict' type='xmlDict *' info='an optional dictionary for interned strings'/>
<arg name='flags' type='int' info='compilation flags, undefined yet'/>
<arg name='namespaces' type='const xmlChar **' info='the prefix definitions, array of [URI, prefix] or NULL'/>
</function>
@@ -13388,7 +13388,7 @@ actually an xmlCharEncoding'/>
</function>
<function name='xmlStreamPush' file='pattern' module='pattern'>
<cond>defined(LIBXML_PATTERN_ENABLED)</cond>
- <info>push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionnary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</info>
+ <info>Push new data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</info>
<return type='int' info='-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.'/>
<arg name='stream' type='xmlStreamCtxtPtr' info='the stream context'/>
<arg name='name' type='const xmlChar *' info='the current name'/>
@@ -13396,7 +13396,7 @@ actually an xmlCharEncoding'/>
</function>
<function name='xmlStreamPushAttr' file='pattern' module='pattern'>
<cond>defined(LIBXML_PATTERN_ENABLED)</cond>
- <info>push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionnary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</info>
+ <info>Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile() indicated a dictionary, then strings for name and ns will be expected to come from the dictionary. Both @name and @ns being NULL means the / i.e. the root of the document. This can also act as a reset.</info>
<return type='int' info='-1 in case of error, 1 if the current state in the stream is a match and 0 otherwise.'/>
<arg name='stream' type='xmlStreamCtxtPtr' info='the stream context'/>
<arg name='name' type='const xmlChar *' info='the current name'/>
diff --git a/doc/libxml2-refs.xml b/doc/libxml2-refs.xml
index e8ce4743..93b13288 100644
--- a/doc/libxml2-refs.xml
+++ b/doc/libxml2-refs.xml
@@ -16062,6 +16062,8 @@
<ref name='xmlRegExecPushString'/>
<ref name='xmlRegExecPushString2'/>
<ref name='xmlRelaxNGValidatePushElement'/>
+ <ref name='xmlStreamPush'/>
+ <ref name='xmlStreamPushAttr'/>
<ref name='xmlValidatePushElement'/>
</word>
<word name='Pushes'>
@@ -20160,6 +20162,7 @@
<ref name='xmlDictCreateSub'/>
<ref name='xmlDictReference'/>
<ref name='xmlHashCreateDict'/>
+ <ref name='xmlPatterncompile'/>
<ref name='xmlStreamPush'/>
<ref name='xmlStreamPushAttr'/>
</word>
@@ -20175,9 +20178,6 @@
<ref name='xmlDictQLookup'/>
<ref name='xmlDictReference'/>
<ref name='xmlDictSize'/>
- <ref name='xmlPatterncompile'/>
- <ref name='xmlStreamPush'/>
- <ref name='xmlStreamPushAttr'/>
</word>
<word name='did'>
<ref name='XML_SCHEMAS_TYPE_BLOCK_DEFAULT'/>
@@ -21412,6 +21412,7 @@
<ref name='htmlSAXParseFile'/>
<ref name='xmlNodeListGetRawString'/>
<ref name='xmlNodeListGetString'/>
+ <ref name='xmlPatterncompile'/>
<ref name='xmlXPathStringFunction'/>
</word>
<word name='formatted'>
@@ -25194,8 +25195,6 @@
<ref name='xmlCtxtResetPush'/>
<ref name='xmlParserInputBufferPush'/>
<ref name='xmlStreamPop'/>
- <ref name='xmlStreamPush'/>
- <ref name='xmlStreamPushAttr'/>
<ref name='xmlXPathEvalExpr'/>
</word>
<word name='pushed'>
@@ -28257,7 +28256,6 @@
</word>
<word name='wether'>
<ref name='_xmlNodeSet'/>
- <ref name='xmlPatternMatch'/>
</word>
<word name='what'>
<ref name='xmlCatalogGetDefaults'/>
diff --git a/pattern.c b/pattern.c
index ca0580fc..fdd9f162 100644
--- a/pattern.c
+++ b/pattern.c
@@ -61,7 +61,7 @@ struct _xmlStreamStep {
typedef struct _xmlStreamComp xmlStreamComp;
typedef xmlStreamComp *xmlStreamCompPtr;
struct _xmlStreamComp {
- xmlDict *dict; /* the dictionnary if any */
+ xmlDict *dict; /* the dictionary if any */
int nbStep; /* number of steps in the automata */
int maxStep; /* allocated number of steps */
xmlStreamStepPtr steps; /* the array of steps */
@@ -70,8 +70,8 @@ struct _xmlStreamComp {
struct _xmlStreamCtxt {
struct _xmlStreamCtxt *next;/* link to next sub pattern if | */
xmlStreamCompPtr comp; /* the compiled stream */
- int nbState; /* number of state in the automata */
- int maxState; /* allocated number of state */
+ int nbState; /* number of states in the automata */
+ int maxState; /* allocated number of states */
int level; /* how deep are we ? */
int *states; /* the array of step indexes */
int flags; /* validation options */
@@ -124,7 +124,7 @@ struct _xmlStepOp {
struct _xmlPattern {
void *data; /* the associated template */
- xmlDictPtr dict; /* the optional dictionnary */
+ xmlDictPtr dict; /* the optional dictionary */
struct _xmlPattern *next; /* next pattern if | is used */
const xmlChar *pattern; /* the pattern */
@@ -141,7 +141,7 @@ struct _xmlPatParserContext {
const xmlChar *cur; /* the current char being parsed */
const xmlChar *base; /* the full expression */
int error; /* error code */
- xmlDictPtr dict; /* the dictionnary if any */
+ xmlDictPtr dict; /* the dictionary if any */
xmlPatternPtr comp; /* the result */
xmlNodePtr elem; /* the current node if any */
const xmlChar **namespaces; /* the namespaces definitions */
@@ -242,7 +242,7 @@ xmlFreePatternList(xmlPatternPtr comp) {
/**
* xmlNewPatParserContext:
* @pattern: the pattern context
- * @dict: the inherited dictionnary or NULL
+ * @dict: the inherited dictionary or NULL
* @namespaces: the prefix definitions, array of [URI, prefix] terminated
* with [NULL, NULL] or NULL if no namespace is used
*
@@ -300,7 +300,7 @@ xmlFreePatParserContext(xmlPatParserContextPtr ctxt) {
* @value: the first value
* @value2: the second value
*
- * Add an step to an XSLT Compiled Match
+ * Add a step to an XSLT Compiled Match
*
* Returns -1 in case of failure, 0 otherwise.
*/
@@ -451,7 +451,7 @@ xmlPatPushState(xmlStepStates *states, int step, xmlNodePtr node) {
* @comp: the precompiled pattern
* @node: a node
*
- * Test wether the node matches the pattern
+ * Test whether the node matches the pattern
*
* Returns 1 if it matches, 0 if it doesn't and -1 in case of failure
*/
@@ -1139,7 +1139,7 @@ xmlCompilePathPattern(xmlPatParserContextPtr ctxt) {
NEXT;
xmlCompileAttributeTest(ctxt);
SKIP_BLANKS;
- if ((CUR != 0) || (CUR == '|')) {
+ if (CUR != 0) {
xmlCompileStepPattern(ctxt);
}
} else {
@@ -1150,7 +1150,7 @@ xmlCompilePathPattern(xmlPatParserContextPtr ctxt) {
xmlCompileStepPattern(ctxt);
SKIP_BLANKS;
while (CUR == '/') {
- if ((CUR == '/') && (NXT(1) == '/')) {
+ if (NXT(1) == '/') {
PUSH(XML_OP_ANCESTOR, NULL, NULL);
NEXT;
NEXT;
@@ -1160,7 +1160,7 @@ xmlCompilePathPattern(xmlPatParserContextPtr ctxt) {
PUSH(XML_OP_PARENT, NULL, NULL);
NEXT;
SKIP_BLANKS;
- if ((CUR != 0) || (CUR == '|')) {
+ if (CUR != 0) {
xmlCompileStepPattern(ctxt);
}
}
@@ -1538,8 +1538,8 @@ xmlStreamCtxtAddState(xmlStreamCtxtPtr comp, int idx, int level) {
* @ns: the namespace name
* @nodeType: the type of the node
*
- * push new data onto the stream. NOTE: if the call xmlPatterncompile()
- * indicated a dictionnary, then strings for name and ns will be expected
+ * Push new data onto the stream. NOTE: if the call xmlPatterncompile()
+ * indicated a dictionary, then strings for name and ns will be expected
* to come from the dictionary.
* Both @name and @ns being NULL means the / i.e. the root of the document.
* This can also act as a reset.
@@ -1571,8 +1571,6 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
err++;
if (comp->nbStep == 0)
ret = 1;
- stream = stream->next;
- continue; /* while */
}
stream = stream->next;
continue; /* while */
@@ -1595,6 +1593,17 @@ xmlStreamPushInternal(xmlStreamCtxtPtr stream,
stream->level++;
goto stream_next;
}
+ tmp = stream->level;
+ for (i = 0; i < comp->nbStep; i++) {
+ if (comp->steps[i].flags & XML_STREAM_STEP_DESC) {
+ tmp = -2;
+ break;
+ }
+ }
+ if (comp->nbStep < tmp) {
+ stream->level++;
+ goto stream_next;
+ }
/*
* Check evolution of existing states
@@ -1773,8 +1782,8 @@ stream_next:
* @name: the current name
* @ns: the namespace name
*
- * push new data onto the stream. NOTE: if the call xmlPatterncompile()
- * indicated a dictionnary, then strings for name and ns will be expected
+ * Push new data onto the stream. NOTE: if the call xmlPatterncompile()
+ * indicated a dictionary, then strings for name and ns will be expected
* to come from the dictionary.
* Both @name and @ns being NULL means the / i.e. the root of the document.
* This can also act as a reset.
@@ -1794,8 +1803,8 @@ xmlStreamPush(xmlStreamCtxtPtr stream,
* @name: the current name
* @ns: the namespace name
*
-* push new attribute data onto the stream. NOTE: if the call xmlPatterncompile()
-* indicated a dictionnary, then strings for name and ns will be expected
+* Push new attribute data onto the stream. NOTE: if the call xmlPatterncompile()
+* indicated a dictionary, then strings for name and ns will be expected
* to come from the dictionary.
* Both @name and @ns being NULL means the / i.e. the root of the document.
* This can also act as a reset.
@@ -1854,13 +1863,13 @@ xmlStreamPop(xmlStreamCtxtPtr stream) {
/**
* xmlPatterncompile:
* @pattern: the pattern to compile
- * @dict: an optional dictionnary for interned strings
+ * @dict: an optional dictionary for interned strings
* @flags: compilation flags, undefined yet
* @namespaces: the prefix definitions, array of [URI, prefix] or NULL
*
* Compile a pattern.
*
- * Returns the compiled for of the pattern or NULL in case of error
+ * Returns the compiled form of the pattern or NULL in case of error
*/
xmlPatternPtr
xmlPatterncompile(const xmlChar *pattern, xmlDict *dict,
@@ -1906,6 +1915,7 @@ xmlPatterncompile(const xmlChar *pattern, xmlDict *dict,
if (ctxt->error != 0)
goto error;
xmlFreePatParserContext(ctxt);
+ ctxt = NULL;
if (streamable) {
@@ -1923,10 +1933,8 @@ xmlPatterncompile(const xmlChar *pattern, xmlDict *dict,
xmlStreamCompile(cur);
if (xmlReversePattern(cur) < 0)
goto error;
- if (tmp != NULL) {
+ if (tmp != NULL)
xmlFree(tmp);
- tmp = NULL;
- }
start = or;
}
if (streamable == 0) {
@@ -1953,7 +1961,7 @@ error:
* @comp: the precompiled pattern
* @node: a node
*
- * Test wether the node matches the pattern
+ * Test whether the node matches the pattern
*
* Returns 1 if it matches, 0 if it doesn't and -1 in case of failure
*/
diff --git a/xpath.c b/xpath.c
index 862ff535..8ee08052 100644
--- a/xpath.c
+++ b/xpath.c
@@ -11080,6 +11080,12 @@ next_node:
}
if ((cur->children == NULL) || (depth >= max_depth)) {
ret = xmlStreamPop(patstream);
+ while (cur->next != NULL) {
+ cur = cur->next;
+ if ((cur->type != XML_ENTITY_DECL) &&
+ (cur->type != XML_DTD_NODE))
+ goto next_node;
+ }
}
}
@@ -11110,11 +11116,12 @@ scan_children:
}
do {
- ret = xmlStreamPop(patstream);
cur = cur->parent;
depth--;
if ((cur == NULL) || (cur == limit))
goto done;
+ if (cur->type == XML_ELEMENT_NODE)
+ ret = xmlStreamPop(patstream);
if (cur->next != NULL) {
cur = cur->next;
break;