nokogiri 1.13.0-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of nokogiri might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/Gemfile +5 -0
- data/LICENSE-DEPENDENCIES.md +1903 -0
- data/LICENSE.md +9 -0
- data/README.md +280 -0
- data/bin/nokogiri +131 -0
- data/dependencies.yml +73 -0
- data/ext/nokogiri/depend +38 -0
- data/ext/nokogiri/extconf.rb +1000 -0
- data/ext/nokogiri/gumbo.c +584 -0
- data/ext/nokogiri/html4_document.c +166 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +120 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/include/libexslt/exslt.h +102 -0
- data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
- data/ext/nokogiri/include/libexslt/exsltexports.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/DOCBparser.h +96 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX.h +173 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX2.h +178 -0
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +128 -0
- data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
- data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
- data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/dict.h +79 -0
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +245 -0
- data/ext/nokogiri/include/libxml2/libxml/entities.h +151 -0
- data/ext/nokogiri/include/libxml2/libxml/globals.h +508 -0
- data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
- data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
- data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +163 -0
- data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
- data/ext/nokogiri/include/libxml2/libxml/parser.h +1243 -0
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +644 -0
- data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
- data/ext/nokogiri/include/libxml2/libxml/relaxng.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
- data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
- data/ext/nokogiri/include/libxml2/libxml/threads.h +89 -0
- data/ext/nokogiri/include/libxml2/libxml/tree.h +1311 -0
- data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
- data/ext/nokogiri/include/libxml2/libxml/valid.h +458 -0
- data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
- data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +368 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +946 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +77 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +224 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +151 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +485 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +564 -0
- data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
- data/ext/nokogiri/include/libxml2/libxml/xpointer.h +114 -0
- data/ext/nokogiri/include/libxslt/attributes.h +38 -0
- data/ext/nokogiri/include/libxslt/documents.h +93 -0
- data/ext/nokogiri/include/libxslt/extensions.h +262 -0
- data/ext/nokogiri/include/libxslt/extra.h +72 -0
- data/ext/nokogiri/include/libxslt/functions.h +78 -0
- data/ext/nokogiri/include/libxslt/imports.h +75 -0
- data/ext/nokogiri/include/libxslt/keys.h +53 -0
- data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
- data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
- data/ext/nokogiri/include/libxslt/pattern.h +84 -0
- data/ext/nokogiri/include/libxslt/preproc.h +43 -0
- data/ext/nokogiri/include/libxslt/security.h +104 -0
- data/ext/nokogiri/include/libxslt/templates.h +77 -0
- data/ext/nokogiri/include/libxslt/transform.h +207 -0
- data/ext/nokogiri/include/libxslt/variables.h +118 -0
- data/ext/nokogiri/include/libxslt/xslt.h +110 -0
- data/ext/nokogiri/include/libxslt/xsltInternals.h +1978 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +180 -0
- data/ext/nokogiri/include/libxslt/xsltexports.h +142 -0
- data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
- data/ext/nokogiri/include/libxslt/xsltutils.h +313 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +278 -0
- data/ext/nokogiri/nokogiri.h +223 -0
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +103 -0
- data/ext/nokogiri/xml_attribute_decl.c +70 -0
- data/ext/nokogiri/xml_cdata.c +57 -0
- data/ext/nokogiri/xml_comment.c +62 -0
- data/ext/nokogiri/xml_document.c +680 -0
- data/ext/nokogiri/xml_document_fragment.c +44 -0
- data/ext/nokogiri/xml_dtd.c +208 -0
- data/ext/nokogiri/xml_element_content.c +128 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_encoding_handler.c +104 -0
- data/ext/nokogiri/xml_entity_decl.c +112 -0
- data/ext/nokogiri/xml_entity_reference.c +50 -0
- data/ext/nokogiri/xml_namespace.c +120 -0
- data/ext/nokogiri/xml_node.c +2144 -0
- data/ext/nokogiri/xml_node_set.c +498 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_reader.c +719 -0
- data/ext/nokogiri/xml_relax_ng.c +185 -0
- data/ext/nokogiri/xml_sax_parser.c +310 -0
- data/ext/nokogiri/xml_sax_parser_context.c +281 -0
- data/ext/nokogiri/xml_sax_push_parser.c +168 -0
- data/ext/nokogiri/xml_schema.c +284 -0
- data/ext/nokogiri/xml_syntax_error.c +85 -0
- data/ext/nokogiri/xml_text.c +48 -0
- data/ext/nokogiri/xml_xpath_context.c +406 -0
- data/ext/nokogiri/xslt_stylesheet.c +264 -0
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/lib/nokogiri/2.6/nokogiri.so +0 -0
- data/lib/nokogiri/2.7/nokogiri.so +0 -0
- data/lib/nokogiri/3.0/nokogiri.so +0 -0
- data/lib/nokogiri/3.1/nokogiri.so +0 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +54 -0
- data/lib/nokogiri/css/parser.rb +759 -0
- data/lib/nokogiri/css/parser.y +280 -0
- data/lib/nokogiri/css/parser_extras.rb +94 -0
- data/lib/nokogiri/css/syntax_error.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rb +155 -0
- data/lib/nokogiri/css/tokenizer.rex +56 -0
- data/lib/nokogiri/css/xpath_visitor.rb +359 -0
- data/lib/nokogiri/css.rb +60 -0
- data/lib/nokogiri/decorators/slop.rb +44 -0
- data/lib/nokogiri/extension.rb +31 -0
- data/lib/nokogiri/gumbo.rb +15 -0
- data/lib/nokogiri/html.rb +48 -0
- data/lib/nokogiri/html4/builder.rb +37 -0
- data/lib/nokogiri/html4/document.rb +331 -0
- data/lib/nokogiri/html4/document_fragment.rb +54 -0
- data/lib/nokogiri/html4/element_description.rb +25 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +578 -0
- data/lib/nokogiri/html4/entity_lookup.rb +15 -0
- data/lib/nokogiri/html4/sax/parser.rb +61 -0
- data/lib/nokogiri/html4/sax/parser_context.rb +20 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html4.rb +46 -0
- data/lib/nokogiri/html5/document.rb +88 -0
- data/lib/nokogiri/html5/document_fragment.rb +83 -0
- data/lib/nokogiri/html5/node.rb +96 -0
- data/lib/nokogiri/html5.rb +477 -0
- data/lib/nokogiri/jruby/dependencies.rb +21 -0
- data/lib/nokogiri/syntax_error.rb +6 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +221 -0
- data/lib/nokogiri/version.rb +4 -0
- data/lib/nokogiri/xml/attr.rb +17 -0
- data/lib/nokogiri/xml/attribute_decl.rb +20 -0
- data/lib/nokogiri/xml/builder.rb +485 -0
- data/lib/nokogiri/xml/cdata.rb +13 -0
- data/lib/nokogiri/xml/character_data.rb +9 -0
- data/lib/nokogiri/xml/document.rb +418 -0
- data/lib/nokogiri/xml/document_fragment.rb +162 -0
- data/lib/nokogiri/xml/dtd.rb +34 -0
- data/lib/nokogiri/xml/element_content.rb +38 -0
- data/lib/nokogiri/xml/element_decl.rb +15 -0
- data/lib/nokogiri/xml/entity_decl.rb +21 -0
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +16 -0
- data/lib/nokogiri/xml/node/save_options.rb +65 -0
- data/lib/nokogiri/xml/node.rb +1402 -0
- data/lib/nokogiri/xml/node_set.rb +364 -0
- data/lib/nokogiri/xml/notation.rb +19 -0
- data/lib/nokogiri/xml/parse_options.rb +133 -0
- data/lib/nokogiri/xml/pp/character_data.rb +21 -0
- data/lib/nokogiri/xml/pp/node.rb +55 -0
- data/lib/nokogiri/xml/pp.rb +4 -0
- data/lib/nokogiri/xml/processing_instruction.rb +10 -0
- data/lib/nokogiri/xml/reader.rb +107 -0
- data/lib/nokogiri/xml/relax_ng.rb +38 -0
- data/lib/nokogiri/xml/sax/document.rb +167 -0
- data/lib/nokogiri/xml/sax/parser.rb +125 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +21 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +61 -0
- data/lib/nokogiri/xml/sax.rb +6 -0
- data/lib/nokogiri/xml/schema.rb +73 -0
- data/lib/nokogiri/xml/searchable.rb +259 -0
- data/lib/nokogiri/xml/syntax_error.rb +71 -0
- data/lib/nokogiri/xml/text.rb +11 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +13 -0
- data/lib/nokogiri/xml/xpath.rb +21 -0
- data/lib/nokogiri/xml/xpath_context.rb +16 -0
- data/lib/nokogiri/xml.rb +75 -0
- data/lib/nokogiri/xslt/stylesheet.rb +27 -0
- data/lib/nokogiri/xslt.rb +58 -0
- data/lib/nokogiri.rb +128 -0
- data/lib/xsd/xmlparser/nokogiri.rb +104 -0
- metadata +539 -0
@@ -0,0 +1,564 @@
|
|
1
|
+
/*
|
2
|
+
* Summary: XML Path Language implementation
|
3
|
+
* Description: API for the XML Path Language implementation
|
4
|
+
*
|
5
|
+
* XML Path Language implementation
|
6
|
+
* XPath is a language for addressing parts of an XML document,
|
7
|
+
* designed to be used by both XSLT and XPointer
|
8
|
+
* http://www.w3.org/TR/xpath
|
9
|
+
*
|
10
|
+
* Implements
|
11
|
+
* W3C Recommendation 16 November 1999
|
12
|
+
* http://www.w3.org/TR/1999/REC-xpath-19991116
|
13
|
+
*
|
14
|
+
* Copy: See Copyright for the status of this software.
|
15
|
+
*
|
16
|
+
* Author: Daniel Veillard
|
17
|
+
*/
|
18
|
+
|
19
|
+
#ifndef __XML_XPATH_H__
|
20
|
+
#define __XML_XPATH_H__
|
21
|
+
|
22
|
+
#include <libxml/xmlversion.h>
|
23
|
+
|
24
|
+
#ifdef LIBXML_XPATH_ENABLED
|
25
|
+
|
26
|
+
#include <libxml/xmlerror.h>
|
27
|
+
#include <libxml/tree.h>
|
28
|
+
#include <libxml/hash.h>
|
29
|
+
#endif /* LIBXML_XPATH_ENABLED */
|
30
|
+
|
31
|
+
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
32
|
+
#ifdef __cplusplus
|
33
|
+
extern "C" {
|
34
|
+
#endif
|
35
|
+
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED */
|
36
|
+
|
37
|
+
#ifdef LIBXML_XPATH_ENABLED
|
38
|
+
|
39
|
+
typedef struct _xmlXPathContext xmlXPathContext;
|
40
|
+
typedef xmlXPathContext *xmlXPathContextPtr;
|
41
|
+
typedef struct _xmlXPathParserContext xmlXPathParserContext;
|
42
|
+
typedef xmlXPathParserContext *xmlXPathParserContextPtr;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* The set of XPath error codes.
|
46
|
+
*/
|
47
|
+
|
48
|
+
typedef enum {
|
49
|
+
XPATH_EXPRESSION_OK = 0,
|
50
|
+
XPATH_NUMBER_ERROR,
|
51
|
+
XPATH_UNFINISHED_LITERAL_ERROR,
|
52
|
+
XPATH_START_LITERAL_ERROR,
|
53
|
+
XPATH_VARIABLE_REF_ERROR,
|
54
|
+
XPATH_UNDEF_VARIABLE_ERROR,
|
55
|
+
XPATH_INVALID_PREDICATE_ERROR,
|
56
|
+
XPATH_EXPR_ERROR,
|
57
|
+
XPATH_UNCLOSED_ERROR,
|
58
|
+
XPATH_UNKNOWN_FUNC_ERROR,
|
59
|
+
XPATH_INVALID_OPERAND,
|
60
|
+
XPATH_INVALID_TYPE,
|
61
|
+
XPATH_INVALID_ARITY,
|
62
|
+
XPATH_INVALID_CTXT_SIZE,
|
63
|
+
XPATH_INVALID_CTXT_POSITION,
|
64
|
+
XPATH_MEMORY_ERROR,
|
65
|
+
XPTR_SYNTAX_ERROR,
|
66
|
+
XPTR_RESOURCE_ERROR,
|
67
|
+
XPTR_SUB_RESOURCE_ERROR,
|
68
|
+
XPATH_UNDEF_PREFIX_ERROR,
|
69
|
+
XPATH_ENCODING_ERROR,
|
70
|
+
XPATH_INVALID_CHAR_ERROR,
|
71
|
+
XPATH_INVALID_CTXT,
|
72
|
+
XPATH_STACK_ERROR,
|
73
|
+
XPATH_FORBID_VARIABLE_ERROR,
|
74
|
+
XPATH_OP_LIMIT_EXCEEDED,
|
75
|
+
XPATH_RECURSION_LIMIT_EXCEEDED
|
76
|
+
} xmlXPathError;
|
77
|
+
|
78
|
+
/*
|
79
|
+
* A node-set (an unordered collection of nodes without duplicates).
|
80
|
+
*/
|
81
|
+
typedef struct _xmlNodeSet xmlNodeSet;
|
82
|
+
typedef xmlNodeSet *xmlNodeSetPtr;
|
83
|
+
struct _xmlNodeSet {
|
84
|
+
int nodeNr; /* number of nodes in the set */
|
85
|
+
int nodeMax; /* size of the array as allocated */
|
86
|
+
xmlNodePtr *nodeTab; /* array of nodes in no particular order */
|
87
|
+
/* @@ with_ns to check whether namespace nodes should be looked at @@ */
|
88
|
+
};
|
89
|
+
|
90
|
+
/*
|
91
|
+
* An expression is evaluated to yield an object, which
|
92
|
+
* has one of the following four basic types:
|
93
|
+
* - node-set
|
94
|
+
* - boolean
|
95
|
+
* - number
|
96
|
+
* - string
|
97
|
+
*
|
98
|
+
* @@ XPointer will add more types !
|
99
|
+
*/
|
100
|
+
|
101
|
+
typedef enum {
|
102
|
+
XPATH_UNDEFINED = 0,
|
103
|
+
XPATH_NODESET = 1,
|
104
|
+
XPATH_BOOLEAN = 2,
|
105
|
+
XPATH_NUMBER = 3,
|
106
|
+
XPATH_STRING = 4,
|
107
|
+
XPATH_POINT = 5,
|
108
|
+
XPATH_RANGE = 6,
|
109
|
+
XPATH_LOCATIONSET = 7,
|
110
|
+
XPATH_USERS = 8,
|
111
|
+
XPATH_XSLT_TREE = 9 /* An XSLT value tree, non modifiable */
|
112
|
+
} xmlXPathObjectType;
|
113
|
+
|
114
|
+
typedef struct _xmlXPathObject xmlXPathObject;
|
115
|
+
typedef xmlXPathObject *xmlXPathObjectPtr;
|
116
|
+
struct _xmlXPathObject {
|
117
|
+
xmlXPathObjectType type;
|
118
|
+
xmlNodeSetPtr nodesetval;
|
119
|
+
int boolval;
|
120
|
+
double floatval;
|
121
|
+
xmlChar *stringval;
|
122
|
+
void *user;
|
123
|
+
int index;
|
124
|
+
void *user2;
|
125
|
+
int index2;
|
126
|
+
};
|
127
|
+
|
128
|
+
/**
|
129
|
+
* xmlXPathConvertFunc:
|
130
|
+
* @obj: an XPath object
|
131
|
+
* @type: the number of the target type
|
132
|
+
*
|
133
|
+
* A conversion function is associated to a type and used to cast
|
134
|
+
* the new type to primitive values.
|
135
|
+
*
|
136
|
+
* Returns -1 in case of error, 0 otherwise
|
137
|
+
*/
|
138
|
+
typedef int (*xmlXPathConvertFunc) (xmlXPathObjectPtr obj, int type);
|
139
|
+
|
140
|
+
/*
|
141
|
+
* Extra type: a name and a conversion function.
|
142
|
+
*/
|
143
|
+
|
144
|
+
typedef struct _xmlXPathType xmlXPathType;
|
145
|
+
typedef xmlXPathType *xmlXPathTypePtr;
|
146
|
+
struct _xmlXPathType {
|
147
|
+
const xmlChar *name; /* the type name */
|
148
|
+
xmlXPathConvertFunc func; /* the conversion function */
|
149
|
+
};
|
150
|
+
|
151
|
+
/*
|
152
|
+
* Extra variable: a name and a value.
|
153
|
+
*/
|
154
|
+
|
155
|
+
typedef struct _xmlXPathVariable xmlXPathVariable;
|
156
|
+
typedef xmlXPathVariable *xmlXPathVariablePtr;
|
157
|
+
struct _xmlXPathVariable {
|
158
|
+
const xmlChar *name; /* the variable name */
|
159
|
+
xmlXPathObjectPtr value; /* the value */
|
160
|
+
};
|
161
|
+
|
162
|
+
/**
|
163
|
+
* xmlXPathEvalFunc:
|
164
|
+
* @ctxt: an XPath parser context
|
165
|
+
* @nargs: the number of arguments passed to the function
|
166
|
+
*
|
167
|
+
* An XPath evaluation function, the parameters are on the XPath context stack.
|
168
|
+
*/
|
169
|
+
|
170
|
+
typedef void (*xmlXPathEvalFunc)(xmlXPathParserContextPtr ctxt,
|
171
|
+
int nargs);
|
172
|
+
|
173
|
+
/*
|
174
|
+
* Extra function: a name and a evaluation function.
|
175
|
+
*/
|
176
|
+
|
177
|
+
typedef struct _xmlXPathFunct xmlXPathFunct;
|
178
|
+
typedef xmlXPathFunct *xmlXPathFuncPtr;
|
179
|
+
struct _xmlXPathFunct {
|
180
|
+
const xmlChar *name; /* the function name */
|
181
|
+
xmlXPathEvalFunc func; /* the evaluation function */
|
182
|
+
};
|
183
|
+
|
184
|
+
/**
|
185
|
+
* xmlXPathAxisFunc:
|
186
|
+
* @ctxt: the XPath interpreter context
|
187
|
+
* @cur: the previous node being explored on that axis
|
188
|
+
*
|
189
|
+
* An axis traversal function. To traverse an axis, the engine calls
|
190
|
+
* the first time with cur == NULL and repeat until the function returns
|
191
|
+
* NULL indicating the end of the axis traversal.
|
192
|
+
*
|
193
|
+
* Returns the next node in that axis or NULL if at the end of the axis.
|
194
|
+
*/
|
195
|
+
|
196
|
+
typedef xmlXPathObjectPtr (*xmlXPathAxisFunc) (xmlXPathParserContextPtr ctxt,
|
197
|
+
xmlXPathObjectPtr cur);
|
198
|
+
|
199
|
+
/*
|
200
|
+
* Extra axis: a name and an axis function.
|
201
|
+
*/
|
202
|
+
|
203
|
+
typedef struct _xmlXPathAxis xmlXPathAxis;
|
204
|
+
typedef xmlXPathAxis *xmlXPathAxisPtr;
|
205
|
+
struct _xmlXPathAxis {
|
206
|
+
const xmlChar *name; /* the axis name */
|
207
|
+
xmlXPathAxisFunc func; /* the search function */
|
208
|
+
};
|
209
|
+
|
210
|
+
/**
|
211
|
+
* xmlXPathFunction:
|
212
|
+
* @ctxt: the XPath interprestation context
|
213
|
+
* @nargs: the number of arguments
|
214
|
+
*
|
215
|
+
* An XPath function.
|
216
|
+
* The arguments (if any) are popped out from the context stack
|
217
|
+
* and the result is pushed on the stack.
|
218
|
+
*/
|
219
|
+
|
220
|
+
typedef void (*xmlXPathFunction) (xmlXPathParserContextPtr ctxt, int nargs);
|
221
|
+
|
222
|
+
/*
|
223
|
+
* Function and Variable Lookup.
|
224
|
+
*/
|
225
|
+
|
226
|
+
/**
|
227
|
+
* xmlXPathVariableLookupFunc:
|
228
|
+
* @ctxt: an XPath context
|
229
|
+
* @name: name of the variable
|
230
|
+
* @ns_uri: the namespace name hosting this variable
|
231
|
+
*
|
232
|
+
* Prototype for callbacks used to plug variable lookup in the XPath
|
233
|
+
* engine.
|
234
|
+
*
|
235
|
+
* Returns the XPath object value or NULL if not found.
|
236
|
+
*/
|
237
|
+
typedef xmlXPathObjectPtr (*xmlXPathVariableLookupFunc) (void *ctxt,
|
238
|
+
const xmlChar *name,
|
239
|
+
const xmlChar *ns_uri);
|
240
|
+
|
241
|
+
/**
|
242
|
+
* xmlXPathFuncLookupFunc:
|
243
|
+
* @ctxt: an XPath context
|
244
|
+
* @name: name of the function
|
245
|
+
* @ns_uri: the namespace name hosting this function
|
246
|
+
*
|
247
|
+
* Prototype for callbacks used to plug function lookup in the XPath
|
248
|
+
* engine.
|
249
|
+
*
|
250
|
+
* Returns the XPath function or NULL if not found.
|
251
|
+
*/
|
252
|
+
typedef xmlXPathFunction (*xmlXPathFuncLookupFunc) (void *ctxt,
|
253
|
+
const xmlChar *name,
|
254
|
+
const xmlChar *ns_uri);
|
255
|
+
|
256
|
+
/**
|
257
|
+
* xmlXPathFlags:
|
258
|
+
* Flags for XPath engine compilation and runtime
|
259
|
+
*/
|
260
|
+
/**
|
261
|
+
* XML_XPATH_CHECKNS:
|
262
|
+
*
|
263
|
+
* check namespaces at compilation
|
264
|
+
*/
|
265
|
+
#define XML_XPATH_CHECKNS (1<<0)
|
266
|
+
/**
|
267
|
+
* XML_XPATH_NOVAR:
|
268
|
+
*
|
269
|
+
* forbid variables in expression
|
270
|
+
*/
|
271
|
+
#define XML_XPATH_NOVAR (1<<1)
|
272
|
+
|
273
|
+
/**
|
274
|
+
* xmlXPathContext:
|
275
|
+
*
|
276
|
+
* Expression evaluation occurs with respect to a context.
|
277
|
+
* he context consists of:
|
278
|
+
* - a node (the context node)
|
279
|
+
* - a node list (the context node list)
|
280
|
+
* - a set of variable bindings
|
281
|
+
* - a function library
|
282
|
+
* - the set of namespace declarations in scope for the expression
|
283
|
+
* Following the switch to hash tables, this need to be trimmed up at
|
284
|
+
* the next binary incompatible release.
|
285
|
+
* The node may be modified when the context is passed to libxml2
|
286
|
+
* for an XPath evaluation so you may need to initialize it again
|
287
|
+
* before the next call.
|
288
|
+
*/
|
289
|
+
|
290
|
+
struct _xmlXPathContext {
|
291
|
+
xmlDocPtr doc; /* The current document */
|
292
|
+
xmlNodePtr node; /* The current node */
|
293
|
+
|
294
|
+
int nb_variables_unused; /* unused (hash table) */
|
295
|
+
int max_variables_unused; /* unused (hash table) */
|
296
|
+
xmlHashTablePtr varHash; /* Hash table of defined variables */
|
297
|
+
|
298
|
+
int nb_types; /* number of defined types */
|
299
|
+
int max_types; /* max number of types */
|
300
|
+
xmlXPathTypePtr types; /* Array of defined types */
|
301
|
+
|
302
|
+
int nb_funcs_unused; /* unused (hash table) */
|
303
|
+
int max_funcs_unused; /* unused (hash table) */
|
304
|
+
xmlHashTablePtr funcHash; /* Hash table of defined funcs */
|
305
|
+
|
306
|
+
int nb_axis; /* number of defined axis */
|
307
|
+
int max_axis; /* max number of axis */
|
308
|
+
xmlXPathAxisPtr axis; /* Array of defined axis */
|
309
|
+
|
310
|
+
/* the namespace nodes of the context node */
|
311
|
+
xmlNsPtr *namespaces; /* Array of namespaces */
|
312
|
+
int nsNr; /* number of namespace in scope */
|
313
|
+
void *user; /* function to free */
|
314
|
+
|
315
|
+
/* extra variables */
|
316
|
+
int contextSize; /* the context size */
|
317
|
+
int proximityPosition; /* the proximity position */
|
318
|
+
|
319
|
+
/* extra stuff for XPointer */
|
320
|
+
int xptr; /* is this an XPointer context? */
|
321
|
+
xmlNodePtr here; /* for here() */
|
322
|
+
xmlNodePtr origin; /* for origin() */
|
323
|
+
|
324
|
+
/* the set of namespace declarations in scope for the expression */
|
325
|
+
xmlHashTablePtr nsHash; /* The namespaces hash table */
|
326
|
+
xmlXPathVariableLookupFunc varLookupFunc;/* variable lookup func */
|
327
|
+
void *varLookupData; /* variable lookup data */
|
328
|
+
|
329
|
+
/* Possibility to link in an extra item */
|
330
|
+
void *extra; /* needed for XSLT */
|
331
|
+
|
332
|
+
/* The function name and URI when calling a function */
|
333
|
+
const xmlChar *function;
|
334
|
+
const xmlChar *functionURI;
|
335
|
+
|
336
|
+
/* function lookup function and data */
|
337
|
+
xmlXPathFuncLookupFunc funcLookupFunc;/* function lookup func */
|
338
|
+
void *funcLookupData; /* function lookup data */
|
339
|
+
|
340
|
+
/* temporary namespace lists kept for walking the namespace axis */
|
341
|
+
xmlNsPtr *tmpNsList; /* Array of namespaces */
|
342
|
+
int tmpNsNr; /* number of namespaces in scope */
|
343
|
+
|
344
|
+
/* error reporting mechanism */
|
345
|
+
void *userData; /* user specific data block */
|
346
|
+
xmlStructuredErrorFunc error; /* the callback in case of errors */
|
347
|
+
xmlError lastError; /* the last error */
|
348
|
+
xmlNodePtr debugNode; /* the source node XSLT */
|
349
|
+
|
350
|
+
/* dictionary */
|
351
|
+
xmlDictPtr dict; /* dictionary if any */
|
352
|
+
|
353
|
+
int flags; /* flags to control compilation */
|
354
|
+
|
355
|
+
/* Cache for reusal of XPath objects */
|
356
|
+
void *cache;
|
357
|
+
|
358
|
+
/* Resource limits */
|
359
|
+
unsigned long opLimit;
|
360
|
+
unsigned long opCount;
|
361
|
+
int depth;
|
362
|
+
};
|
363
|
+
|
364
|
+
/*
|
365
|
+
* The structure of a compiled expression form is not public.
|
366
|
+
*/
|
367
|
+
|
368
|
+
typedef struct _xmlXPathCompExpr xmlXPathCompExpr;
|
369
|
+
typedef xmlXPathCompExpr *xmlXPathCompExprPtr;
|
370
|
+
|
371
|
+
/**
|
372
|
+
* xmlXPathParserContext:
|
373
|
+
*
|
374
|
+
* An XPath parser context. It contains pure parsing information,
|
375
|
+
* an xmlXPathContext, and the stack of objects.
|
376
|
+
*/
|
377
|
+
struct _xmlXPathParserContext {
|
378
|
+
const xmlChar *cur; /* the current char being parsed */
|
379
|
+
const xmlChar *base; /* the full expression */
|
380
|
+
|
381
|
+
int error; /* error code */
|
382
|
+
|
383
|
+
xmlXPathContextPtr context; /* the evaluation context */
|
384
|
+
xmlXPathObjectPtr value; /* the current value */
|
385
|
+
int valueNr; /* number of values stacked */
|
386
|
+
int valueMax; /* max number of values stacked */
|
387
|
+
xmlXPathObjectPtr *valueTab; /* stack of values */
|
388
|
+
|
389
|
+
xmlXPathCompExprPtr comp; /* the precompiled expression */
|
390
|
+
int xptr; /* it this an XPointer expression */
|
391
|
+
xmlNodePtr ancestor; /* used for walking preceding axis */
|
392
|
+
|
393
|
+
int valueFrame; /* used to limit Pop on the stack */
|
394
|
+
};
|
395
|
+
|
396
|
+
/************************************************************************
|
397
|
+
* *
|
398
|
+
* Public API *
|
399
|
+
* *
|
400
|
+
************************************************************************/
|
401
|
+
|
402
|
+
/**
|
403
|
+
* Objects and Nodesets handling
|
404
|
+
*/
|
405
|
+
|
406
|
+
XMLPUBVAR double xmlXPathNAN;
|
407
|
+
XMLPUBVAR double xmlXPathPINF;
|
408
|
+
XMLPUBVAR double xmlXPathNINF;
|
409
|
+
|
410
|
+
/* These macros may later turn into functions */
|
411
|
+
/**
|
412
|
+
* xmlXPathNodeSetGetLength:
|
413
|
+
* @ns: a node-set
|
414
|
+
*
|
415
|
+
* Implement a functionality similar to the DOM NodeList.length.
|
416
|
+
*
|
417
|
+
* Returns the number of nodes in the node-set.
|
418
|
+
*/
|
419
|
+
#define xmlXPathNodeSetGetLength(ns) ((ns) ? (ns)->nodeNr : 0)
|
420
|
+
/**
|
421
|
+
* xmlXPathNodeSetItem:
|
422
|
+
* @ns: a node-set
|
423
|
+
* @index: index of a node in the set
|
424
|
+
*
|
425
|
+
* Implements a functionality similar to the DOM NodeList.item().
|
426
|
+
*
|
427
|
+
* Returns the xmlNodePtr at the given @index in @ns or NULL if
|
428
|
+
* @index is out of range (0 to length-1)
|
429
|
+
*/
|
430
|
+
#define xmlXPathNodeSetItem(ns, index) \
|
431
|
+
((((ns) != NULL) && \
|
432
|
+
((index) >= 0) && ((index) < (ns)->nodeNr)) ? \
|
433
|
+
(ns)->nodeTab[(index)] \
|
434
|
+
: NULL)
|
435
|
+
/**
|
436
|
+
* xmlXPathNodeSetIsEmpty:
|
437
|
+
* @ns: a node-set
|
438
|
+
*
|
439
|
+
* Checks whether @ns is empty or not.
|
440
|
+
*
|
441
|
+
* Returns %TRUE if @ns is an empty node-set.
|
442
|
+
*/
|
443
|
+
#define xmlXPathNodeSetIsEmpty(ns) \
|
444
|
+
(((ns) == NULL) || ((ns)->nodeNr == 0) || ((ns)->nodeTab == NULL))
|
445
|
+
|
446
|
+
|
447
|
+
XMLPUBFUN void XMLCALL
|
448
|
+
xmlXPathFreeObject (xmlXPathObjectPtr obj);
|
449
|
+
XMLPUBFUN xmlNodeSetPtr XMLCALL
|
450
|
+
xmlXPathNodeSetCreate (xmlNodePtr val);
|
451
|
+
XMLPUBFUN void XMLCALL
|
452
|
+
xmlXPathFreeNodeSetList (xmlXPathObjectPtr obj);
|
453
|
+
XMLPUBFUN void XMLCALL
|
454
|
+
xmlXPathFreeNodeSet (xmlNodeSetPtr obj);
|
455
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
456
|
+
xmlXPathObjectCopy (xmlXPathObjectPtr val);
|
457
|
+
XMLPUBFUN int XMLCALL
|
458
|
+
xmlXPathCmpNodes (xmlNodePtr node1,
|
459
|
+
xmlNodePtr node2);
|
460
|
+
/**
|
461
|
+
* Conversion functions to basic types.
|
462
|
+
*/
|
463
|
+
XMLPUBFUN int XMLCALL
|
464
|
+
xmlXPathCastNumberToBoolean (double val);
|
465
|
+
XMLPUBFUN int XMLCALL
|
466
|
+
xmlXPathCastStringToBoolean (const xmlChar * val);
|
467
|
+
XMLPUBFUN int XMLCALL
|
468
|
+
xmlXPathCastNodeSetToBoolean(xmlNodeSetPtr ns);
|
469
|
+
XMLPUBFUN int XMLCALL
|
470
|
+
xmlXPathCastToBoolean (xmlXPathObjectPtr val);
|
471
|
+
|
472
|
+
XMLPUBFUN double XMLCALL
|
473
|
+
xmlXPathCastBooleanToNumber (int val);
|
474
|
+
XMLPUBFUN double XMLCALL
|
475
|
+
xmlXPathCastStringToNumber (const xmlChar * val);
|
476
|
+
XMLPUBFUN double XMLCALL
|
477
|
+
xmlXPathCastNodeToNumber (xmlNodePtr node);
|
478
|
+
XMLPUBFUN double XMLCALL
|
479
|
+
xmlXPathCastNodeSetToNumber (xmlNodeSetPtr ns);
|
480
|
+
XMLPUBFUN double XMLCALL
|
481
|
+
xmlXPathCastToNumber (xmlXPathObjectPtr val);
|
482
|
+
|
483
|
+
XMLPUBFUN xmlChar * XMLCALL
|
484
|
+
xmlXPathCastBooleanToString (int val);
|
485
|
+
XMLPUBFUN xmlChar * XMLCALL
|
486
|
+
xmlXPathCastNumberToString (double val);
|
487
|
+
XMLPUBFUN xmlChar * XMLCALL
|
488
|
+
xmlXPathCastNodeToString (xmlNodePtr node);
|
489
|
+
XMLPUBFUN xmlChar * XMLCALL
|
490
|
+
xmlXPathCastNodeSetToString (xmlNodeSetPtr ns);
|
491
|
+
XMLPUBFUN xmlChar * XMLCALL
|
492
|
+
xmlXPathCastToString (xmlXPathObjectPtr val);
|
493
|
+
|
494
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
495
|
+
xmlXPathConvertBoolean (xmlXPathObjectPtr val);
|
496
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
497
|
+
xmlXPathConvertNumber (xmlXPathObjectPtr val);
|
498
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
499
|
+
xmlXPathConvertString (xmlXPathObjectPtr val);
|
500
|
+
|
501
|
+
/**
|
502
|
+
* Context handling.
|
503
|
+
*/
|
504
|
+
XMLPUBFUN xmlXPathContextPtr XMLCALL
|
505
|
+
xmlXPathNewContext (xmlDocPtr doc);
|
506
|
+
XMLPUBFUN void XMLCALL
|
507
|
+
xmlXPathFreeContext (xmlXPathContextPtr ctxt);
|
508
|
+
XMLPUBFUN int XMLCALL
|
509
|
+
xmlXPathContextSetCache(xmlXPathContextPtr ctxt,
|
510
|
+
int active,
|
511
|
+
int value,
|
512
|
+
int options);
|
513
|
+
/**
|
514
|
+
* Evaluation functions.
|
515
|
+
*/
|
516
|
+
XMLPUBFUN long XMLCALL
|
517
|
+
xmlXPathOrderDocElems (xmlDocPtr doc);
|
518
|
+
XMLPUBFUN int XMLCALL
|
519
|
+
xmlXPathSetContextNode (xmlNodePtr node,
|
520
|
+
xmlXPathContextPtr ctx);
|
521
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
522
|
+
xmlXPathNodeEval (xmlNodePtr node,
|
523
|
+
const xmlChar *str,
|
524
|
+
xmlXPathContextPtr ctx);
|
525
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
526
|
+
xmlXPathEval (const xmlChar *str,
|
527
|
+
xmlXPathContextPtr ctx);
|
528
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
529
|
+
xmlXPathEvalExpression (const xmlChar *str,
|
530
|
+
xmlXPathContextPtr ctxt);
|
531
|
+
XMLPUBFUN int XMLCALL
|
532
|
+
xmlXPathEvalPredicate (xmlXPathContextPtr ctxt,
|
533
|
+
xmlXPathObjectPtr res);
|
534
|
+
/**
|
535
|
+
* Separate compilation/evaluation entry points.
|
536
|
+
*/
|
537
|
+
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
|
538
|
+
xmlXPathCompile (const xmlChar *str);
|
539
|
+
XMLPUBFUN xmlXPathCompExprPtr XMLCALL
|
540
|
+
xmlXPathCtxtCompile (xmlXPathContextPtr ctxt,
|
541
|
+
const xmlChar *str);
|
542
|
+
XMLPUBFUN xmlXPathObjectPtr XMLCALL
|
543
|
+
xmlXPathCompiledEval (xmlXPathCompExprPtr comp,
|
544
|
+
xmlXPathContextPtr ctx);
|
545
|
+
XMLPUBFUN int XMLCALL
|
546
|
+
xmlXPathCompiledEvalToBoolean(xmlXPathCompExprPtr comp,
|
547
|
+
xmlXPathContextPtr ctxt);
|
548
|
+
XMLPUBFUN void XMLCALL
|
549
|
+
xmlXPathFreeCompExpr (xmlXPathCompExprPtr comp);
|
550
|
+
#endif /* LIBXML_XPATH_ENABLED */
|
551
|
+
#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
|
552
|
+
XMLPUBFUN void XMLCALL
|
553
|
+
xmlXPathInit (void);
|
554
|
+
XMLPUBFUN int XMLCALL
|
555
|
+
xmlXPathIsNaN (double val);
|
556
|
+
XMLPUBFUN int XMLCALL
|
557
|
+
xmlXPathIsInf (double val);
|
558
|
+
|
559
|
+
#ifdef __cplusplus
|
560
|
+
}
|
561
|
+
#endif
|
562
|
+
|
563
|
+
#endif /* LIBXML_XPATH_ENABLED or LIBXML_SCHEMAS_ENABLED*/
|
564
|
+
#endif /* ! __XML_XPATH_H__ */
|