API for the XML Path Language implementation XML Path Language implementation XPath is a language for addressing parts of an XML document, designed to be used by both XSLT and XPointer
Implements a functionality similar to the DOM NodeList.item(). Returns the xmlNodePtr at the given @index in @ns or NULL if @index is out of range (0 to length-1)
struct _xmlNodeSet {
+ int nodeNr : number of nodes in the set
+ int nodeMax : size of the array as allocated
+ xmlNodePtr * nodeTab : array of nodes in no particular order @@ with_ns to check wether name
+} xmlNodeSet;
+
struct _xmlXPathContext {
+ xmlDocPtr doc : The current document
+ xmlNodePtr node : The current node
+ int nb_variables_unused : unused (hash table)
+ int max_variables_unused : unused (hash table)
+ xmlHashTablePtr varHash : Hash table of defined variables
+ int nb_types : number of defined types
+ int max_types : max number of types
+ xmlXPathTypePtr types : Array of defined types
+ int nb_funcs_unused : unused (hash table)
+ int max_funcs_unused : unused (hash table)
+ xmlHashTablePtr funcHash : Hash table of defined funcs
+ int nb_axis : number of defined axis
+ int max_axis : max number of axis
+ xmlXPathAxisPtr axis : Array of defined axis the namespace nodes of the context node
+ xmlNsPtr * namespaces : Array of namespaces
+ int nsNr : number of namespace in scope
+ void * user : function to free extra variables
+ int contextSize : the context size
+ int proximityPosition : the proximity position extra stuff for XPointer
+ int xptr : it this an XPointer context
+ xmlNodePtr here : for here()
+ xmlNodePtr origin : for origin() the set of namespace declarations in scope for the expre
+ xmlHashTablePtr nsHash : The namespaces hash table
+ xmlXPathVariableLookupFunc varLookupFunc : variable lookup func
+ void * varLookupData : variable lookup data Possibility to link in an extra item
+ void * extra : needed for XSLT The function name and URI when calling a function
+ const xmlChar * function
+ const xmlChar * functionURI : function lookup function and data
+ xmlXPathFuncLookupFunc funcLookupFunc : function lookup func
+ void * funcLookupData : function lookup data temporary namespace lists kept for walking the n
+ xmlNsPtr * tmpNsList : Array of namespaces
+ int tmpNsNr : number of namespace in scope error reporting mechanism
+ void * userData : user specific data block
+ xmlStructuredErrorFunc error : the callback in case of errors
+ xmlError lastError : the last error
+ xmlNodePtr debugNode : the source node XSLT dictionnary
+ xmlDictPtr dict : dictionnary if any
+ int flags : flags to control compilation
+} xmlXPathContext;
+
struct _xmlXPathParserContext {
+ const xmlChar * cur : the current char being parsed
+ const xmlChar * base : the full expression
+ int error : error code
+ xmlXPathContextPtr context : the evaluation context
+ xmlXPathObjectPtr value : the current value
+ int valueNr : number of values stacked
+ int valueMax : max number of values stacked
+ xmlXPathObjectPtr * valueTab : stack of values
+ xmlXPathCompExprPtr comp : the precompiled expression
+ int xptr : it this an XPointer expression
+ xmlNodePtr ancestor : used for walking preceding axis
+} xmlXPathParserContext;
+
An axis traversal function. To traverse an axis, the engine calls the first time with cur == NULL and repeat until the function returns NULL indicating the end of the axis traversal.
+
ctxt:
the XPath interpreter context
cur:
the previous node being explored on that axis
Returns:
the next node in that axis or NULL if at the end of the axis.
Evaluate a predicate result for the current node. A PredicateExpr is evaluated by evaluating the Expr and converting the result to a boolean. If the result is a number, the result will be converted to true if the number is equal to the position of the context node in the context node list (as returned by the position function) and will be converted to false otherwise; if the result is not a number, then the result will be converted as if by a call to the boolean function.
Call this routine to speed up XPath computation on static documents. This stamps all the element nodes with the document order Like for line information, the order is kept in the element->content field, the value stored is actually - the node number (starting at -1) to be able to differentiate from line numbers.
+
doc:
an input document
Returns:
the number of elements found in the document or -1 in case of error.
+
+
+
+
+
--
cgit v1.2.3
From a7e9d3f37d5e9fba4b9acaa43e7c12b6d9a669ae Mon Sep 17 00:00:00 2001
From: Mike Hommey
Date: Thu, 8 Jun 2006 10:59:26 +0200
Subject: Load /tmp/libxml2-2.6.26 into libxml2/branches/upstream/current.
---
ChangeLog | 241 ++
configure | 10 +-
configure.in | 10 +-
doc/APIchunk1.html | 2 +
doc/APIchunk10.html | 1 +
doc/APIchunk12.html | 7 +-
doc/APIchunk13.html | 2 +
doc/APIchunk14.html | 2 +
doc/APIchunk15.html | 2 +
doc/APIchunk17.html | 1 +
doc/APIchunk19.html | 2 +
doc/APIchunk21.html | 5 +-
doc/APIchunk22.html | 1 +
doc/APIchunk23.html | 2 +
doc/APIchunk24.html | 5 +
doc/APIchunk28.html | 1 +
doc/APIchunk5.html | 1 +
doc/APIchunk8.html | 2 +
doc/APIfiles.html | 2 +
doc/APIfunctions.html | 1 +
doc/APIsymbols.html | 2 +
doc/DOM.html | 16 +-
doc/FAQ.html | 333 ++-
doc/XMLinfo.html | 33 +-
doc/XSLT.html | 9 +-
doc/architecture.html | 7 +-
doc/bugs.html | 118 +-
doc/catalog.html | 324 ++-
doc/contribs.html | 53 +-
doc/devhelp/libxml2-xmlerror.html | 1 +
doc/devhelp/libxml2-xpath.html | 8 +-
doc/devhelp/libxml2.devhelp | 2 +
doc/docs.html | 35 +-
doc/downloads.html | 42 +-
doc/encoding.html | 312 +--
doc/entities.html | 74 +-
doc/example.html | 70 +-
doc/help.html | 26 +-
doc/html/libxml-xmlerror.html | 1 +
doc/html/libxml-xpath.html | 8 +-
doc/index.html | 109 +-
doc/interface.html | 35 +-
doc/intro.html | 40 +-
doc/library.html | 137 +-
doc/libxml2-api.xml | 15 +-
doc/libxml2.xsa | 49 +-
doc/namespaces.html | 70 +-
doc/news.html | 1688 +++++++------
doc/python.html | 247 +-
doc/threads.html | 23 +-
doc/tree.html | 32 +-
doc/upgrade.html | 188 +-
doc/xml.html | 5011 +++++++++++++++++++------------------
doc/xmldtd.html | 154 +-
doc/xmlio.html | 123 +-
doc/xmlmem.html | 166 +-
encoding.c | 3 +-
include/libxml/xmlerror.h | 1 +
include/libxml/xmlversion.h | 10 +-
include/libxml/xpath.h | 13 +-
libxml.h | 7 +
libxml.spec.in | 51 +-
libxml2.spec | 57 +-
pattern.c | 210 +-
python/libxml2-py.c | 21 +
python/setup.py | 2 +-
relaxng.c | 2 +-
runsuite.c | 11 +-
testapi.c | 58 +-
tree.c | 7 -
triodef.h | 4 +-
xinclude.c | 2 +-
xmlIO.c | 7 +-
xmlschemas.c | 97 +-
xpath.c | 3580 ++++++++++++++++++++++----
75 files changed, 8538 insertions(+), 5466 deletions(-)
(limited to 'doc/devhelp/libxml2-xpath.html')
diff --git a/ChangeLog b/ChangeLog
index 7ef389d..f6b31ef 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,244 @@
+Tue Jun 6 17:50:43 CEST 2006 Daniel Veillard
+
+ * configure.ini NEWS doc//* libxml.spec.in : preparing release of 2.6.26
+
+Tue Jun 6 17:25:23 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Fixed self-invented a segfault in xmlXPathCtxtCompile(),
+ when the expression was not valid and @comp was NULL and I
+ tried to do the d-o-s rewrite.
+
+Tue Jun 6 15:19:57 CEST 2006 Daniel Veillard
+
+ * configure.ini NEWS doc//* libxml.spec.in : preparing release of 2.6.25
+
+Tue Jun 6 11:28:15 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Enabled the compound traversal again; I added a
+ check to use this only if the have an expression starting
+ with the document node; so in the case of "//foo", we
+ already know at compilation-time, that there will be only
+ 1 initial context node. Added the rewrite also to
+ xmlXPathEvalExpr().
+
+Tue Jun 6 10:23:10 CEST 2006 Daniel Veillard
+
+ * xinclude.c: fix bug #343968, include='text' can't lead to a
+ recursion.
+
+Fri Jun 2 22:47:08 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Disabled the compound traversal for the release;
+ I need first to assure that this is done only if we have
+ 1 initial node.
+
+Wed May 31 13:53:41 PST 2006 Aleksey Sanin
+
+ * xpath.c: fixed memory leak in xpath error reporting
+
+Wed May 31 15:30:16 CEST 2006 Daniel Veillard
+
+ * libxml.h triodef.h: applied patch from Olli Savia for LynxOS
+
+Wed May 31 14:33:00 CEST 2006 Kasimier Buchcik
+
+ * xpath.c include/libxml/xpath.h runsuite.c:
+ Changed the name of the recently added public function
+ xmlXPathContextSetObjectCache() to
+ xmlXPathContextSetCache(); so a more generic one, in
+ case we decide to cache more things than only XPath
+ objects.
+
+Tue May 30 21:36:16 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Optimized xmlXPathNodeCollectAndTest() and
+ xmlXPathNodeCollectAndTestNth() to evaluate a compound
+ traversal of 2 axes when we have a "//foo" expression.
+ This is done with a rewrite of the XPath AST in
+ xmlXPathRewriteDOSExpression(); I added an additional field
+ to xmlXPathStepOp for this (but the field's name should be
+ changed). The mechanism: the embracing descendant-or-self
+ axis traversal (also optimized to return only nodes which
+ can hold elements), will produce context nodes for the
+ inner traversal of the child axis. This way we avoid a full
+ node-collecting traversal of the descendant-or-self axis.
+ Some tests indicate that this can reduce execution time of
+ "//foo" to 50%. Together with the XPath object cache this
+ all significantly speeds up libxslt.
+
+Tue May 30 11:38:47 CEST 2006 Kasimier Buchcik
+
+ * xmlschemas.c: A warning will now be reported in the value of
+ the XSD attribute 'schemaLocation' does not consist of tuples
+ (namespace-name, document-URI). A warning will be reported
+ if a schema document could not be found at the specified
+ location (via 'schemaLocation' or
+ 'noNamespaceSchemaLocation').
+ * include/libxml/xmlerror.h: Added XML_SCHEMAV_MISC to
+ xmlParserErrors.
+
+Tue May 30 11:21:34 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Enhanced xmlXPathNodeCollectAndTest() to avoid
+ recreation (if possible) of the node-set which is used to
+ collect the nodes in the current axis for the currect context
+ node. Especially for "//foo" this will decrease dramatically
+ the number of created node-sets, since for each node in the
+ result node-set of the evaluation of descendant-or-self::node()
+ a new temporary node-set was created. Added node iterator
+ xmlXPathNextChildElement() as a tiny optimization for
+ child::foo.
+
+Mon May 29 18:06:17 CEST 2006 Kasimier Buchcik
+
+ * xpath.c include/libxml/xpath.h: Added an XPath object cache.
+ It sits on an xmlXPathContext and need to be explicitely
+ activated (or deactivated again) with
+ xmlXPathContextSetObjectCache(). The cache consists of 5
+ lists for node-set, string, number, boolean and misc XPath
+ objects. Internally the xpath.c module will use object-
+ deposition and -acquisition functions which will try to reuse
+ as many XPath objects as possible, and fallback to normal
+ free/create behaviour if no cache is available or if the cache
+ is full.
+ * runsuite.c: Adjusted to deactivate the cache for XML Schema
+ tests if a cache-creation is turned on by default for the whole
+ library, e.g. for testing purposes of the cache. It is
+ deactivated here in order to avoid confusion of the memory leak
+ detection in runsuite.c.
+
+Wed May 24 10:54:25 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Removed a memcpy if xmlXPathNodeSetMerge(); it
+ seems we really need to walk the whole list, since those
+ nastly namespace nodes need to be added with
+ xmlXPathNodeSetDupNs(); thus a pure memcpy is not possible.
+ A flag on the node-set indicating if namespace nodes are in
+ the set would help here; this is the 3rd flag which would
+ be usefull with node-sets. The current flags I have in mind:
+ 1) Is a node-set already sorted?
+ This would allow for rebust and optimizable sorting
+ behaviour.
+ 2) Of what type are the nodes in the set (or of mixed type)?
+ This would allow for faster merging of node-sets.
+ 3) Are namespace nodes in the set?
+ This would allow to skipp all the namespace node specific
+ special handling. Faster node-set merging if the first
+ set is empty; just memcpy the set.
+
+Mon May 22 17:14:00 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Optimization of count(): eliminated sorting
+ (see bug #165547). Optimization of XPATH_OP_FILTER if the
+ predicate is a [1] (disable with XP_OPTIMIZED_FILTER_FIRST if
+ it produces trouble). Tiny opt in xmlXPathNodeSetMerge().
+
+Mon May 22 13:33:12 CEST 2006 Rob Richards
+
+ * tree.c: Revert behavior change in xmlSetProp to handle attributes
+ with colons in name and no namespace.
+
+Fri May 19 21:56:43 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Substituted all remaining calls to xmlXPathCmpNodes()
+ for xmlXPathCmpNodesExt(). Tiny further enhancement of
+ xmlXPathCmpNodesExt(). Added additional checks in various code
+ parts to avoid calling sorting or merging functions if the
+ node-set(s) don't need them; i.e., if they are empty or contain
+ just one node.
+
+Fri May 19 13:16:58 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Optimized the comparison for non-element nodes
+ in xmlXPathCmpNodesExt(); the comparison is used for sorting
+ of node-sets. This enhancement is related to bug #165547.
+ There are other places where the old comparison function
+ xmlXPathCmpNodes() is still called, but I currently don't
+ know exactly what those calls are for; thus if they can be
+ substituted (if it makes sense) for the new function.
+
+Tue May 16 16:55:13 CEST 2006 Kasimier Buchcik
+
+ * xpath.c: Applied patch from Rob Richards, fixing a potential
+ memory leak in xmlXPathTryStreamCompile(), when a list of
+ namespaces was assigned to the XPath compilation context;
+ here a new namespace list was created and passed to
+ xmlPatterncompile(); but this list was not freed afterwards.
+ Additionally we avoid now in xmlXPathTryStreamCompile() to
+ compile the expression, if it has a colon - indicating
+ prefixed name tests - and no namespace list was given. The
+ streaming XPath mechanism needs a namespace list at
+ compilation time (unlike normal XPath, where we can bind
+ namespace names to prefixes at execution time).
+ * pattern.c: Enhanced to use a string dict for local-names,
+ ns-prefixes and and namespace-names.
+ Fixed xmlStreamPushInternal() not to use string-pointer
+ comparison if a dict is available; this won't work, since
+ one does not know it the given strings originate from the
+ same dict - and they normally don't do, since e.g.
+ namespaces are hold on xmlNs->href. I think this would be
+ worth an investigation: if we can add a @doc field to xmlNs
+ and put the @href in to a additionan namespace dict hold
+ in xmlDoc. Daniel will surely not like this idea :-) But
+ evaluation of tons of elements/attributes in namespaces
+ with xmlStrEqual() isn't the way we should go forever.
+
+Thu May 11 18:03:49 CEST 2006 Kasimier Buchcik
+
+ * xmlschemas.c: Fixed bug #341337, reported by David Grohmann.
+ The code expected a node (xmlNodePtr) on the info for a
+ non-existent default attribute, which clearly cannot be
+ expected, since the attribute does not exist. I can only
+ guess that this sneaked trying to eliminate the query
+ for the owner-element, which is unavoidable actually.
+ Note that creation of default attributes won't have an
+ effect if validating via SAX/XMLReader; i.e., the processor
+ won't fire additional start-attribute events (I'm not even
+ sure if Libxml2 has such a SAX-event; I think it hands them
+ all over in the start-element event).
+
+Tue May 9 21:47:58 CEST 2006 Kasimier Buchcik
+
+ * xmlschemas.c: Fixed bug #341150, reported by Michael Romer.
+ In xmlSchemaBuildContentModelForSubstGroup(),
+ xmlAutomataNewOnceTrans2() was incorrectly used instead of
+ xmlAutomataNewTransition2() to mimic a xs:choice for
+ substitution-groups.
+ * test/schemas/subst-group-1_1.xsd
+ test/schemas/subst-group-1_0.xml
+ result/schemas/subst-group-1_0_1
+ result/schemas/subst-group-1_0_1.err: Added regression test
+ supplied by Michael Romer for bug #341150.
+
+Sat May 6 11:05:24 HKT 2006 William M. Brack
+
+ * relaxng.c: Fixed compilation error with patch supplied by
+ Graham Bennett.
+
+Thu May 4 19:14:03 CEST 2006 Kasimier Buchcik
+
+ * xmlschemas.c: We'll raise an internal error and stop
+ validation now when an entity is found in the instance
+ document, since we don't support automatic entity
+ substitution by the schema processor (yet?) -
+ see bug #340316, reported by Nick Wellnhofer.
+
+Wed May 3 15:16:00 CEST 2006 Daniel Veillard
+
+ * configure.in: applied another Python detection patch from Joseph Sacco
+ * libxml.spec.in: cleanup the changelog section, asciifies the spec file
+ too
+
+Tue May 2 22:34:54 CEST 2006 Daniel Veillard
+
+ * xmlIO.c: fix a mix of code and declarations showing up on Windows
+ patch from Kjartan Maraas, fixing #340404
+
+Tue May 2 14:24:40 CEST 2006 Daniel Veillard
+
+ * encoding.c: fixing bug #340398 xmlCharEncOutFunc writing to
+ input buffer
+
Fri Apr 28 18:29:22 CEST 2006 Daniel Veillard
* NEWS configure.in doc//*: preparing 2.6.24 release, fixed Python
diff --git a/configure b/configure
index f0dc765..5bf44bb 100755
--- a/configure
+++ b/configure
@@ -1618,7 +1618,7 @@ host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=6
-LIBXML_MICRO_VERSION=24
+LIBXML_MICRO_VERSION=26
LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -26935,17 +26935,17 @@ fi
-d $with_python/lib/python$PYTHON_VERSION/site-packages
then
PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES='$(libdir)/lib/python$(PYTHON_VERSION)/site-packages'
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r $prefix/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r /usr/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
echo could not find python$PYTHON_VERSION/Python.h
fi
@@ -26958,7 +26958,7 @@ fi
fi
if test "$with_python" != ""
then
- pythondir=$(PYTHON_SITE_PACKAGES)
+ pythondir='$(PYTHON_SITE_PACKAGES)'
else
pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
fi
diff --git a/configure.in b/configure.in
index 6951b3d..e01408a 100644
--- a/configure.in
+++ b/configure.in
@@ -5,7 +5,7 @@ AC_CANONICAL_HOST
LIBXML_MAJOR_VERSION=2
LIBXML_MINOR_VERSION=6
-LIBXML_MICRO_VERSION=24
+LIBXML_MICRO_VERSION=26
LIBXML_MICRO_VERSION_SUFFIX=
LIBXML_VERSION=$LIBXML_MAJOR_VERSION.$LIBXML_MINOR_VERSION.$LIBXML_MICRO_VERSION$LIBXML_MICRO_VERSION_SUFFIX
LIBXML_VERSION_INFO=`expr $LIBXML_MAJOR_VERSION + $LIBXML_MINOR_VERSION`:$LIBXML_MICRO_VERSION:$LIBXML_MINOR_VERSION
@@ -678,17 +678,17 @@ if test "$with_python" != "no" ; then
-d $with_python/lib/python$PYTHON_VERSION/site-packages
then
PYTHON_INCLUDES=$with_python/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES='$(libdir)/lib/python$(PYTHON_VERSION)/site-packages'
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r $prefix/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=$prefix/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
if test -r /usr/include/python$PYTHON_VERSION/Python.h
then
PYTHON_INCLUDES=/usr/include/python$PYTHON_VERSION
- PYTHON_SITE_PACKAGES='$(libdir)/python$(PYTHON_VERSION)/site-packages'
+ PYTHON_SITE_PACKAGES=$libdir/python$PYTHON_VERSION/site-packages
else
echo could not find python$PYTHON_VERSION/Python.h
fi
@@ -701,7 +701,7 @@ if test "$with_python" != "no" ; then
fi
if test "$with_python" != ""
then
- pythondir=$(PYTHON_SITE_PACKAGES)
+ pythondir='$(PYTHON_SITE_PACKAGES)'
else
pythondir='$(libdir)/python$(PYTHON_VERSION)/site-packages'
fi
diff --git a/doc/APIchunk1.html b/doc/APIchunk1.html
index ca14e32..7c9ff72 100644
--- a/doc/APIchunk1.html
+++ b/doc/APIchunk1.html
@@ -81,6 +81,7 @@ A:link, A:visited, A:active { text-decoration: underline }
DOM stands for the Document
-Object Model; this is an API for accessing XML or HTML structured
-documents. Native support for DOM in Gnome is on the way (module gnome-dom),
-and will be based on gnome-xml. This will be a far cleaner interface to
-manipulate XML files within Gnome since it won't expose the internal
-structure.
The current DOM implementation on top of libxml2 is the gdome2 Gnome module, this
-is a full DOM interface, thanks to Paolo Casarini, check the Gdome2 homepage for more
-informations.