nokogiri 1.18.0.rc1-aarch64-linux-gnu
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +38 -0
- data/LICENSE-DEPENDENCIES.md +2224 -0
- data/LICENSE.md +9 -0
- data/README.md +293 -0
- data/bin/nokogiri +131 -0
- data/dependencies.yml +42 -0
- data/ext/nokogiri/depend +38 -0
- data/ext/nokogiri/extconf.rb +1173 -0
- data/ext/nokogiri/gumbo.c +610 -0
- data/ext/nokogiri/html4_document.c +171 -0
- data/ext/nokogiri/html4_element_description.c +299 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser.c +40 -0
- data/ext/nokogiri/html4_sax_parser_context.c +98 -0
- data/ext/nokogiri/html4_sax_push_parser.c +96 -0
- data/ext/nokogiri/include/libexslt/exslt.h +108 -0
- data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
- data/ext/nokogiri/include/libexslt/exsltexports.h +63 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +336 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX.h +202 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX2.h +171 -0
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +115 -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 +82 -0
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +244 -0
- data/ext/nokogiri/include/libxml2/libxml/entities.h +166 -0
- data/ext/nokogiri/include/libxml2/libxml/globals.h +41 -0
- data/ext/nokogiri/include/libxml2/libxml/hash.h +251 -0
- data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
- data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +186 -0
- data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +98 -0
- data/ext/nokogiri/include/libxml2/libxml/parser.h +1390 -0
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +671 -0
- data/ext/nokogiri/include/libxml2/libxml/pattern.h +106 -0
- data/ext/nokogiri/include/libxml2/libxml/relaxng.h +219 -0
- data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +959 -0
- data/ext/nokogiri/include/libxml2/libxml/schematron.h +143 -0
- data/ext/nokogiri/include/libxml2/libxml/threads.h +87 -0
- data/ext/nokogiri/include/libxml2/libxml/tree.h +1382 -0
- data/ext/nokogiri/include/libxml2/libxml/uri.h +106 -0
- data/ext/nokogiri/include/libxml2/libxml/valid.h +477 -0
- data/ext/nokogiri/include/libxml2/libxml/xinclude.h +136 -0
- data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +438 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +962 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +188 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +436 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +215 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +102 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +249 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +152 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +366 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +347 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +489 -0
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +579 -0
- data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +633 -0
- data/ext/nokogiri/include/libxml2/libxml/xpointer.h +138 -0
- data/ext/nokogiri/include/libxslt/attributes.h +39 -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 +1995 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +146 -0
- data/ext/nokogiri/include/libxslt/xsltexports.h +64 -0
- data/ext/nokogiri/include/libxslt/xsltlocale.h +44 -0
- data/ext/nokogiri/include/libxslt/xsltutils.h +343 -0
- data/ext/nokogiri/libxml2_polyfill.c +114 -0
- data/ext/nokogiri/nokogiri.c +294 -0
- data/ext/nokogiri/nokogiri.h +238 -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 +62 -0
- data/ext/nokogiri/xml_comment.c +57 -0
- data/ext/nokogiri/xml_document.c +784 -0
- data/ext/nokogiri/xml_document_fragment.c +29 -0
- data/ext/nokogiri/xml_dtd.c +208 -0
- data/ext/nokogiri/xml_element_content.c +131 -0
- data/ext/nokogiri/xml_element_decl.c +69 -0
- data/ext/nokogiri/xml_encoding_handler.c +112 -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 +181 -0
- data/ext/nokogiri/xml_node.c +2459 -0
- data/ext/nokogiri/xml_node_set.c +518 -0
- data/ext/nokogiri/xml_processing_instruction.c +54 -0
- data/ext/nokogiri/xml_reader.c +777 -0
- data/ext/nokogiri/xml_relax_ng.c +149 -0
- data/ext/nokogiri/xml_sax_parser.c +403 -0
- data/ext/nokogiri/xml_sax_parser_context.c +390 -0
- data/ext/nokogiri/xml_sax_push_parser.c +206 -0
- data/ext/nokogiri/xml_schema.c +226 -0
- data/ext/nokogiri/xml_syntax_error.c +93 -0
- data/ext/nokogiri/xml_text.c +59 -0
- data/ext/nokogiri/xml_xpath_context.c +502 -0
- data/ext/nokogiri/xslt_stylesheet.c +421 -0
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +129 -0
- data/gumbo-parser/THANKS +27 -0
- data/lib/nokogiri/3.1/nokogiri.so +0 -0
- data/lib/nokogiri/3.2/nokogiri.so +0 -0
- data/lib/nokogiri/3.3/nokogiri.so +0 -0
- data/lib/nokogiri/3.4/nokogiri.so +0 -0
- data/lib/nokogiri/class_resolver.rb +67 -0
- data/lib/nokogiri/css/node.rb +58 -0
- data/lib/nokogiri/css/parser.rb +772 -0
- data/lib/nokogiri/css/parser.y +277 -0
- data/lib/nokogiri/css/parser_extras.rb +36 -0
- data/lib/nokogiri/css/selector_cache.rb +38 -0
- data/lib/nokogiri/css/syntax_error.rb +9 -0
- data/lib/nokogiri/css/tokenizer.rb +155 -0
- data/lib/nokogiri/css/tokenizer.rex +57 -0
- data/lib/nokogiri/css/xpath_visitor.rb +375 -0
- data/lib/nokogiri/css.rb +132 -0
- data/lib/nokogiri/decorators/slop.rb +42 -0
- data/lib/nokogiri/encoding_handler.rb +57 -0
- data/lib/nokogiri/extension.rb +32 -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 +235 -0
- data/lib/nokogiri/html4/document_fragment.rb +166 -0
- data/lib/nokogiri/html4/element_description.rb +25 -0
- data/lib/nokogiri/html4/element_description_defaults.rb +2040 -0
- data/lib/nokogiri/html4/encoding_reader.rb +121 -0
- data/lib/nokogiri/html4/entity_lookup.rb +15 -0
- data/lib/nokogiri/html4/sax/parser.rb +48 -0
- data/lib/nokogiri/html4/sax/parser_context.rb +15 -0
- data/lib/nokogiri/html4/sax/push_parser.rb +37 -0
- data/lib/nokogiri/html4.rb +42 -0
- data/lib/nokogiri/html5/builder.rb +40 -0
- data/lib/nokogiri/html5/document.rb +199 -0
- data/lib/nokogiri/html5/document_fragment.rb +200 -0
- data/lib/nokogiri/html5/node.rb +103 -0
- data/lib/nokogiri/html5.rb +368 -0
- data/lib/nokogiri/jruby/dependencies.rb +3 -0
- data/lib/nokogiri/jruby/nokogiri_jars.rb +43 -0
- data/lib/nokogiri/syntax_error.rb +6 -0
- data/lib/nokogiri/version/constant.rb +6 -0
- data/lib/nokogiri/version/info.rb +224 -0
- data/lib/nokogiri/version.rb +4 -0
- data/lib/nokogiri/xml/attr.rb +66 -0
- data/lib/nokogiri/xml/attribute_decl.rb +22 -0
- data/lib/nokogiri/xml/builder.rb +494 -0
- data/lib/nokogiri/xml/cdata.rb +13 -0
- data/lib/nokogiri/xml/character_data.rb +9 -0
- data/lib/nokogiri/xml/document.rb +514 -0
- data/lib/nokogiri/xml/document_fragment.rb +276 -0
- data/lib/nokogiri/xml/dtd.rb +34 -0
- data/lib/nokogiri/xml/element_content.rb +46 -0
- data/lib/nokogiri/xml/element_decl.rb +17 -0
- data/lib/nokogiri/xml/entity_decl.rb +23 -0
- data/lib/nokogiri/xml/entity_reference.rb +20 -0
- data/lib/nokogiri/xml/namespace.rb +57 -0
- data/lib/nokogiri/xml/node/save_options.rb +76 -0
- data/lib/nokogiri/xml/node.rb +1650 -0
- data/lib/nokogiri/xml/node_set.rb +449 -0
- data/lib/nokogiri/xml/notation.rb +19 -0
- data/lib/nokogiri/xml/parse_options.rb +213 -0
- data/lib/nokogiri/xml/pp/character_data.rb +21 -0
- data/lib/nokogiri/xml/pp/node.rb +73 -0
- data/lib/nokogiri/xml/pp.rb +4 -0
- data/lib/nokogiri/xml/processing_instruction.rb +11 -0
- data/lib/nokogiri/xml/reader.rb +139 -0
- data/lib/nokogiri/xml/relax_ng.rb +75 -0
- data/lib/nokogiri/xml/sax/document.rb +258 -0
- data/lib/nokogiri/xml/sax/parser.rb +199 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +129 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +64 -0
- data/lib/nokogiri/xml/sax.rb +54 -0
- data/lib/nokogiri/xml/schema.rb +140 -0
- data/lib/nokogiri/xml/searchable.rb +297 -0
- data/lib/nokogiri/xml/syntax_error.rb +94 -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 +49 -0
- data/lib/nokogiri/xml.rb +65 -0
- data/lib/nokogiri/xslt/stylesheet.rb +49 -0
- data/lib/nokogiri/xslt.rb +129 -0
- data/lib/nokogiri.rb +128 -0
- data/lib/xsd/xmlparser/nokogiri.rb +105 -0
- metadata +324 -0
@@ -0,0 +1,1390 @@
|
|
1
|
+
/*
|
2
|
+
* Summary: the core parser module
|
3
|
+
* Description: Interfaces, constants and types related to the XML parser
|
4
|
+
*
|
5
|
+
* Copy: See Copyright for the status of this software.
|
6
|
+
*
|
7
|
+
* Author: Daniel Veillard
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef __XML_PARSER_H__
|
11
|
+
#define __XML_PARSER_H__
|
12
|
+
|
13
|
+
/** DOC_DISABLE */
|
14
|
+
#include <libxml/xmlversion.h>
|
15
|
+
#define XML_TREE_INTERNALS
|
16
|
+
#include <libxml/tree.h>
|
17
|
+
#undef XML_TREE_INTERNALS
|
18
|
+
#include <libxml/dict.h>
|
19
|
+
#include <libxml/hash.h>
|
20
|
+
#include <libxml/valid.h>
|
21
|
+
#include <libxml/entities.h>
|
22
|
+
#include <libxml/xmlerror.h>
|
23
|
+
#include <libxml/xmlstring.h>
|
24
|
+
#include <libxml/xmlmemory.h>
|
25
|
+
#include <libxml/encoding.h>
|
26
|
+
#include <libxml/xmlIO.h>
|
27
|
+
/* for compatibility */
|
28
|
+
#include <libxml/SAX2.h>
|
29
|
+
#include <libxml/threads.h>
|
30
|
+
/** DOC_ENABLE */
|
31
|
+
|
32
|
+
#ifdef __cplusplus
|
33
|
+
extern "C" {
|
34
|
+
#endif
|
35
|
+
|
36
|
+
/**
|
37
|
+
* XML_DEFAULT_VERSION:
|
38
|
+
*
|
39
|
+
* The default version of XML used: 1.0
|
40
|
+
*/
|
41
|
+
#define XML_DEFAULT_VERSION "1.0"
|
42
|
+
|
43
|
+
/**
|
44
|
+
* xmlParserInput:
|
45
|
+
*
|
46
|
+
* An xmlParserInput is an input flow for the XML processor.
|
47
|
+
* Each entity parsed is associated an xmlParserInput (except the
|
48
|
+
* few predefined ones). This is the case both for internal entities
|
49
|
+
* - in which case the flow is already completely in memory - or
|
50
|
+
* external entities - in which case we use the buf structure for
|
51
|
+
* progressive reading and I18N conversions to the internal UTF-8 format.
|
52
|
+
*/
|
53
|
+
|
54
|
+
/**
|
55
|
+
* xmlParserInputDeallocate:
|
56
|
+
* @str: the string to deallocate
|
57
|
+
*
|
58
|
+
* Callback for freeing some parser input allocations.
|
59
|
+
*/
|
60
|
+
typedef void (* xmlParserInputDeallocate)(xmlChar *str);
|
61
|
+
|
62
|
+
struct _xmlParserInput {
|
63
|
+
/* Input buffer */
|
64
|
+
xmlParserInputBufferPtr buf; /* UTF-8 encoded buffer */
|
65
|
+
|
66
|
+
const char *filename; /* The file analyzed, if any */
|
67
|
+
const char *directory; /* unused */
|
68
|
+
const xmlChar *base; /* Base of the array to parse */
|
69
|
+
const xmlChar *cur; /* Current char being parsed */
|
70
|
+
const xmlChar *end; /* end of the array to parse */
|
71
|
+
int length; /* unused */
|
72
|
+
int line; /* Current line */
|
73
|
+
int col; /* Current column */
|
74
|
+
unsigned long consumed; /* How many xmlChars already consumed */
|
75
|
+
xmlParserInputDeallocate free; /* function to deallocate the base */
|
76
|
+
const xmlChar *encoding; /* unused */
|
77
|
+
const xmlChar *version; /* the version string for entity */
|
78
|
+
int flags; /* Flags */
|
79
|
+
int id; /* an unique identifier for the entity */
|
80
|
+
unsigned long parentConsumed; /* unused */
|
81
|
+
xmlEntityPtr entity; /* entity, if any */
|
82
|
+
};
|
83
|
+
|
84
|
+
/**
|
85
|
+
* xmlParserNodeInfo:
|
86
|
+
*
|
87
|
+
* The parser can be asked to collect Node information, i.e. at what
|
88
|
+
* place in the file they were detected.
|
89
|
+
* NOTE: This is off by default and not very well tested.
|
90
|
+
*/
|
91
|
+
typedef struct _xmlParserNodeInfo xmlParserNodeInfo;
|
92
|
+
typedef xmlParserNodeInfo *xmlParserNodeInfoPtr;
|
93
|
+
|
94
|
+
struct _xmlParserNodeInfo {
|
95
|
+
const struct _xmlNode* node;
|
96
|
+
/* Position & line # that text that created the node begins & ends on */
|
97
|
+
unsigned long begin_pos;
|
98
|
+
unsigned long begin_line;
|
99
|
+
unsigned long end_pos;
|
100
|
+
unsigned long end_line;
|
101
|
+
};
|
102
|
+
|
103
|
+
typedef struct _xmlParserNodeInfoSeq xmlParserNodeInfoSeq;
|
104
|
+
typedef xmlParserNodeInfoSeq *xmlParserNodeInfoSeqPtr;
|
105
|
+
struct _xmlParserNodeInfoSeq {
|
106
|
+
unsigned long maximum;
|
107
|
+
unsigned long length;
|
108
|
+
xmlParserNodeInfo* buffer;
|
109
|
+
};
|
110
|
+
|
111
|
+
/**
|
112
|
+
* xmlParserInputState:
|
113
|
+
*
|
114
|
+
* The parser is now working also as a state based parser.
|
115
|
+
* The recursive one use the state info for entities processing.
|
116
|
+
*/
|
117
|
+
typedef enum {
|
118
|
+
XML_PARSER_EOF = -1, /* nothing is to be parsed */
|
119
|
+
XML_PARSER_START = 0, /* nothing has been parsed */
|
120
|
+
XML_PARSER_MISC, /* Misc* before int subset */
|
121
|
+
XML_PARSER_PI, /* Within a processing instruction */
|
122
|
+
XML_PARSER_DTD, /* within some DTD content */
|
123
|
+
XML_PARSER_PROLOG, /* Misc* after internal subset */
|
124
|
+
XML_PARSER_COMMENT, /* within a comment */
|
125
|
+
XML_PARSER_START_TAG, /* within a start tag */
|
126
|
+
XML_PARSER_CONTENT, /* within the content */
|
127
|
+
XML_PARSER_CDATA_SECTION, /* within a CDATA section */
|
128
|
+
XML_PARSER_END_TAG, /* within a closing tag */
|
129
|
+
XML_PARSER_ENTITY_DECL, /* within an entity declaration */
|
130
|
+
XML_PARSER_ENTITY_VALUE, /* within an entity value in a decl */
|
131
|
+
XML_PARSER_ATTRIBUTE_VALUE, /* within an attribute value */
|
132
|
+
XML_PARSER_SYSTEM_LITERAL, /* within a SYSTEM value */
|
133
|
+
XML_PARSER_EPILOG, /* the Misc* after the last end tag */
|
134
|
+
XML_PARSER_IGNORE, /* within an IGNORED section */
|
135
|
+
XML_PARSER_PUBLIC_LITERAL, /* within a PUBLIC value */
|
136
|
+
XML_PARSER_XML_DECL /* before XML decl (but after BOM) */
|
137
|
+
} xmlParserInputState;
|
138
|
+
|
139
|
+
/** DOC_DISABLE */
|
140
|
+
/*
|
141
|
+
* Internal bits in the 'loadsubset' context member
|
142
|
+
*/
|
143
|
+
#define XML_DETECT_IDS 2
|
144
|
+
#define XML_COMPLETE_ATTRS 4
|
145
|
+
#define XML_SKIP_IDS 8
|
146
|
+
/** DOC_ENABLE */
|
147
|
+
|
148
|
+
/**
|
149
|
+
* xmlParserMode:
|
150
|
+
*
|
151
|
+
* A parser can operate in various modes
|
152
|
+
*/
|
153
|
+
typedef enum {
|
154
|
+
XML_PARSE_UNKNOWN = 0,
|
155
|
+
XML_PARSE_DOM = 1,
|
156
|
+
XML_PARSE_SAX = 2,
|
157
|
+
XML_PARSE_PUSH_DOM = 3,
|
158
|
+
XML_PARSE_PUSH_SAX = 4,
|
159
|
+
XML_PARSE_READER = 5
|
160
|
+
} xmlParserMode;
|
161
|
+
|
162
|
+
typedef struct _xmlStartTag xmlStartTag;
|
163
|
+
typedef struct _xmlParserNsData xmlParserNsData;
|
164
|
+
typedef struct _xmlAttrHashBucket xmlAttrHashBucket;
|
165
|
+
|
166
|
+
/**
|
167
|
+
* xmlParserCtxt:
|
168
|
+
*
|
169
|
+
* The parser context.
|
170
|
+
* NOTE This doesn't completely define the parser state, the (current ?)
|
171
|
+
* design of the parser uses recursive function calls since this allow
|
172
|
+
* and easy mapping from the production rules of the specification
|
173
|
+
* to the actual code. The drawback is that the actual function call
|
174
|
+
* also reflect the parser state. However most of the parsing routines
|
175
|
+
* takes as the only argument the parser context pointer, so migrating
|
176
|
+
* to a state based parser for progressive parsing shouldn't be too hard.
|
177
|
+
*/
|
178
|
+
struct _xmlParserCtxt {
|
179
|
+
struct _xmlSAXHandler *sax; /* The SAX handler */
|
180
|
+
void *userData; /* For SAX interface only, used by DOM build */
|
181
|
+
xmlDocPtr myDoc; /* the document being built */
|
182
|
+
int wellFormed; /* is the document well formed */
|
183
|
+
int replaceEntities; /* shall we replace entities ? */
|
184
|
+
const xmlChar *version; /* the XML version string */
|
185
|
+
const xmlChar *encoding; /* the declared encoding, if any */
|
186
|
+
int standalone; /* standalone document */
|
187
|
+
int html; /* an HTML(1) document
|
188
|
+
* 3 is HTML after <head>
|
189
|
+
* 10 is HTML after <body>
|
190
|
+
*/
|
191
|
+
|
192
|
+
/* Input stream stack */
|
193
|
+
xmlParserInputPtr input; /* Current input stream */
|
194
|
+
int inputNr; /* Number of current input streams */
|
195
|
+
int inputMax; /* Max number of input streams */
|
196
|
+
xmlParserInputPtr *inputTab; /* stack of inputs */
|
197
|
+
|
198
|
+
/* Node analysis stack only used for DOM building */
|
199
|
+
xmlNodePtr node; /* Current parsed Node */
|
200
|
+
int nodeNr; /* Depth of the parsing stack */
|
201
|
+
int nodeMax; /* Max depth of the parsing stack */
|
202
|
+
xmlNodePtr *nodeTab; /* array of nodes */
|
203
|
+
|
204
|
+
int record_info; /* Whether node info should be kept */
|
205
|
+
xmlParserNodeInfoSeq node_seq; /* info about each node parsed */
|
206
|
+
|
207
|
+
int errNo; /* error code */
|
208
|
+
|
209
|
+
int hasExternalSubset; /* reference and external subset */
|
210
|
+
int hasPErefs; /* the internal subset has PE refs */
|
211
|
+
int external; /* unused */
|
212
|
+
|
213
|
+
int valid; /* is the document valid */
|
214
|
+
int validate; /* shall we try to validate ? */
|
215
|
+
xmlValidCtxt vctxt; /* The validity context */
|
216
|
+
|
217
|
+
xmlParserInputState instate; /* push parser state */
|
218
|
+
int token; /* unused */
|
219
|
+
|
220
|
+
char *directory; /* unused */
|
221
|
+
|
222
|
+
/* Node name stack */
|
223
|
+
const xmlChar *name; /* Current parsed Node */
|
224
|
+
int nameNr; /* Depth of the parsing stack */
|
225
|
+
int nameMax; /* Max depth of the parsing stack */
|
226
|
+
const xmlChar * *nameTab; /* array of nodes */
|
227
|
+
|
228
|
+
long nbChars; /* unused */
|
229
|
+
long checkIndex; /* used by progressive parsing lookup */
|
230
|
+
int keepBlanks; /* ugly but ... */
|
231
|
+
int disableSAX; /* SAX callbacks are disabled */
|
232
|
+
int inSubset; /* Parsing is in int 1/ext 2 subset */
|
233
|
+
const xmlChar * intSubName; /* name of subset */
|
234
|
+
xmlChar * extSubURI; /* URI of external subset */
|
235
|
+
xmlChar * extSubSystem; /* SYSTEM ID of external subset */
|
236
|
+
|
237
|
+
/* xml:space values */
|
238
|
+
int * space; /* Should the parser preserve spaces */
|
239
|
+
int spaceNr; /* Depth of the parsing stack */
|
240
|
+
int spaceMax; /* Max depth of the parsing stack */
|
241
|
+
int * spaceTab; /* array of space infos */
|
242
|
+
|
243
|
+
int depth; /* to prevent entity substitution loops */
|
244
|
+
xmlParserInputPtr entity; /* unused */
|
245
|
+
int charset; /* unused */
|
246
|
+
int nodelen; /* Those two fields are there to */
|
247
|
+
int nodemem; /* Speed up large node parsing */
|
248
|
+
int pedantic; /* signal pedantic warnings */
|
249
|
+
void *_private; /* For user data, libxml won't touch it */
|
250
|
+
|
251
|
+
int loadsubset; /* should the external subset be loaded */
|
252
|
+
int linenumbers; /* set line number in element content */
|
253
|
+
void *catalogs; /* document's own catalog */
|
254
|
+
int recovery; /* run in recovery mode */
|
255
|
+
int progressive; /* unused */
|
256
|
+
xmlDictPtr dict; /* dictionary for the parser */
|
257
|
+
const xmlChar * *atts; /* array for the attributes callbacks */
|
258
|
+
int maxatts; /* the size of the array */
|
259
|
+
int docdict; /* unused */
|
260
|
+
|
261
|
+
/*
|
262
|
+
* pre-interned strings
|
263
|
+
*/
|
264
|
+
const xmlChar *str_xml;
|
265
|
+
const xmlChar *str_xmlns;
|
266
|
+
const xmlChar *str_xml_ns;
|
267
|
+
|
268
|
+
/*
|
269
|
+
* Everything below is used only by the new SAX mode
|
270
|
+
*/
|
271
|
+
int sax2; /* operating in the new SAX mode */
|
272
|
+
int nsNr; /* the number of inherited namespaces */
|
273
|
+
int nsMax; /* the size of the arrays */
|
274
|
+
const xmlChar * *nsTab; /* the array of prefix/namespace name */
|
275
|
+
unsigned *attallocs; /* which attribute were allocated */
|
276
|
+
xmlStartTag *pushTab; /* array of data for push */
|
277
|
+
xmlHashTablePtr attsDefault; /* defaulted attributes if any */
|
278
|
+
xmlHashTablePtr attsSpecial; /* non-CDATA attributes if any */
|
279
|
+
int nsWellFormed; /* is the document XML Namespace okay */
|
280
|
+
int options; /* Extra options */
|
281
|
+
|
282
|
+
/*
|
283
|
+
* Those fields are needed only for streaming parsing so far
|
284
|
+
*/
|
285
|
+
int dictNames; /* Use dictionary names for the tree */
|
286
|
+
int freeElemsNr; /* number of freed element nodes */
|
287
|
+
xmlNodePtr freeElems; /* List of freed element nodes */
|
288
|
+
int freeAttrsNr; /* number of freed attributes nodes */
|
289
|
+
xmlAttrPtr freeAttrs; /* List of freed attributes nodes */
|
290
|
+
|
291
|
+
/*
|
292
|
+
* the complete error information for the last error.
|
293
|
+
*/
|
294
|
+
xmlError lastError;
|
295
|
+
xmlParserMode parseMode; /* the parser mode */
|
296
|
+
unsigned long nbentities; /* unused */
|
297
|
+
unsigned long sizeentities; /* size of external entities */
|
298
|
+
|
299
|
+
/* for use by HTML non-recursive parser */
|
300
|
+
xmlParserNodeInfo *nodeInfo; /* Current NodeInfo */
|
301
|
+
int nodeInfoNr; /* Depth of the parsing stack */
|
302
|
+
int nodeInfoMax; /* Max depth of the parsing stack */
|
303
|
+
xmlParserNodeInfo *nodeInfoTab; /* array of nodeInfos */
|
304
|
+
|
305
|
+
int input_id; /* we need to label inputs */
|
306
|
+
unsigned long sizeentcopy; /* volume of entity copy */
|
307
|
+
|
308
|
+
int endCheckState; /* quote state for push parser */
|
309
|
+
unsigned short nbErrors; /* number of errors */
|
310
|
+
unsigned short nbWarnings; /* number of warnings */
|
311
|
+
unsigned maxAmpl; /* maximum amplification factor */
|
312
|
+
|
313
|
+
xmlParserNsData *nsdb; /* namespace database */
|
314
|
+
unsigned attrHashMax; /* allocated size */
|
315
|
+
xmlAttrHashBucket *attrHash; /* atttribute hash table */
|
316
|
+
|
317
|
+
xmlStructuredErrorFunc errorHandler;
|
318
|
+
void *errorCtxt;
|
319
|
+
};
|
320
|
+
|
321
|
+
/**
|
322
|
+
* xmlSAXLocator:
|
323
|
+
*
|
324
|
+
* A SAX Locator.
|
325
|
+
*/
|
326
|
+
struct _xmlSAXLocator {
|
327
|
+
const xmlChar *(*getPublicId)(void *ctx);
|
328
|
+
const xmlChar *(*getSystemId)(void *ctx);
|
329
|
+
int (*getLineNumber)(void *ctx);
|
330
|
+
int (*getColumnNumber)(void *ctx);
|
331
|
+
};
|
332
|
+
|
333
|
+
/**
|
334
|
+
* xmlSAXHandler:
|
335
|
+
*
|
336
|
+
* A SAX handler is bunch of callbacks called by the parser when processing
|
337
|
+
* of the input generate data or structure information.
|
338
|
+
*/
|
339
|
+
|
340
|
+
/**
|
341
|
+
* resolveEntitySAXFunc:
|
342
|
+
* @ctx: the user data (XML parser context)
|
343
|
+
* @publicId: The public ID of the entity
|
344
|
+
* @systemId: The system ID of the entity
|
345
|
+
*
|
346
|
+
* Callback:
|
347
|
+
* The entity loader, to control the loading of external entities,
|
348
|
+
* the application can either:
|
349
|
+
* - override this resolveEntity() callback in the SAX block
|
350
|
+
* - or better use the xmlSetExternalEntityLoader() function to
|
351
|
+
* set up it's own entity resolution routine
|
352
|
+
*
|
353
|
+
* Returns the xmlParserInputPtr if inlined or NULL for DOM behaviour.
|
354
|
+
*/
|
355
|
+
typedef xmlParserInputPtr (*resolveEntitySAXFunc) (void *ctx,
|
356
|
+
const xmlChar *publicId,
|
357
|
+
const xmlChar *systemId);
|
358
|
+
/**
|
359
|
+
* internalSubsetSAXFunc:
|
360
|
+
* @ctx: the user data (XML parser context)
|
361
|
+
* @name: the root element name
|
362
|
+
* @ExternalID: the external ID
|
363
|
+
* @SystemID: the SYSTEM ID (e.g. filename or URL)
|
364
|
+
*
|
365
|
+
* Callback on internal subset declaration.
|
366
|
+
*/
|
367
|
+
typedef void (*internalSubsetSAXFunc) (void *ctx,
|
368
|
+
const xmlChar *name,
|
369
|
+
const xmlChar *ExternalID,
|
370
|
+
const xmlChar *SystemID);
|
371
|
+
/**
|
372
|
+
* externalSubsetSAXFunc:
|
373
|
+
* @ctx: the user data (XML parser context)
|
374
|
+
* @name: the root element name
|
375
|
+
* @ExternalID: the external ID
|
376
|
+
* @SystemID: the SYSTEM ID (e.g. filename or URL)
|
377
|
+
*
|
378
|
+
* Callback on external subset declaration.
|
379
|
+
*/
|
380
|
+
typedef void (*externalSubsetSAXFunc) (void *ctx,
|
381
|
+
const xmlChar *name,
|
382
|
+
const xmlChar *ExternalID,
|
383
|
+
const xmlChar *SystemID);
|
384
|
+
/**
|
385
|
+
* getEntitySAXFunc:
|
386
|
+
* @ctx: the user data (XML parser context)
|
387
|
+
* @name: The entity name
|
388
|
+
*
|
389
|
+
* Get an entity by name.
|
390
|
+
*
|
391
|
+
* Returns the xmlEntityPtr if found.
|
392
|
+
*/
|
393
|
+
typedef xmlEntityPtr (*getEntitySAXFunc) (void *ctx,
|
394
|
+
const xmlChar *name);
|
395
|
+
/**
|
396
|
+
* getParameterEntitySAXFunc:
|
397
|
+
* @ctx: the user data (XML parser context)
|
398
|
+
* @name: The entity name
|
399
|
+
*
|
400
|
+
* Get a parameter entity by name.
|
401
|
+
*
|
402
|
+
* Returns the xmlEntityPtr if found.
|
403
|
+
*/
|
404
|
+
typedef xmlEntityPtr (*getParameterEntitySAXFunc) (void *ctx,
|
405
|
+
const xmlChar *name);
|
406
|
+
/**
|
407
|
+
* entityDeclSAXFunc:
|
408
|
+
* @ctx: the user data (XML parser context)
|
409
|
+
* @name: the entity name
|
410
|
+
* @type: the entity type
|
411
|
+
* @publicId: The public ID of the entity
|
412
|
+
* @systemId: The system ID of the entity
|
413
|
+
* @content: the entity value (without processing).
|
414
|
+
*
|
415
|
+
* An entity definition has been parsed.
|
416
|
+
*/
|
417
|
+
typedef void (*entityDeclSAXFunc) (void *ctx,
|
418
|
+
const xmlChar *name,
|
419
|
+
int type,
|
420
|
+
const xmlChar *publicId,
|
421
|
+
const xmlChar *systemId,
|
422
|
+
xmlChar *content);
|
423
|
+
/**
|
424
|
+
* notationDeclSAXFunc:
|
425
|
+
* @ctx: the user data (XML parser context)
|
426
|
+
* @name: The name of the notation
|
427
|
+
* @publicId: The public ID of the entity
|
428
|
+
* @systemId: The system ID of the entity
|
429
|
+
*
|
430
|
+
* What to do when a notation declaration has been parsed.
|
431
|
+
*/
|
432
|
+
typedef void (*notationDeclSAXFunc)(void *ctx,
|
433
|
+
const xmlChar *name,
|
434
|
+
const xmlChar *publicId,
|
435
|
+
const xmlChar *systemId);
|
436
|
+
/**
|
437
|
+
* attributeDeclSAXFunc:
|
438
|
+
* @ctx: the user data (XML parser context)
|
439
|
+
* @elem: the name of the element
|
440
|
+
* @fullname: the attribute name
|
441
|
+
* @type: the attribute type
|
442
|
+
* @def: the type of default value
|
443
|
+
* @defaultValue: the attribute default value
|
444
|
+
* @tree: the tree of enumerated value set
|
445
|
+
*
|
446
|
+
* An attribute definition has been parsed.
|
447
|
+
*/
|
448
|
+
typedef void (*attributeDeclSAXFunc)(void *ctx,
|
449
|
+
const xmlChar *elem,
|
450
|
+
const xmlChar *fullname,
|
451
|
+
int type,
|
452
|
+
int def,
|
453
|
+
const xmlChar *defaultValue,
|
454
|
+
xmlEnumerationPtr tree);
|
455
|
+
/**
|
456
|
+
* elementDeclSAXFunc:
|
457
|
+
* @ctx: the user data (XML parser context)
|
458
|
+
* @name: the element name
|
459
|
+
* @type: the element type
|
460
|
+
* @content: the element value tree
|
461
|
+
*
|
462
|
+
* An element definition has been parsed.
|
463
|
+
*/
|
464
|
+
typedef void (*elementDeclSAXFunc)(void *ctx,
|
465
|
+
const xmlChar *name,
|
466
|
+
int type,
|
467
|
+
xmlElementContentPtr content);
|
468
|
+
/**
|
469
|
+
* unparsedEntityDeclSAXFunc:
|
470
|
+
* @ctx: the user data (XML parser context)
|
471
|
+
* @name: The name of the entity
|
472
|
+
* @publicId: The public ID of the entity
|
473
|
+
* @systemId: The system ID of the entity
|
474
|
+
* @notationName: the name of the notation
|
475
|
+
*
|
476
|
+
* What to do when an unparsed entity declaration is parsed.
|
477
|
+
*/
|
478
|
+
typedef void (*unparsedEntityDeclSAXFunc)(void *ctx,
|
479
|
+
const xmlChar *name,
|
480
|
+
const xmlChar *publicId,
|
481
|
+
const xmlChar *systemId,
|
482
|
+
const xmlChar *notationName);
|
483
|
+
/**
|
484
|
+
* setDocumentLocatorSAXFunc:
|
485
|
+
* @ctx: the user data (XML parser context)
|
486
|
+
* @loc: A SAX Locator
|
487
|
+
*
|
488
|
+
* Receive the document locator at startup, actually xmlDefaultSAXLocator.
|
489
|
+
* Everything is available on the context, so this is useless in our case.
|
490
|
+
*/
|
491
|
+
typedef void (*setDocumentLocatorSAXFunc) (void *ctx,
|
492
|
+
xmlSAXLocatorPtr loc);
|
493
|
+
/**
|
494
|
+
* startDocumentSAXFunc:
|
495
|
+
* @ctx: the user data (XML parser context)
|
496
|
+
*
|
497
|
+
* Called when the document start being processed.
|
498
|
+
*/
|
499
|
+
typedef void (*startDocumentSAXFunc) (void *ctx);
|
500
|
+
/**
|
501
|
+
* endDocumentSAXFunc:
|
502
|
+
* @ctx: the user data (XML parser context)
|
503
|
+
*
|
504
|
+
* Called when the document end has been detected.
|
505
|
+
*/
|
506
|
+
typedef void (*endDocumentSAXFunc) (void *ctx);
|
507
|
+
/**
|
508
|
+
* startElementSAXFunc:
|
509
|
+
* @ctx: the user data (XML parser context)
|
510
|
+
* @name: The element name, including namespace prefix
|
511
|
+
* @atts: An array of name/value attributes pairs, NULL terminated
|
512
|
+
*
|
513
|
+
* Called when an opening tag has been processed.
|
514
|
+
*/
|
515
|
+
typedef void (*startElementSAXFunc) (void *ctx,
|
516
|
+
const xmlChar *name,
|
517
|
+
const xmlChar **atts);
|
518
|
+
/**
|
519
|
+
* endElementSAXFunc:
|
520
|
+
* @ctx: the user data (XML parser context)
|
521
|
+
* @name: The element name
|
522
|
+
*
|
523
|
+
* Called when the end of an element has been detected.
|
524
|
+
*/
|
525
|
+
typedef void (*endElementSAXFunc) (void *ctx,
|
526
|
+
const xmlChar *name);
|
527
|
+
/**
|
528
|
+
* attributeSAXFunc:
|
529
|
+
* @ctx: the user data (XML parser context)
|
530
|
+
* @name: The attribute name, including namespace prefix
|
531
|
+
* @value: The attribute value
|
532
|
+
*
|
533
|
+
* Handle an attribute that has been read by the parser.
|
534
|
+
* The default handling is to convert the attribute into an
|
535
|
+
* DOM subtree and past it in a new xmlAttr element added to
|
536
|
+
* the element.
|
537
|
+
*/
|
538
|
+
typedef void (*attributeSAXFunc) (void *ctx,
|
539
|
+
const xmlChar *name,
|
540
|
+
const xmlChar *value);
|
541
|
+
/**
|
542
|
+
* referenceSAXFunc:
|
543
|
+
* @ctx: the user data (XML parser context)
|
544
|
+
* @name: The entity name
|
545
|
+
*
|
546
|
+
* Called when an entity reference is detected.
|
547
|
+
*/
|
548
|
+
typedef void (*referenceSAXFunc) (void *ctx,
|
549
|
+
const xmlChar *name);
|
550
|
+
/**
|
551
|
+
* charactersSAXFunc:
|
552
|
+
* @ctx: the user data (XML parser context)
|
553
|
+
* @ch: a xmlChar string
|
554
|
+
* @len: the number of xmlChar
|
555
|
+
*
|
556
|
+
* Receiving some chars from the parser.
|
557
|
+
*/
|
558
|
+
typedef void (*charactersSAXFunc) (void *ctx,
|
559
|
+
const xmlChar *ch,
|
560
|
+
int len);
|
561
|
+
/**
|
562
|
+
* ignorableWhitespaceSAXFunc:
|
563
|
+
* @ctx: the user data (XML parser context)
|
564
|
+
* @ch: a xmlChar string
|
565
|
+
* @len: the number of xmlChar
|
566
|
+
*
|
567
|
+
* Receiving some ignorable whitespaces from the parser.
|
568
|
+
* UNUSED: by default the DOM building will use characters.
|
569
|
+
*/
|
570
|
+
typedef void (*ignorableWhitespaceSAXFunc) (void *ctx,
|
571
|
+
const xmlChar *ch,
|
572
|
+
int len);
|
573
|
+
/**
|
574
|
+
* processingInstructionSAXFunc:
|
575
|
+
* @ctx: the user data (XML parser context)
|
576
|
+
* @target: the target name
|
577
|
+
* @data: the PI data's
|
578
|
+
*
|
579
|
+
* A processing instruction has been parsed.
|
580
|
+
*/
|
581
|
+
typedef void (*processingInstructionSAXFunc) (void *ctx,
|
582
|
+
const xmlChar *target,
|
583
|
+
const xmlChar *data);
|
584
|
+
/**
|
585
|
+
* commentSAXFunc:
|
586
|
+
* @ctx: the user data (XML parser context)
|
587
|
+
* @value: the comment content
|
588
|
+
*
|
589
|
+
* A comment has been parsed.
|
590
|
+
*/
|
591
|
+
typedef void (*commentSAXFunc) (void *ctx,
|
592
|
+
const xmlChar *value);
|
593
|
+
/**
|
594
|
+
* cdataBlockSAXFunc:
|
595
|
+
* @ctx: the user data (XML parser context)
|
596
|
+
* @value: The pcdata content
|
597
|
+
* @len: the block length
|
598
|
+
*
|
599
|
+
* Called when a pcdata block has been parsed.
|
600
|
+
*/
|
601
|
+
typedef void (*cdataBlockSAXFunc) (
|
602
|
+
void *ctx,
|
603
|
+
const xmlChar *value,
|
604
|
+
int len);
|
605
|
+
/**
|
606
|
+
* warningSAXFunc:
|
607
|
+
* @ctx: an XML parser context
|
608
|
+
* @msg: the message to display/transmit
|
609
|
+
* @...: extra parameters for the message display
|
610
|
+
*
|
611
|
+
* Display and format a warning messages, callback.
|
612
|
+
*/
|
613
|
+
typedef void (*warningSAXFunc) (void *ctx,
|
614
|
+
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
615
|
+
/**
|
616
|
+
* errorSAXFunc:
|
617
|
+
* @ctx: an XML parser context
|
618
|
+
* @msg: the message to display/transmit
|
619
|
+
* @...: extra parameters for the message display
|
620
|
+
*
|
621
|
+
* Display and format an error messages, callback.
|
622
|
+
*/
|
623
|
+
typedef void (*errorSAXFunc) (void *ctx,
|
624
|
+
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
625
|
+
/**
|
626
|
+
* fatalErrorSAXFunc:
|
627
|
+
* @ctx: an XML parser context
|
628
|
+
* @msg: the message to display/transmit
|
629
|
+
* @...: extra parameters for the message display
|
630
|
+
*
|
631
|
+
* Display and format fatal error messages, callback.
|
632
|
+
* Note: so far fatalError() SAX callbacks are not used, error()
|
633
|
+
* get all the callbacks for errors.
|
634
|
+
*/
|
635
|
+
typedef void (*fatalErrorSAXFunc) (void *ctx,
|
636
|
+
const char *msg, ...) LIBXML_ATTR_FORMAT(2,3);
|
637
|
+
/**
|
638
|
+
* isStandaloneSAXFunc:
|
639
|
+
* @ctx: the user data (XML parser context)
|
640
|
+
*
|
641
|
+
* Is this document tagged standalone?
|
642
|
+
*
|
643
|
+
* Returns 1 if true
|
644
|
+
*/
|
645
|
+
typedef int (*isStandaloneSAXFunc) (void *ctx);
|
646
|
+
/**
|
647
|
+
* hasInternalSubsetSAXFunc:
|
648
|
+
* @ctx: the user data (XML parser context)
|
649
|
+
*
|
650
|
+
* Does this document has an internal subset.
|
651
|
+
*
|
652
|
+
* Returns 1 if true
|
653
|
+
*/
|
654
|
+
typedef int (*hasInternalSubsetSAXFunc) (void *ctx);
|
655
|
+
|
656
|
+
/**
|
657
|
+
* hasExternalSubsetSAXFunc:
|
658
|
+
* @ctx: the user data (XML parser context)
|
659
|
+
*
|
660
|
+
* Does this document has an external subset?
|
661
|
+
*
|
662
|
+
* Returns 1 if true
|
663
|
+
*/
|
664
|
+
typedef int (*hasExternalSubsetSAXFunc) (void *ctx);
|
665
|
+
|
666
|
+
/************************************************************************
|
667
|
+
* *
|
668
|
+
* The SAX version 2 API extensions *
|
669
|
+
* *
|
670
|
+
************************************************************************/
|
671
|
+
/**
|
672
|
+
* XML_SAX2_MAGIC:
|
673
|
+
*
|
674
|
+
* Special constant found in SAX2 blocks initialized fields
|
675
|
+
*/
|
676
|
+
#define XML_SAX2_MAGIC 0xDEEDBEAF
|
677
|
+
|
678
|
+
/**
|
679
|
+
* startElementNsSAX2Func:
|
680
|
+
* @ctx: the user data (XML parser context)
|
681
|
+
* @localname: the local name of the element
|
682
|
+
* @prefix: the element namespace prefix if available
|
683
|
+
* @URI: the element namespace name if available
|
684
|
+
* @nb_namespaces: number of namespace definitions on that node
|
685
|
+
* @namespaces: pointer to the array of prefix/URI pairs namespace definitions
|
686
|
+
* @nb_attributes: the number of attributes on that node
|
687
|
+
* @nb_defaulted: the number of defaulted attributes. The defaulted
|
688
|
+
* ones are at the end of the array
|
689
|
+
* @attributes: pointer to the array of (localname/prefix/URI/value/end)
|
690
|
+
* attribute values.
|
691
|
+
*
|
692
|
+
* SAX2 callback when an element start has been detected by the parser.
|
693
|
+
* It provides the namespace information for the element, as well as
|
694
|
+
* the new namespace declarations on the element.
|
695
|
+
*/
|
696
|
+
|
697
|
+
typedef void (*startElementNsSAX2Func) (void *ctx,
|
698
|
+
const xmlChar *localname,
|
699
|
+
const xmlChar *prefix,
|
700
|
+
const xmlChar *URI,
|
701
|
+
int nb_namespaces,
|
702
|
+
const xmlChar **namespaces,
|
703
|
+
int nb_attributes,
|
704
|
+
int nb_defaulted,
|
705
|
+
const xmlChar **attributes);
|
706
|
+
|
707
|
+
/**
|
708
|
+
* endElementNsSAX2Func:
|
709
|
+
* @ctx: the user data (XML parser context)
|
710
|
+
* @localname: the local name of the element
|
711
|
+
* @prefix: the element namespace prefix if available
|
712
|
+
* @URI: the element namespace name if available
|
713
|
+
*
|
714
|
+
* SAX2 callback when an element end has been detected by the parser.
|
715
|
+
* It provides the namespace information for the element.
|
716
|
+
*/
|
717
|
+
|
718
|
+
typedef void (*endElementNsSAX2Func) (void *ctx,
|
719
|
+
const xmlChar *localname,
|
720
|
+
const xmlChar *prefix,
|
721
|
+
const xmlChar *URI);
|
722
|
+
|
723
|
+
|
724
|
+
struct _xmlSAXHandler {
|
725
|
+
internalSubsetSAXFunc internalSubset;
|
726
|
+
isStandaloneSAXFunc isStandalone;
|
727
|
+
hasInternalSubsetSAXFunc hasInternalSubset;
|
728
|
+
hasExternalSubsetSAXFunc hasExternalSubset;
|
729
|
+
resolveEntitySAXFunc resolveEntity;
|
730
|
+
getEntitySAXFunc getEntity;
|
731
|
+
entityDeclSAXFunc entityDecl;
|
732
|
+
notationDeclSAXFunc notationDecl;
|
733
|
+
attributeDeclSAXFunc attributeDecl;
|
734
|
+
elementDeclSAXFunc elementDecl;
|
735
|
+
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
736
|
+
setDocumentLocatorSAXFunc setDocumentLocator;
|
737
|
+
startDocumentSAXFunc startDocument;
|
738
|
+
endDocumentSAXFunc endDocument;
|
739
|
+
/*
|
740
|
+
* `startElement` and `endElement` are only used by the legacy SAX1
|
741
|
+
* interface and should not be used in new software. If you really
|
742
|
+
* have to enable SAX1, the preferred way is set the `initialized`
|
743
|
+
* member to 1 instead of XML_SAX2_MAGIC.
|
744
|
+
*
|
745
|
+
* For backward compatibility, it's also possible to set the
|
746
|
+
* `startElementNs` and `endElementNs` handlers to NULL.
|
747
|
+
*
|
748
|
+
* You can also set the XML_PARSE_SAX1 parser option, but versions
|
749
|
+
* older than 2.12.0 will probably crash if this option is provided
|
750
|
+
* together with custom SAX callbacks.
|
751
|
+
*/
|
752
|
+
startElementSAXFunc startElement;
|
753
|
+
endElementSAXFunc endElement;
|
754
|
+
referenceSAXFunc reference;
|
755
|
+
charactersSAXFunc characters;
|
756
|
+
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
757
|
+
processingInstructionSAXFunc processingInstruction;
|
758
|
+
commentSAXFunc comment;
|
759
|
+
warningSAXFunc warning;
|
760
|
+
errorSAXFunc error;
|
761
|
+
fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
|
762
|
+
getParameterEntitySAXFunc getParameterEntity;
|
763
|
+
cdataBlockSAXFunc cdataBlock;
|
764
|
+
externalSubsetSAXFunc externalSubset;
|
765
|
+
/*
|
766
|
+
* `initialized` should always be set to XML_SAX2_MAGIC to enable the
|
767
|
+
* modern SAX2 interface.
|
768
|
+
*/
|
769
|
+
unsigned int initialized;
|
770
|
+
/*
|
771
|
+
* The following members are only used by the SAX2 interface.
|
772
|
+
*/
|
773
|
+
void *_private;
|
774
|
+
startElementNsSAX2Func startElementNs;
|
775
|
+
endElementNsSAX2Func endElementNs;
|
776
|
+
xmlStructuredErrorFunc serror;
|
777
|
+
};
|
778
|
+
|
779
|
+
/*
|
780
|
+
* SAX Version 1
|
781
|
+
*/
|
782
|
+
typedef struct _xmlSAXHandlerV1 xmlSAXHandlerV1;
|
783
|
+
typedef xmlSAXHandlerV1 *xmlSAXHandlerV1Ptr;
|
784
|
+
struct _xmlSAXHandlerV1 {
|
785
|
+
internalSubsetSAXFunc internalSubset;
|
786
|
+
isStandaloneSAXFunc isStandalone;
|
787
|
+
hasInternalSubsetSAXFunc hasInternalSubset;
|
788
|
+
hasExternalSubsetSAXFunc hasExternalSubset;
|
789
|
+
resolveEntitySAXFunc resolveEntity;
|
790
|
+
getEntitySAXFunc getEntity;
|
791
|
+
entityDeclSAXFunc entityDecl;
|
792
|
+
notationDeclSAXFunc notationDecl;
|
793
|
+
attributeDeclSAXFunc attributeDecl;
|
794
|
+
elementDeclSAXFunc elementDecl;
|
795
|
+
unparsedEntityDeclSAXFunc unparsedEntityDecl;
|
796
|
+
setDocumentLocatorSAXFunc setDocumentLocator;
|
797
|
+
startDocumentSAXFunc startDocument;
|
798
|
+
endDocumentSAXFunc endDocument;
|
799
|
+
startElementSAXFunc startElement;
|
800
|
+
endElementSAXFunc endElement;
|
801
|
+
referenceSAXFunc reference;
|
802
|
+
charactersSAXFunc characters;
|
803
|
+
ignorableWhitespaceSAXFunc ignorableWhitespace;
|
804
|
+
processingInstructionSAXFunc processingInstruction;
|
805
|
+
commentSAXFunc comment;
|
806
|
+
warningSAXFunc warning;
|
807
|
+
errorSAXFunc error;
|
808
|
+
fatalErrorSAXFunc fatalError; /* unused error() get all the errors */
|
809
|
+
getParameterEntitySAXFunc getParameterEntity;
|
810
|
+
cdataBlockSAXFunc cdataBlock;
|
811
|
+
externalSubsetSAXFunc externalSubset;
|
812
|
+
unsigned int initialized;
|
813
|
+
};
|
814
|
+
|
815
|
+
|
816
|
+
/**
|
817
|
+
* xmlExternalEntityLoader:
|
818
|
+
* @URL: The System ID of the resource requested
|
819
|
+
* @ID: The Public ID of the resource requested
|
820
|
+
* @context: the XML parser context
|
821
|
+
*
|
822
|
+
* External entity loaders types.
|
823
|
+
*
|
824
|
+
* Returns the entity input parser.
|
825
|
+
*/
|
826
|
+
typedef xmlParserInputPtr (*xmlExternalEntityLoader) (const char *URL,
|
827
|
+
const char *ID,
|
828
|
+
xmlParserCtxtPtr context);
|
829
|
+
|
830
|
+
/*
|
831
|
+
* Variables
|
832
|
+
*/
|
833
|
+
|
834
|
+
XMLPUBVAR const char *const xmlParserVersion;
|
835
|
+
XML_DEPRECATED
|
836
|
+
XMLPUBVAR const int oldXMLWDcompatibility;
|
837
|
+
XML_DEPRECATED
|
838
|
+
XMLPUBVAR const int xmlParserDebugEntities;
|
839
|
+
XML_DEPRECATED
|
840
|
+
XMLPUBVAR const xmlSAXLocator xmlDefaultSAXLocator;
|
841
|
+
#ifdef LIBXML_SAX1_ENABLED
|
842
|
+
XML_DEPRECATED
|
843
|
+
XMLPUBVAR const xmlSAXHandlerV1 xmlDefaultSAXHandler;
|
844
|
+
#endif
|
845
|
+
|
846
|
+
#ifdef LIBXML_THREAD_ENABLED
|
847
|
+
/* backward compatibility */
|
848
|
+
XMLPUBFUN const char *const *__xmlParserVersion(void);
|
849
|
+
XML_DEPRECATED
|
850
|
+
XMLPUBFUN const int *__oldXMLWDcompatibility(void);
|
851
|
+
XML_DEPRECATED
|
852
|
+
XMLPUBFUN const int *__xmlParserDebugEntities(void);
|
853
|
+
XML_DEPRECATED
|
854
|
+
XMLPUBFUN const xmlSAXLocator *__xmlDefaultSAXLocator(void);
|
855
|
+
#ifdef LIBXML_SAX1_ENABLED
|
856
|
+
XML_DEPRECATED
|
857
|
+
XMLPUBFUN const xmlSAXHandlerV1 *__xmlDefaultSAXHandler(void);
|
858
|
+
#endif
|
859
|
+
#endif
|
860
|
+
|
861
|
+
/** DOC_DISABLE */
|
862
|
+
#define XML_GLOBALS_PARSER_CORE \
|
863
|
+
XML_OP(xmlDoValidityCheckingDefaultValue, int, XML_DEPRECATED) \
|
864
|
+
XML_OP(xmlGetWarningsDefaultValue, int, XML_DEPRECATED) \
|
865
|
+
XML_OP(xmlKeepBlanksDefaultValue, int, XML_DEPRECATED) \
|
866
|
+
XML_OP(xmlLineNumbersDefaultValue, int, XML_DEPRECATED) \
|
867
|
+
XML_OP(xmlLoadExtDtdDefaultValue, int, XML_DEPRECATED) \
|
868
|
+
XML_OP(xmlPedanticParserDefaultValue, int, XML_DEPRECATED) \
|
869
|
+
XML_OP(xmlSubstituteEntitiesDefaultValue, int, XML_DEPRECATED)
|
870
|
+
|
871
|
+
#ifdef LIBXML_OUTPUT_ENABLED
|
872
|
+
#define XML_GLOBALS_PARSER_OUTPUT \
|
873
|
+
XML_OP(xmlIndentTreeOutput, int, XML_NO_ATTR) \
|
874
|
+
XML_OP(xmlTreeIndentString, const char *, XML_NO_ATTR) \
|
875
|
+
XML_OP(xmlSaveNoEmptyTags, int, XML_NO_ATTR)
|
876
|
+
#else
|
877
|
+
#define XML_GLOBALS_PARSER_OUTPUT
|
878
|
+
#endif
|
879
|
+
|
880
|
+
#define XML_GLOBALS_PARSER \
|
881
|
+
XML_GLOBALS_PARSER_CORE \
|
882
|
+
XML_GLOBALS_PARSER_OUTPUT
|
883
|
+
|
884
|
+
#define XML_OP XML_DECLARE_GLOBAL
|
885
|
+
XML_GLOBALS_PARSER
|
886
|
+
#undef XML_OP
|
887
|
+
|
888
|
+
#if defined(LIBXML_THREAD_ENABLED) && !defined(XML_GLOBALS_NO_REDEFINITION)
|
889
|
+
#define xmlDoValidityCheckingDefaultValue \
|
890
|
+
XML_GLOBAL_MACRO(xmlDoValidityCheckingDefaultValue)
|
891
|
+
#define xmlGetWarningsDefaultValue \
|
892
|
+
XML_GLOBAL_MACRO(xmlGetWarningsDefaultValue)
|
893
|
+
#define xmlKeepBlanksDefaultValue XML_GLOBAL_MACRO(xmlKeepBlanksDefaultValue)
|
894
|
+
#define xmlLineNumbersDefaultValue \
|
895
|
+
XML_GLOBAL_MACRO(xmlLineNumbersDefaultValue)
|
896
|
+
#define xmlLoadExtDtdDefaultValue XML_GLOBAL_MACRO(xmlLoadExtDtdDefaultValue)
|
897
|
+
#define xmlPedanticParserDefaultValue \
|
898
|
+
XML_GLOBAL_MACRO(xmlPedanticParserDefaultValue)
|
899
|
+
#define xmlSubstituteEntitiesDefaultValue \
|
900
|
+
XML_GLOBAL_MACRO(xmlSubstituteEntitiesDefaultValue)
|
901
|
+
#ifdef LIBXML_OUTPUT_ENABLED
|
902
|
+
#define xmlIndentTreeOutput XML_GLOBAL_MACRO(xmlIndentTreeOutput)
|
903
|
+
#define xmlTreeIndentString XML_GLOBAL_MACRO(xmlTreeIndentString)
|
904
|
+
#define xmlSaveNoEmptyTags XML_GLOBAL_MACRO(xmlSaveNoEmptyTags)
|
905
|
+
#endif
|
906
|
+
#endif
|
907
|
+
/** DOC_ENABLE */
|
908
|
+
|
909
|
+
/*
|
910
|
+
* Init/Cleanup
|
911
|
+
*/
|
912
|
+
XMLPUBFUN void
|
913
|
+
xmlInitParser (void);
|
914
|
+
XMLPUBFUN void
|
915
|
+
xmlCleanupParser (void);
|
916
|
+
XML_DEPRECATED
|
917
|
+
XMLPUBFUN void
|
918
|
+
xmlInitGlobals (void);
|
919
|
+
XML_DEPRECATED
|
920
|
+
XMLPUBFUN void
|
921
|
+
xmlCleanupGlobals (void);
|
922
|
+
|
923
|
+
/*
|
924
|
+
* Input functions
|
925
|
+
*/
|
926
|
+
XML_DEPRECATED
|
927
|
+
XMLPUBFUN int
|
928
|
+
xmlParserInputRead (xmlParserInputPtr in,
|
929
|
+
int len);
|
930
|
+
XML_DEPRECATED
|
931
|
+
XMLPUBFUN int
|
932
|
+
xmlParserInputGrow (xmlParserInputPtr in,
|
933
|
+
int len);
|
934
|
+
|
935
|
+
/*
|
936
|
+
* Basic parsing Interfaces
|
937
|
+
*/
|
938
|
+
#ifdef LIBXML_SAX1_ENABLED
|
939
|
+
XMLPUBFUN xmlDocPtr
|
940
|
+
xmlParseDoc (const xmlChar *cur);
|
941
|
+
XMLPUBFUN xmlDocPtr
|
942
|
+
xmlParseFile (const char *filename);
|
943
|
+
XMLPUBFUN xmlDocPtr
|
944
|
+
xmlParseMemory (const char *buffer,
|
945
|
+
int size);
|
946
|
+
#endif /* LIBXML_SAX1_ENABLED */
|
947
|
+
XML_DEPRECATED XMLPUBFUN int
|
948
|
+
xmlSubstituteEntitiesDefault(int val);
|
949
|
+
XML_DEPRECATED XMLPUBFUN int
|
950
|
+
xmlThrDefSubstituteEntitiesDefaultValue(int v);
|
951
|
+
XMLPUBFUN int
|
952
|
+
xmlKeepBlanksDefault (int val);
|
953
|
+
XML_DEPRECATED XMLPUBFUN int
|
954
|
+
xmlThrDefKeepBlanksDefaultValue(int v);
|
955
|
+
XMLPUBFUN void
|
956
|
+
xmlStopParser (xmlParserCtxtPtr ctxt);
|
957
|
+
XML_DEPRECATED XMLPUBFUN int
|
958
|
+
xmlPedanticParserDefault(int val);
|
959
|
+
XML_DEPRECATED XMLPUBFUN int
|
960
|
+
xmlThrDefPedanticParserDefaultValue(int v);
|
961
|
+
XML_DEPRECATED XMLPUBFUN int
|
962
|
+
xmlLineNumbersDefault (int val);
|
963
|
+
XML_DEPRECATED XMLPUBFUN int
|
964
|
+
xmlThrDefLineNumbersDefaultValue(int v);
|
965
|
+
XML_DEPRECATED XMLPUBFUN int
|
966
|
+
xmlThrDefDoValidityCheckingDefaultValue(int v);
|
967
|
+
XML_DEPRECATED XMLPUBFUN int
|
968
|
+
xmlThrDefGetWarningsDefaultValue(int v);
|
969
|
+
XML_DEPRECATED XMLPUBFUN int
|
970
|
+
xmlThrDefLoadExtDtdDefaultValue(int v);
|
971
|
+
XML_DEPRECATED XMLPUBFUN int
|
972
|
+
xmlThrDefParserDebugEntities(int v);
|
973
|
+
|
974
|
+
#ifdef LIBXML_SAX1_ENABLED
|
975
|
+
/*
|
976
|
+
* Recovery mode
|
977
|
+
*/
|
978
|
+
XML_DEPRECATED
|
979
|
+
XMLPUBFUN xmlDocPtr
|
980
|
+
xmlRecoverDoc (const xmlChar *cur);
|
981
|
+
XML_DEPRECATED
|
982
|
+
XMLPUBFUN xmlDocPtr
|
983
|
+
xmlRecoverMemory (const char *buffer,
|
984
|
+
int size);
|
985
|
+
XML_DEPRECATED
|
986
|
+
XMLPUBFUN xmlDocPtr
|
987
|
+
xmlRecoverFile (const char *filename);
|
988
|
+
#endif /* LIBXML_SAX1_ENABLED */
|
989
|
+
|
990
|
+
/*
|
991
|
+
* Less common routines and SAX interfaces
|
992
|
+
*/
|
993
|
+
XMLPUBFUN int
|
994
|
+
xmlParseDocument (xmlParserCtxtPtr ctxt);
|
995
|
+
XMLPUBFUN int
|
996
|
+
xmlParseExtParsedEnt (xmlParserCtxtPtr ctxt);
|
997
|
+
#ifdef LIBXML_SAX1_ENABLED
|
998
|
+
XML_DEPRECATED
|
999
|
+
XMLPUBFUN int
|
1000
|
+
xmlSAXUserParseFile (xmlSAXHandlerPtr sax,
|
1001
|
+
void *user_data,
|
1002
|
+
const char *filename);
|
1003
|
+
XML_DEPRECATED
|
1004
|
+
XMLPUBFUN int
|
1005
|
+
xmlSAXUserParseMemory (xmlSAXHandlerPtr sax,
|
1006
|
+
void *user_data,
|
1007
|
+
const char *buffer,
|
1008
|
+
int size);
|
1009
|
+
XML_DEPRECATED
|
1010
|
+
XMLPUBFUN xmlDocPtr
|
1011
|
+
xmlSAXParseDoc (xmlSAXHandlerPtr sax,
|
1012
|
+
const xmlChar *cur,
|
1013
|
+
int recovery);
|
1014
|
+
XML_DEPRECATED
|
1015
|
+
XMLPUBFUN xmlDocPtr
|
1016
|
+
xmlSAXParseMemory (xmlSAXHandlerPtr sax,
|
1017
|
+
const char *buffer,
|
1018
|
+
int size,
|
1019
|
+
int recovery);
|
1020
|
+
XML_DEPRECATED
|
1021
|
+
XMLPUBFUN xmlDocPtr
|
1022
|
+
xmlSAXParseMemoryWithData (xmlSAXHandlerPtr sax,
|
1023
|
+
const char *buffer,
|
1024
|
+
int size,
|
1025
|
+
int recovery,
|
1026
|
+
void *data);
|
1027
|
+
XML_DEPRECATED
|
1028
|
+
XMLPUBFUN xmlDocPtr
|
1029
|
+
xmlSAXParseFile (xmlSAXHandlerPtr sax,
|
1030
|
+
const char *filename,
|
1031
|
+
int recovery);
|
1032
|
+
XML_DEPRECATED
|
1033
|
+
XMLPUBFUN xmlDocPtr
|
1034
|
+
xmlSAXParseFileWithData (xmlSAXHandlerPtr sax,
|
1035
|
+
const char *filename,
|
1036
|
+
int recovery,
|
1037
|
+
void *data);
|
1038
|
+
XML_DEPRECATED
|
1039
|
+
XMLPUBFUN xmlDocPtr
|
1040
|
+
xmlSAXParseEntity (xmlSAXHandlerPtr sax,
|
1041
|
+
const char *filename);
|
1042
|
+
XML_DEPRECATED
|
1043
|
+
XMLPUBFUN xmlDocPtr
|
1044
|
+
xmlParseEntity (const char *filename);
|
1045
|
+
#endif /* LIBXML_SAX1_ENABLED */
|
1046
|
+
|
1047
|
+
#ifdef LIBXML_VALID_ENABLED
|
1048
|
+
XML_DEPRECATED
|
1049
|
+
XMLPUBFUN xmlDtdPtr
|
1050
|
+
xmlSAXParseDTD (xmlSAXHandlerPtr sax,
|
1051
|
+
const xmlChar *ExternalID,
|
1052
|
+
const xmlChar *SystemID);
|
1053
|
+
XMLPUBFUN xmlDtdPtr
|
1054
|
+
xmlParseDTD (const xmlChar *ExternalID,
|
1055
|
+
const xmlChar *SystemID);
|
1056
|
+
XMLPUBFUN xmlDtdPtr
|
1057
|
+
xmlIOParseDTD (xmlSAXHandlerPtr sax,
|
1058
|
+
xmlParserInputBufferPtr input,
|
1059
|
+
xmlCharEncoding enc);
|
1060
|
+
#endif /* LIBXML_VALID_ENABLE */
|
1061
|
+
#ifdef LIBXML_SAX1_ENABLED
|
1062
|
+
XMLPUBFUN int
|
1063
|
+
xmlParseBalancedChunkMemory(xmlDocPtr doc,
|
1064
|
+
xmlSAXHandlerPtr sax,
|
1065
|
+
void *user_data,
|
1066
|
+
int depth,
|
1067
|
+
const xmlChar *string,
|
1068
|
+
xmlNodePtr *lst);
|
1069
|
+
#endif /* LIBXML_SAX1_ENABLED */
|
1070
|
+
XMLPUBFUN xmlParserErrors
|
1071
|
+
xmlParseInNodeContext (xmlNodePtr node,
|
1072
|
+
const char *data,
|
1073
|
+
int datalen,
|
1074
|
+
int options,
|
1075
|
+
xmlNodePtr *lst);
|
1076
|
+
#ifdef LIBXML_SAX1_ENABLED
|
1077
|
+
XMLPUBFUN int
|
1078
|
+
xmlParseBalancedChunkMemoryRecover(xmlDocPtr doc,
|
1079
|
+
xmlSAXHandlerPtr sax,
|
1080
|
+
void *user_data,
|
1081
|
+
int depth,
|
1082
|
+
const xmlChar *string,
|
1083
|
+
xmlNodePtr *lst,
|
1084
|
+
int recover);
|
1085
|
+
XML_DEPRECATED
|
1086
|
+
XMLPUBFUN int
|
1087
|
+
xmlParseExternalEntity (xmlDocPtr doc,
|
1088
|
+
xmlSAXHandlerPtr sax,
|
1089
|
+
void *user_data,
|
1090
|
+
int depth,
|
1091
|
+
const xmlChar *URL,
|
1092
|
+
const xmlChar *ID,
|
1093
|
+
xmlNodePtr *lst);
|
1094
|
+
#endif /* LIBXML_SAX1_ENABLED */
|
1095
|
+
XMLPUBFUN int
|
1096
|
+
xmlParseCtxtExternalEntity(xmlParserCtxtPtr ctx,
|
1097
|
+
const xmlChar *URL,
|
1098
|
+
const xmlChar *ID,
|
1099
|
+
xmlNodePtr *lst);
|
1100
|
+
|
1101
|
+
/*
|
1102
|
+
* Parser contexts handling.
|
1103
|
+
*/
|
1104
|
+
XMLPUBFUN xmlParserCtxtPtr
|
1105
|
+
xmlNewParserCtxt (void);
|
1106
|
+
XMLPUBFUN xmlParserCtxtPtr
|
1107
|
+
xmlNewSAXParserCtxt (const xmlSAXHandler *sax,
|
1108
|
+
void *userData);
|
1109
|
+
XMLPUBFUN int
|
1110
|
+
xmlInitParserCtxt (xmlParserCtxtPtr ctxt);
|
1111
|
+
XMLPUBFUN void
|
1112
|
+
xmlClearParserCtxt (xmlParserCtxtPtr ctxt);
|
1113
|
+
XMLPUBFUN void
|
1114
|
+
xmlFreeParserCtxt (xmlParserCtxtPtr ctxt);
|
1115
|
+
#ifdef LIBXML_SAX1_ENABLED
|
1116
|
+
XML_DEPRECATED
|
1117
|
+
XMLPUBFUN void
|
1118
|
+
xmlSetupParserForBuffer (xmlParserCtxtPtr ctxt,
|
1119
|
+
const xmlChar* buffer,
|
1120
|
+
const char *filename);
|
1121
|
+
#endif /* LIBXML_SAX1_ENABLED */
|
1122
|
+
XMLPUBFUN xmlParserCtxtPtr
|
1123
|
+
xmlCreateDocParserCtxt (const xmlChar *cur);
|
1124
|
+
|
1125
|
+
#ifdef LIBXML_LEGACY_ENABLED
|
1126
|
+
/*
|
1127
|
+
* Reading/setting optional parsing features.
|
1128
|
+
*/
|
1129
|
+
XML_DEPRECATED
|
1130
|
+
XMLPUBFUN int
|
1131
|
+
xmlGetFeaturesList (int *len,
|
1132
|
+
const char **result);
|
1133
|
+
XML_DEPRECATED
|
1134
|
+
XMLPUBFUN int
|
1135
|
+
xmlGetFeature (xmlParserCtxtPtr ctxt,
|
1136
|
+
const char *name,
|
1137
|
+
void *result);
|
1138
|
+
XML_DEPRECATED
|
1139
|
+
XMLPUBFUN int
|
1140
|
+
xmlSetFeature (xmlParserCtxtPtr ctxt,
|
1141
|
+
const char *name,
|
1142
|
+
void *value);
|
1143
|
+
#endif /* LIBXML_LEGACY_ENABLED */
|
1144
|
+
|
1145
|
+
#ifdef LIBXML_PUSH_ENABLED
|
1146
|
+
/*
|
1147
|
+
* Interfaces for the Push mode.
|
1148
|
+
*/
|
1149
|
+
XMLPUBFUN xmlParserCtxtPtr
|
1150
|
+
xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax,
|
1151
|
+
void *user_data,
|
1152
|
+
const char *chunk,
|
1153
|
+
int size,
|
1154
|
+
const char *filename);
|
1155
|
+
XMLPUBFUN int
|
1156
|
+
xmlParseChunk (xmlParserCtxtPtr ctxt,
|
1157
|
+
const char *chunk,
|
1158
|
+
int size,
|
1159
|
+
int terminate);
|
1160
|
+
#endif /* LIBXML_PUSH_ENABLED */
|
1161
|
+
|
1162
|
+
/*
|
1163
|
+
* Special I/O mode.
|
1164
|
+
*/
|
1165
|
+
|
1166
|
+
XMLPUBFUN xmlParserCtxtPtr
|
1167
|
+
xmlCreateIOParserCtxt (xmlSAXHandlerPtr sax,
|
1168
|
+
void *user_data,
|
1169
|
+
xmlInputReadCallback ioread,
|
1170
|
+
xmlInputCloseCallback ioclose,
|
1171
|
+
void *ioctx,
|
1172
|
+
xmlCharEncoding enc);
|
1173
|
+
|
1174
|
+
XMLPUBFUN xmlParserInputPtr
|
1175
|
+
xmlNewIOInputStream (xmlParserCtxtPtr ctxt,
|
1176
|
+
xmlParserInputBufferPtr input,
|
1177
|
+
xmlCharEncoding enc);
|
1178
|
+
|
1179
|
+
/*
|
1180
|
+
* Node infos.
|
1181
|
+
*/
|
1182
|
+
XMLPUBFUN const xmlParserNodeInfo*
|
1183
|
+
xmlParserFindNodeInfo (xmlParserCtxtPtr ctxt,
|
1184
|
+
xmlNodePtr node);
|
1185
|
+
XMLPUBFUN void
|
1186
|
+
xmlInitNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
|
1187
|
+
XMLPUBFUN void
|
1188
|
+
xmlClearNodeInfoSeq (xmlParserNodeInfoSeqPtr seq);
|
1189
|
+
XMLPUBFUN unsigned long
|
1190
|
+
xmlParserFindNodeInfoIndex(xmlParserNodeInfoSeqPtr seq,
|
1191
|
+
xmlNodePtr node);
|
1192
|
+
XMLPUBFUN void
|
1193
|
+
xmlParserAddNodeInfo (xmlParserCtxtPtr ctxt,
|
1194
|
+
xmlParserNodeInfoPtr info);
|
1195
|
+
|
1196
|
+
/*
|
1197
|
+
* External entities handling actually implemented in xmlIO.
|
1198
|
+
*/
|
1199
|
+
|
1200
|
+
XMLPUBFUN void
|
1201
|
+
xmlSetExternalEntityLoader(xmlExternalEntityLoader f);
|
1202
|
+
XMLPUBFUN xmlExternalEntityLoader
|
1203
|
+
xmlGetExternalEntityLoader(void);
|
1204
|
+
XMLPUBFUN xmlParserInputPtr
|
1205
|
+
xmlLoadExternalEntity (const char *URL,
|
1206
|
+
const char *ID,
|
1207
|
+
xmlParserCtxtPtr ctxt);
|
1208
|
+
|
1209
|
+
/*
|
1210
|
+
* Index lookup, actually implemented in the encoding module
|
1211
|
+
*/
|
1212
|
+
XMLPUBFUN long
|
1213
|
+
xmlByteConsumed (xmlParserCtxtPtr ctxt);
|
1214
|
+
|
1215
|
+
/*
|
1216
|
+
* New set of simpler/more flexible APIs
|
1217
|
+
*/
|
1218
|
+
/**
|
1219
|
+
* xmlParserOption:
|
1220
|
+
*
|
1221
|
+
* This is the set of XML parser options that can be passed down
|
1222
|
+
* to the xmlReadDoc() and similar calls.
|
1223
|
+
*/
|
1224
|
+
typedef enum {
|
1225
|
+
XML_PARSE_RECOVER = 1<<0, /* recover on errors */
|
1226
|
+
XML_PARSE_NOENT = 1<<1, /* substitute entities */
|
1227
|
+
XML_PARSE_DTDLOAD = 1<<2, /* load the external subset */
|
1228
|
+
XML_PARSE_DTDATTR = 1<<3, /* default DTD attributes */
|
1229
|
+
XML_PARSE_DTDVALID = 1<<4, /* validate with the DTD */
|
1230
|
+
XML_PARSE_NOERROR = 1<<5, /* suppress error reports */
|
1231
|
+
XML_PARSE_NOWARNING = 1<<6, /* suppress warning reports */
|
1232
|
+
XML_PARSE_PEDANTIC = 1<<7, /* pedantic error reporting */
|
1233
|
+
XML_PARSE_NOBLANKS = 1<<8, /* remove blank nodes */
|
1234
|
+
XML_PARSE_SAX1 = 1<<9, /* use the SAX1 interface internally */
|
1235
|
+
XML_PARSE_XINCLUDE = 1<<10,/* Implement XInclude substitution */
|
1236
|
+
XML_PARSE_NONET = 1<<11,/* Forbid network access */
|
1237
|
+
XML_PARSE_NODICT = 1<<12,/* Do not reuse the context dictionary */
|
1238
|
+
XML_PARSE_NSCLEAN = 1<<13,/* remove redundant namespaces declarations */
|
1239
|
+
XML_PARSE_NOCDATA = 1<<14,/* merge CDATA as text nodes */
|
1240
|
+
XML_PARSE_NOXINCNODE= 1<<15,/* do not generate XINCLUDE START/END nodes */
|
1241
|
+
XML_PARSE_COMPACT = 1<<16,/* compact small text nodes; no modification of
|
1242
|
+
the tree allowed afterwards (will possibly
|
1243
|
+
crash if you try to modify the tree) */
|
1244
|
+
XML_PARSE_OLD10 = 1<<17,/* parse using XML-1.0 before update 5 */
|
1245
|
+
XML_PARSE_NOBASEFIX = 1<<18,/* do not fixup XINCLUDE xml:base uris */
|
1246
|
+
XML_PARSE_HUGE = 1<<19,/* relax any hardcoded limit from the parser */
|
1247
|
+
XML_PARSE_OLDSAX = 1<<20,/* parse using SAX2 interface before 2.7.0 */
|
1248
|
+
XML_PARSE_IGNORE_ENC= 1<<21,/* ignore internal document encoding hint */
|
1249
|
+
XML_PARSE_BIG_LINES = 1<<22,/* Store big lines numbers in text PSVI field */
|
1250
|
+
XML_PARSE_NO_XXE = 1<<23 /* disable loading of external content */
|
1251
|
+
} xmlParserOption;
|
1252
|
+
|
1253
|
+
XMLPUBFUN void
|
1254
|
+
xmlCtxtReset (xmlParserCtxtPtr ctxt);
|
1255
|
+
XMLPUBFUN int
|
1256
|
+
xmlCtxtResetPush (xmlParserCtxtPtr ctxt,
|
1257
|
+
const char *chunk,
|
1258
|
+
int size,
|
1259
|
+
const char *filename,
|
1260
|
+
const char *encoding);
|
1261
|
+
XMLPUBFUN int
|
1262
|
+
xmlCtxtSetOptions (xmlParserCtxtPtr ctxt,
|
1263
|
+
int options);
|
1264
|
+
XMLPUBFUN int
|
1265
|
+
xmlCtxtUseOptions (xmlParserCtxtPtr ctxt,
|
1266
|
+
int options);
|
1267
|
+
XMLPUBFUN void
|
1268
|
+
xmlCtxtSetErrorHandler (xmlParserCtxtPtr ctxt,
|
1269
|
+
xmlStructuredErrorFunc handler,
|
1270
|
+
void *data);
|
1271
|
+
XMLPUBFUN void
|
1272
|
+
xmlCtxtSetMaxAmplification(xmlParserCtxtPtr ctxt,
|
1273
|
+
unsigned maxAmpl);
|
1274
|
+
XMLPUBFUN xmlDocPtr
|
1275
|
+
xmlReadDoc (const xmlChar *cur,
|
1276
|
+
const char *URL,
|
1277
|
+
const char *encoding,
|
1278
|
+
int options);
|
1279
|
+
XMLPUBFUN xmlDocPtr
|
1280
|
+
xmlReadFile (const char *URL,
|
1281
|
+
const char *encoding,
|
1282
|
+
int options);
|
1283
|
+
XMLPUBFUN xmlDocPtr
|
1284
|
+
xmlReadMemory (const char *buffer,
|
1285
|
+
int size,
|
1286
|
+
const char *URL,
|
1287
|
+
const char *encoding,
|
1288
|
+
int options);
|
1289
|
+
XMLPUBFUN xmlDocPtr
|
1290
|
+
xmlReadFd (int fd,
|
1291
|
+
const char *URL,
|
1292
|
+
const char *encoding,
|
1293
|
+
int options);
|
1294
|
+
XMLPUBFUN xmlDocPtr
|
1295
|
+
xmlReadIO (xmlInputReadCallback ioread,
|
1296
|
+
xmlInputCloseCallback ioclose,
|
1297
|
+
void *ioctx,
|
1298
|
+
const char *URL,
|
1299
|
+
const char *encoding,
|
1300
|
+
int options);
|
1301
|
+
XMLPUBFUN xmlDocPtr
|
1302
|
+
xmlCtxtParseDocument (xmlParserCtxtPtr ctxt,
|
1303
|
+
xmlParserInputPtr input);
|
1304
|
+
XMLPUBFUN xmlDocPtr
|
1305
|
+
xmlCtxtReadDoc (xmlParserCtxtPtr ctxt,
|
1306
|
+
const xmlChar *cur,
|
1307
|
+
const char *URL,
|
1308
|
+
const char *encoding,
|
1309
|
+
int options);
|
1310
|
+
XMLPUBFUN xmlDocPtr
|
1311
|
+
xmlCtxtReadFile (xmlParserCtxtPtr ctxt,
|
1312
|
+
const char *filename,
|
1313
|
+
const char *encoding,
|
1314
|
+
int options);
|
1315
|
+
XMLPUBFUN xmlDocPtr
|
1316
|
+
xmlCtxtReadMemory (xmlParserCtxtPtr ctxt,
|
1317
|
+
const char *buffer,
|
1318
|
+
int size,
|
1319
|
+
const char *URL,
|
1320
|
+
const char *encoding,
|
1321
|
+
int options);
|
1322
|
+
XMLPUBFUN xmlDocPtr
|
1323
|
+
xmlCtxtReadFd (xmlParserCtxtPtr ctxt,
|
1324
|
+
int fd,
|
1325
|
+
const char *URL,
|
1326
|
+
const char *encoding,
|
1327
|
+
int options);
|
1328
|
+
XMLPUBFUN xmlDocPtr
|
1329
|
+
xmlCtxtReadIO (xmlParserCtxtPtr ctxt,
|
1330
|
+
xmlInputReadCallback ioread,
|
1331
|
+
xmlInputCloseCallback ioclose,
|
1332
|
+
void *ioctx,
|
1333
|
+
const char *URL,
|
1334
|
+
const char *encoding,
|
1335
|
+
int options);
|
1336
|
+
|
1337
|
+
/*
|
1338
|
+
* Library wide options
|
1339
|
+
*/
|
1340
|
+
/**
|
1341
|
+
* xmlFeature:
|
1342
|
+
*
|
1343
|
+
* Used to examine the existence of features that can be enabled
|
1344
|
+
* or disabled at compile-time.
|
1345
|
+
* They used to be called XML_FEATURE_xxx but this clashed with Expat
|
1346
|
+
*/
|
1347
|
+
typedef enum {
|
1348
|
+
XML_WITH_THREAD = 1,
|
1349
|
+
XML_WITH_TREE = 2,
|
1350
|
+
XML_WITH_OUTPUT = 3,
|
1351
|
+
XML_WITH_PUSH = 4,
|
1352
|
+
XML_WITH_READER = 5,
|
1353
|
+
XML_WITH_PATTERN = 6,
|
1354
|
+
XML_WITH_WRITER = 7,
|
1355
|
+
XML_WITH_SAX1 = 8,
|
1356
|
+
XML_WITH_FTP = 9,
|
1357
|
+
XML_WITH_HTTP = 10,
|
1358
|
+
XML_WITH_VALID = 11,
|
1359
|
+
XML_WITH_HTML = 12,
|
1360
|
+
XML_WITH_LEGACY = 13,
|
1361
|
+
XML_WITH_C14N = 14,
|
1362
|
+
XML_WITH_CATALOG = 15,
|
1363
|
+
XML_WITH_XPATH = 16,
|
1364
|
+
XML_WITH_XPTR = 17,
|
1365
|
+
XML_WITH_XINCLUDE = 18,
|
1366
|
+
XML_WITH_ICONV = 19,
|
1367
|
+
XML_WITH_ISO8859X = 20,
|
1368
|
+
XML_WITH_UNICODE = 21,
|
1369
|
+
XML_WITH_REGEXP = 22,
|
1370
|
+
XML_WITH_AUTOMATA = 23,
|
1371
|
+
XML_WITH_EXPR = 24,
|
1372
|
+
XML_WITH_SCHEMAS = 25,
|
1373
|
+
XML_WITH_SCHEMATRON = 26,
|
1374
|
+
XML_WITH_MODULES = 27,
|
1375
|
+
XML_WITH_DEBUG = 28,
|
1376
|
+
XML_WITH_DEBUG_MEM = 29,
|
1377
|
+
XML_WITH_DEBUG_RUN = 30, /* unused */
|
1378
|
+
XML_WITH_ZLIB = 31,
|
1379
|
+
XML_WITH_ICU = 32,
|
1380
|
+
XML_WITH_LZMA = 33,
|
1381
|
+
XML_WITH_NONE = 99999 /* just to be sure of allocation size */
|
1382
|
+
} xmlFeature;
|
1383
|
+
|
1384
|
+
XMLPUBFUN int
|
1385
|
+
xmlHasFeature (xmlFeature feature);
|
1386
|
+
|
1387
|
+
#ifdef __cplusplus
|
1388
|
+
}
|
1389
|
+
#endif
|
1390
|
+
#endif /* __XML_PARSER_H__ */
|