Expand description
XPath parser context and value stack (§25, 11.1-I XPath family closure).
Upstream libxml2 exposes xmlXPathParserContextPtr (a fully public struct
in the headers) together with a value stack (xmlXPathPush* /
xmlXPathPop*) and stack-based value operators (xmlXPathAddValues etc.).
§UPSTREAM-PARITY (field layout)
The candidate struct layout mirrors the upstream _xmlXPathParserContext
field-for-field (see include/libxml/xpath.h and upstream xpath.h):
struct _xmlXPathParserContext {
const xmlChar *cur; /* the current char being parsed */
const xmlChar *base; /* the full expression */
int error; /* error code */
xmlXPathContext *context;/* the evaluation context */
xmlXPathObject *value; /* the current value */
int valueNr; /* number of values stacked */
int valueMax; /* max number of values stacked */
xmlXPathObject **valueTab;/* stack of values */
xmlXPathCompExpr *comp; /* the precompiled expression */
int xptr; /* it this an XPointer expression */
xmlNode *ancestor; /* used for walking preceding axis */
int valueFrame; /* always zero for compatibility */
};The XPATH-001 differential court verifies the stack operators and the parser-context APIs against the oracle.
Structs§
- XmlX
Path Parser Context - The public
xmlXPathParserContext(layout mirrors upstream xpath.h).
Functions§
- binary_
number_ ⚠op - Pop two number operands from the stack and apply
op. - cast_
top_ ⚠to_ number - Number → number conversion of the top-of-stack object, in place
(upstream
CAST_TO_NUMBER): the object’s type becomes XPATH_NUMBER andfloatvalholds the converted value. A NULL top (or a USERS object) reports XPATH_INVALID_OPERAND. - compare_
values_ ⚠impl - Pop two objects and compare with
<,<=,>,>=(upstreamxmlXPathCompareValueswith theinf/strictencoding). - equal_
values_ ⚠impl - Pop two objects and compare for equality (upstream xmlXPathEqualValues / xmlXPathNotEqualValues semantics): pushes the boolean result object and returns the comparison value.
- equal_
values_ inner - Full XPath 1.0 equality matrix (§3.4) matching upstream 2.15
xmlXPathEqualValues/xmlXPathNotEqualValues(including the node-set pair/string/number/boolean special cases). - free_
parser_ ⚠context - Free a parser context.
- new_
bool ⚠ - Build a boolean object.
- new_
number ⚠ - Build a number object.
- new_
parser_ ⚠context - Create a new parser context over
strwith the given evaluation context. - new_
string ⚠ - Build a string object (copies the value).
- pc_
set_ ⚠error - Set the parser-context error code (upstream
xmlXPathSetError/XP_ERROR). - pop_
boolean ⚠ - Pop a boolean.
- pop_
external ⚠ - Pop an external (user) pointer.
- pop_
node_ ⚠set - Pop a node set (freshly allocated; caller frees with xmlXPathFreeNodeSet).
- pop_
number ⚠ - Pop a number (upstream
xmlXPathPopNumber): converts the top of the stack to a number, frees it, returns the value. - pop_
string ⚠ - Pop a string (freshly allocated; caller frees with xmlFree).
- value_
pop ⚠ - Pop a value object from the stack (upstream
valuePop). - value_
push ⚠ - Push a value object onto the stack (upstream
valuePush). - value_
to_ ⚠object - Convert an internal value to a C object.