nokogiri 1.11.0.rc1-x86-mingw32 → 1.11.1-x86-mingw32
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 +4 -4
- data/Gemfile +3 -0
- data/LICENSE-DEPENDENCIES.md +1015 -947
- data/README.md +164 -92
- data/ext/nokogiri/depend +476 -357
- data/ext/nokogiri/extconf.rb +467 -326
- data/ext/nokogiri/html_document.c +79 -78
- data/ext/nokogiri/html_sax_parser_context.c +4 -2
- data/ext/nokogiri/html_sax_push_parser.c +14 -8
- 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 +126 -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 +1241 -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 +366 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +945 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +153 -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 +566 -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/nokogiri.c +37 -46
- data/ext/nokogiri/nokogiri.h +25 -17
- data/ext/nokogiri/test_global_handlers.c +41 -0
- data/ext/nokogiri/xml_document.c +8 -3
- data/ext/nokogiri/xml_io.c +8 -6
- data/ext/nokogiri/xml_node.c +1 -1
- data/ext/nokogiri/xml_node_set.c +1 -1
- data/ext/nokogiri/xml_reader.c +6 -17
- data/ext/nokogiri/xml_relax_ng.c +29 -11
- data/ext/nokogiri/xml_sax_parser.c +2 -7
- data/ext/nokogiri/xml_sax_parser_context.c +4 -2
- data/ext/nokogiri/xml_sax_push_parser.c +2 -0
- data/ext/nokogiri/xml_schema.c +84 -13
- data/ext/nokogiri/xml_syntax_error.c +23 -0
- data/ext/nokogiri/xml_syntax_error.h +15 -3
- data/ext/nokogiri/xml_xpath_context.c +80 -4
- data/ext/nokogiri/xslt_stylesheet.c +1 -4
- data/lib/nokogiri.rb +20 -3
- data/lib/nokogiri/2.5/nokogiri.so +0 -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/css/parser.rb +62 -62
- data/lib/nokogiri/css/parser.y +2 -2
- data/lib/nokogiri/css/parser_extras.rb +38 -36
- data/lib/nokogiri/css/xpath_visitor.rb +70 -42
- data/lib/nokogiri/html/document.rb +12 -26
- data/lib/nokogiri/version.rb +2 -148
- data/lib/nokogiri/version/constant.rb +5 -0
- data/lib/nokogiri/version/info.rb +182 -0
- data/lib/nokogiri/xml/builder.rb +2 -2
- data/lib/nokogiri/xml/document.rb +17 -7
- data/lib/nokogiri/xml/document_fragment.rb +4 -6
- data/lib/nokogiri/xml/node.rb +562 -238
- data/lib/nokogiri/xml/parse_options.rb +6 -0
- data/lib/nokogiri/xml/relax_ng.rb +6 -2
- data/lib/nokogiri/xml/schema.rb +12 -4
- data/lib/nokogiri/xml/searchable.rb +24 -16
- metadata +149 -130
- data/lib/nokogiri/2.4/nokogiri.so +0 -0
@@ -0,0 +1,129 @@
|
|
1
|
+
/*
|
2
|
+
* Summary: implementation of XInclude
|
3
|
+
* Description: API to handle XInclude processing,
|
4
|
+
* implements the
|
5
|
+
* World Wide Web Consortium Last Call Working Draft 10 November 2003
|
6
|
+
* http://www.w3.org/TR/2003/WD-xinclude-20031110
|
7
|
+
*
|
8
|
+
* Copy: See Copyright for the status of this software.
|
9
|
+
*
|
10
|
+
* Author: Daniel Veillard
|
11
|
+
*/
|
12
|
+
|
13
|
+
#ifndef __XML_XINCLUDE_H__
|
14
|
+
#define __XML_XINCLUDE_H__
|
15
|
+
|
16
|
+
#include <libxml/xmlversion.h>
|
17
|
+
#include <libxml/tree.h>
|
18
|
+
|
19
|
+
#ifdef LIBXML_XINCLUDE_ENABLED
|
20
|
+
|
21
|
+
#ifdef __cplusplus
|
22
|
+
extern "C" {
|
23
|
+
#endif
|
24
|
+
|
25
|
+
/**
|
26
|
+
* XINCLUDE_NS:
|
27
|
+
*
|
28
|
+
* Macro defining the Xinclude namespace: http://www.w3.org/2003/XInclude
|
29
|
+
*/
|
30
|
+
#define XINCLUDE_NS (const xmlChar *) "http://www.w3.org/2003/XInclude"
|
31
|
+
/**
|
32
|
+
* XINCLUDE_OLD_NS:
|
33
|
+
*
|
34
|
+
* Macro defining the draft Xinclude namespace: http://www.w3.org/2001/XInclude
|
35
|
+
*/
|
36
|
+
#define XINCLUDE_OLD_NS (const xmlChar *) "http://www.w3.org/2001/XInclude"
|
37
|
+
/**
|
38
|
+
* XINCLUDE_NODE:
|
39
|
+
*
|
40
|
+
* Macro defining "include"
|
41
|
+
*/
|
42
|
+
#define XINCLUDE_NODE (const xmlChar *) "include"
|
43
|
+
/**
|
44
|
+
* XINCLUDE_FALLBACK:
|
45
|
+
*
|
46
|
+
* Macro defining "fallback"
|
47
|
+
*/
|
48
|
+
#define XINCLUDE_FALLBACK (const xmlChar *) "fallback"
|
49
|
+
/**
|
50
|
+
* XINCLUDE_HREF:
|
51
|
+
*
|
52
|
+
* Macro defining "href"
|
53
|
+
*/
|
54
|
+
#define XINCLUDE_HREF (const xmlChar *) "href"
|
55
|
+
/**
|
56
|
+
* XINCLUDE_PARSE:
|
57
|
+
*
|
58
|
+
* Macro defining "parse"
|
59
|
+
*/
|
60
|
+
#define XINCLUDE_PARSE (const xmlChar *) "parse"
|
61
|
+
/**
|
62
|
+
* XINCLUDE_PARSE_XML:
|
63
|
+
*
|
64
|
+
* Macro defining "xml"
|
65
|
+
*/
|
66
|
+
#define XINCLUDE_PARSE_XML (const xmlChar *) "xml"
|
67
|
+
/**
|
68
|
+
* XINCLUDE_PARSE_TEXT:
|
69
|
+
*
|
70
|
+
* Macro defining "text"
|
71
|
+
*/
|
72
|
+
#define XINCLUDE_PARSE_TEXT (const xmlChar *) "text"
|
73
|
+
/**
|
74
|
+
* XINCLUDE_PARSE_ENCODING:
|
75
|
+
*
|
76
|
+
* Macro defining "encoding"
|
77
|
+
*/
|
78
|
+
#define XINCLUDE_PARSE_ENCODING (const xmlChar *) "encoding"
|
79
|
+
/**
|
80
|
+
* XINCLUDE_PARSE_XPOINTER:
|
81
|
+
*
|
82
|
+
* Macro defining "xpointer"
|
83
|
+
*/
|
84
|
+
#define XINCLUDE_PARSE_XPOINTER (const xmlChar *) "xpointer"
|
85
|
+
|
86
|
+
typedef struct _xmlXIncludeCtxt xmlXIncludeCtxt;
|
87
|
+
typedef xmlXIncludeCtxt *xmlXIncludeCtxtPtr;
|
88
|
+
|
89
|
+
/*
|
90
|
+
* standalone processing
|
91
|
+
*/
|
92
|
+
XMLPUBFUN int XMLCALL
|
93
|
+
xmlXIncludeProcess (xmlDocPtr doc);
|
94
|
+
XMLPUBFUN int XMLCALL
|
95
|
+
xmlXIncludeProcessFlags (xmlDocPtr doc,
|
96
|
+
int flags);
|
97
|
+
XMLPUBFUN int XMLCALL
|
98
|
+
xmlXIncludeProcessFlagsData(xmlDocPtr doc,
|
99
|
+
int flags,
|
100
|
+
void *data);
|
101
|
+
XMLPUBFUN int XMLCALL
|
102
|
+
xmlXIncludeProcessTreeFlagsData(xmlNodePtr tree,
|
103
|
+
int flags,
|
104
|
+
void *data);
|
105
|
+
XMLPUBFUN int XMLCALL
|
106
|
+
xmlXIncludeProcessTree (xmlNodePtr tree);
|
107
|
+
XMLPUBFUN int XMLCALL
|
108
|
+
xmlXIncludeProcessTreeFlags(xmlNodePtr tree,
|
109
|
+
int flags);
|
110
|
+
/*
|
111
|
+
* contextual processing
|
112
|
+
*/
|
113
|
+
XMLPUBFUN xmlXIncludeCtxtPtr XMLCALL
|
114
|
+
xmlXIncludeNewContext (xmlDocPtr doc);
|
115
|
+
XMLPUBFUN int XMLCALL
|
116
|
+
xmlXIncludeSetFlags (xmlXIncludeCtxtPtr ctxt,
|
117
|
+
int flags);
|
118
|
+
XMLPUBFUN void XMLCALL
|
119
|
+
xmlXIncludeFreeContext (xmlXIncludeCtxtPtr ctxt);
|
120
|
+
XMLPUBFUN int XMLCALL
|
121
|
+
xmlXIncludeProcessNode (xmlXIncludeCtxtPtr ctxt,
|
122
|
+
xmlNodePtr tree);
|
123
|
+
#ifdef __cplusplus
|
124
|
+
}
|
125
|
+
#endif
|
126
|
+
|
127
|
+
#endif /* LIBXML_XINCLUDE_ENABLED */
|
128
|
+
|
129
|
+
#endif /* __XML_XINCLUDE_H__ */
|
@@ -0,0 +1,189 @@
|
|
1
|
+
/*
|
2
|
+
* Summary: unfinished XLink detection module
|
3
|
+
* Description: unfinished XLink detection module
|
4
|
+
*
|
5
|
+
* Copy: See Copyright for the status of this software.
|
6
|
+
*
|
7
|
+
* Author: Daniel Veillard
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef __XML_XLINK_H__
|
11
|
+
#define __XML_XLINK_H__
|
12
|
+
|
13
|
+
#include <libxml/xmlversion.h>
|
14
|
+
#include <libxml/tree.h>
|
15
|
+
|
16
|
+
#ifdef LIBXML_XPTR_ENABLED
|
17
|
+
|
18
|
+
#ifdef __cplusplus
|
19
|
+
extern "C" {
|
20
|
+
#endif
|
21
|
+
|
22
|
+
/**
|
23
|
+
* Various defines for the various Link properties.
|
24
|
+
*
|
25
|
+
* NOTE: the link detection layer will try to resolve QName expansion
|
26
|
+
* of namespaces. If "foo" is the prefix for "http://foo.com/"
|
27
|
+
* then the link detection layer will expand role="foo:myrole"
|
28
|
+
* to "http://foo.com/:myrole".
|
29
|
+
* NOTE: the link detection layer will expand URI-References found on
|
30
|
+
* href attributes by using the base mechanism if found.
|
31
|
+
*/
|
32
|
+
typedef xmlChar *xlinkHRef;
|
33
|
+
typedef xmlChar *xlinkRole;
|
34
|
+
typedef xmlChar *xlinkTitle;
|
35
|
+
|
36
|
+
typedef enum {
|
37
|
+
XLINK_TYPE_NONE = 0,
|
38
|
+
XLINK_TYPE_SIMPLE,
|
39
|
+
XLINK_TYPE_EXTENDED,
|
40
|
+
XLINK_TYPE_EXTENDED_SET
|
41
|
+
} xlinkType;
|
42
|
+
|
43
|
+
typedef enum {
|
44
|
+
XLINK_SHOW_NONE = 0,
|
45
|
+
XLINK_SHOW_NEW,
|
46
|
+
XLINK_SHOW_EMBED,
|
47
|
+
XLINK_SHOW_REPLACE
|
48
|
+
} xlinkShow;
|
49
|
+
|
50
|
+
typedef enum {
|
51
|
+
XLINK_ACTUATE_NONE = 0,
|
52
|
+
XLINK_ACTUATE_AUTO,
|
53
|
+
XLINK_ACTUATE_ONREQUEST
|
54
|
+
} xlinkActuate;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* xlinkNodeDetectFunc:
|
58
|
+
* @ctx: user data pointer
|
59
|
+
* @node: the node to check
|
60
|
+
*
|
61
|
+
* This is the prototype for the link detection routine.
|
62
|
+
* It calls the default link detection callbacks upon link detection.
|
63
|
+
*/
|
64
|
+
typedef void (*xlinkNodeDetectFunc) (void *ctx, xmlNodePtr node);
|
65
|
+
|
66
|
+
/*
|
67
|
+
* The link detection module interact with the upper layers using
|
68
|
+
* a set of callback registered at parsing time.
|
69
|
+
*/
|
70
|
+
|
71
|
+
/**
|
72
|
+
* xlinkSimpleLinkFunk:
|
73
|
+
* @ctx: user data pointer
|
74
|
+
* @node: the node carrying the link
|
75
|
+
* @href: the target of the link
|
76
|
+
* @role: the role string
|
77
|
+
* @title: the link title
|
78
|
+
*
|
79
|
+
* This is the prototype for a simple link detection callback.
|
80
|
+
*/
|
81
|
+
typedef void
|
82
|
+
(*xlinkSimpleLinkFunk) (void *ctx,
|
83
|
+
xmlNodePtr node,
|
84
|
+
const xlinkHRef href,
|
85
|
+
const xlinkRole role,
|
86
|
+
const xlinkTitle title);
|
87
|
+
|
88
|
+
/**
|
89
|
+
* xlinkExtendedLinkFunk:
|
90
|
+
* @ctx: user data pointer
|
91
|
+
* @node: the node carrying the link
|
92
|
+
* @nbLocators: the number of locators detected on the link
|
93
|
+
* @hrefs: pointer to the array of locator hrefs
|
94
|
+
* @roles: pointer to the array of locator roles
|
95
|
+
* @nbArcs: the number of arcs detected on the link
|
96
|
+
* @from: pointer to the array of source roles found on the arcs
|
97
|
+
* @to: pointer to the array of target roles found on the arcs
|
98
|
+
* @show: array of values for the show attributes found on the arcs
|
99
|
+
* @actuate: array of values for the actuate attributes found on the arcs
|
100
|
+
* @nbTitles: the number of titles detected on the link
|
101
|
+
* @title: array of titles detected on the link
|
102
|
+
* @langs: array of xml:lang values for the titles
|
103
|
+
*
|
104
|
+
* This is the prototype for a extended link detection callback.
|
105
|
+
*/
|
106
|
+
typedef void
|
107
|
+
(*xlinkExtendedLinkFunk)(void *ctx,
|
108
|
+
xmlNodePtr node,
|
109
|
+
int nbLocators,
|
110
|
+
const xlinkHRef *hrefs,
|
111
|
+
const xlinkRole *roles,
|
112
|
+
int nbArcs,
|
113
|
+
const xlinkRole *from,
|
114
|
+
const xlinkRole *to,
|
115
|
+
xlinkShow *show,
|
116
|
+
xlinkActuate *actuate,
|
117
|
+
int nbTitles,
|
118
|
+
const xlinkTitle *titles,
|
119
|
+
const xmlChar **langs);
|
120
|
+
|
121
|
+
/**
|
122
|
+
* xlinkExtendedLinkSetFunk:
|
123
|
+
* @ctx: user data pointer
|
124
|
+
* @node: the node carrying the link
|
125
|
+
* @nbLocators: the number of locators detected on the link
|
126
|
+
* @hrefs: pointer to the array of locator hrefs
|
127
|
+
* @roles: pointer to the array of locator roles
|
128
|
+
* @nbTitles: the number of titles detected on the link
|
129
|
+
* @title: array of titles detected on the link
|
130
|
+
* @langs: array of xml:lang values for the titles
|
131
|
+
*
|
132
|
+
* This is the prototype for a extended link set detection callback.
|
133
|
+
*/
|
134
|
+
typedef void
|
135
|
+
(*xlinkExtendedLinkSetFunk) (void *ctx,
|
136
|
+
xmlNodePtr node,
|
137
|
+
int nbLocators,
|
138
|
+
const xlinkHRef *hrefs,
|
139
|
+
const xlinkRole *roles,
|
140
|
+
int nbTitles,
|
141
|
+
const xlinkTitle *titles,
|
142
|
+
const xmlChar **langs);
|
143
|
+
|
144
|
+
/**
|
145
|
+
* This is the structure containing a set of Links detection callbacks.
|
146
|
+
*
|
147
|
+
* There is no default xlink callbacks, if one want to get link
|
148
|
+
* recognition activated, those call backs must be provided before parsing.
|
149
|
+
*/
|
150
|
+
typedef struct _xlinkHandler xlinkHandler;
|
151
|
+
typedef xlinkHandler *xlinkHandlerPtr;
|
152
|
+
struct _xlinkHandler {
|
153
|
+
xlinkSimpleLinkFunk simple;
|
154
|
+
xlinkExtendedLinkFunk extended;
|
155
|
+
xlinkExtendedLinkSetFunk set;
|
156
|
+
};
|
157
|
+
|
158
|
+
/*
|
159
|
+
* The default detection routine, can be overridden, they call the default
|
160
|
+
* detection callbacks.
|
161
|
+
*/
|
162
|
+
|
163
|
+
XMLPUBFUN xlinkNodeDetectFunc XMLCALL
|
164
|
+
xlinkGetDefaultDetect (void);
|
165
|
+
XMLPUBFUN void XMLCALL
|
166
|
+
xlinkSetDefaultDetect (xlinkNodeDetectFunc func);
|
167
|
+
|
168
|
+
/*
|
169
|
+
* Routines to set/get the default handlers.
|
170
|
+
*/
|
171
|
+
XMLPUBFUN xlinkHandlerPtr XMLCALL
|
172
|
+
xlinkGetDefaultHandler (void);
|
173
|
+
XMLPUBFUN void XMLCALL
|
174
|
+
xlinkSetDefaultHandler (xlinkHandlerPtr handler);
|
175
|
+
|
176
|
+
/*
|
177
|
+
* Link detection module itself.
|
178
|
+
*/
|
179
|
+
XMLPUBFUN xlinkType XMLCALL
|
180
|
+
xlinkIsLink (xmlDocPtr doc,
|
181
|
+
xmlNodePtr node);
|
182
|
+
|
183
|
+
#ifdef __cplusplus
|
184
|
+
}
|
185
|
+
#endif
|
186
|
+
|
187
|
+
#endif /* LIBXML_XPTR_ENABLED */
|
188
|
+
|
189
|
+
#endif /* __XML_XLINK_H__ */
|
@@ -0,0 +1,366 @@
|
|
1
|
+
/*
|
2
|
+
* Summary: interface for the I/O interfaces used by the parser
|
3
|
+
* Description: interface for the I/O interfaces used by the parser
|
4
|
+
*
|
5
|
+
* Copy: See Copyright for the status of this software.
|
6
|
+
*
|
7
|
+
* Author: Daniel Veillard
|
8
|
+
*/
|
9
|
+
|
10
|
+
#ifndef __XML_IO_H__
|
11
|
+
#define __XML_IO_H__
|
12
|
+
|
13
|
+
#include <stdio.h>
|
14
|
+
#include <libxml/xmlversion.h>
|
15
|
+
|
16
|
+
#ifdef __cplusplus
|
17
|
+
extern "C" {
|
18
|
+
#endif
|
19
|
+
|
20
|
+
/*
|
21
|
+
* Those are the functions and datatypes for the parser input
|
22
|
+
* I/O structures.
|
23
|
+
*/
|
24
|
+
|
25
|
+
/**
|
26
|
+
* xmlInputMatchCallback:
|
27
|
+
* @filename: the filename or URI
|
28
|
+
*
|
29
|
+
* Callback used in the I/O Input API to detect if the current handler
|
30
|
+
* can provide input functionality for this resource.
|
31
|
+
*
|
32
|
+
* Returns 1 if yes and 0 if another Input module should be used
|
33
|
+
*/
|
34
|
+
typedef int (XMLCALL *xmlInputMatchCallback) (char const *filename);
|
35
|
+
/**
|
36
|
+
* xmlInputOpenCallback:
|
37
|
+
* @filename: the filename or URI
|
38
|
+
*
|
39
|
+
* Callback used in the I/O Input API to open the resource
|
40
|
+
*
|
41
|
+
* Returns an Input context or NULL in case or error
|
42
|
+
*/
|
43
|
+
typedef void * (XMLCALL *xmlInputOpenCallback) (char const *filename);
|
44
|
+
/**
|
45
|
+
* xmlInputReadCallback:
|
46
|
+
* @context: an Input context
|
47
|
+
* @buffer: the buffer to store data read
|
48
|
+
* @len: the length of the buffer in bytes
|
49
|
+
*
|
50
|
+
* Callback used in the I/O Input API to read the resource
|
51
|
+
*
|
52
|
+
* Returns the number of bytes read or -1 in case of error
|
53
|
+
*/
|
54
|
+
typedef int (XMLCALL *xmlInputReadCallback) (void * context, char * buffer, int len);
|
55
|
+
/**
|
56
|
+
* xmlInputCloseCallback:
|
57
|
+
* @context: an Input context
|
58
|
+
*
|
59
|
+
* Callback used in the I/O Input API to close the resource
|
60
|
+
*
|
61
|
+
* Returns 0 or -1 in case of error
|
62
|
+
*/
|
63
|
+
typedef int (XMLCALL *xmlInputCloseCallback) (void * context);
|
64
|
+
|
65
|
+
#ifdef LIBXML_OUTPUT_ENABLED
|
66
|
+
/*
|
67
|
+
* Those are the functions and datatypes for the library output
|
68
|
+
* I/O structures.
|
69
|
+
*/
|
70
|
+
|
71
|
+
/**
|
72
|
+
* xmlOutputMatchCallback:
|
73
|
+
* @filename: the filename or URI
|
74
|
+
*
|
75
|
+
* Callback used in the I/O Output API to detect if the current handler
|
76
|
+
* can provide output functionality for this resource.
|
77
|
+
*
|
78
|
+
* Returns 1 if yes and 0 if another Output module should be used
|
79
|
+
*/
|
80
|
+
typedef int (XMLCALL *xmlOutputMatchCallback) (char const *filename);
|
81
|
+
/**
|
82
|
+
* xmlOutputOpenCallback:
|
83
|
+
* @filename: the filename or URI
|
84
|
+
*
|
85
|
+
* Callback used in the I/O Output API to open the resource
|
86
|
+
*
|
87
|
+
* Returns an Output context or NULL in case or error
|
88
|
+
*/
|
89
|
+
typedef void * (XMLCALL *xmlOutputOpenCallback) (char const *filename);
|
90
|
+
/**
|
91
|
+
* xmlOutputWriteCallback:
|
92
|
+
* @context: an Output context
|
93
|
+
* @buffer: the buffer of data to write
|
94
|
+
* @len: the length of the buffer in bytes
|
95
|
+
*
|
96
|
+
* Callback used in the I/O Output API to write to the resource
|
97
|
+
*
|
98
|
+
* Returns the number of bytes written or -1 in case of error
|
99
|
+
*/
|
100
|
+
typedef int (XMLCALL *xmlOutputWriteCallback) (void * context, const char * buffer,
|
101
|
+
int len);
|
102
|
+
/**
|
103
|
+
* xmlOutputCloseCallback:
|
104
|
+
* @context: an Output context
|
105
|
+
*
|
106
|
+
* Callback used in the I/O Output API to close the resource
|
107
|
+
*
|
108
|
+
* Returns 0 or -1 in case of error
|
109
|
+
*/
|
110
|
+
typedef int (XMLCALL *xmlOutputCloseCallback) (void * context);
|
111
|
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
112
|
+
|
113
|
+
#ifdef __cplusplus
|
114
|
+
}
|
115
|
+
#endif
|
116
|
+
|
117
|
+
#include <libxml/globals.h>
|
118
|
+
#include <libxml/tree.h>
|
119
|
+
#include <libxml/parser.h>
|
120
|
+
#include <libxml/encoding.h>
|
121
|
+
|
122
|
+
#ifdef __cplusplus
|
123
|
+
extern "C" {
|
124
|
+
#endif
|
125
|
+
struct _xmlParserInputBuffer {
|
126
|
+
void* context;
|
127
|
+
xmlInputReadCallback readcallback;
|
128
|
+
xmlInputCloseCallback closecallback;
|
129
|
+
|
130
|
+
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
|
131
|
+
|
132
|
+
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 */
|
133
|
+
xmlBufPtr raw; /* if encoder != NULL buffer for raw input */
|
134
|
+
int compressed; /* -1=unknown, 0=not compressed, 1=compressed */
|
135
|
+
int error;
|
136
|
+
unsigned long rawconsumed;/* amount consumed from raw */
|
137
|
+
};
|
138
|
+
|
139
|
+
|
140
|
+
#ifdef LIBXML_OUTPUT_ENABLED
|
141
|
+
struct _xmlOutputBuffer {
|
142
|
+
void* context;
|
143
|
+
xmlOutputWriteCallback writecallback;
|
144
|
+
xmlOutputCloseCallback closecallback;
|
145
|
+
|
146
|
+
xmlCharEncodingHandlerPtr encoder; /* I18N conversions to UTF-8 */
|
147
|
+
|
148
|
+
xmlBufPtr buffer; /* Local buffer encoded in UTF-8 or ISOLatin */
|
149
|
+
xmlBufPtr conv; /* if encoder != NULL buffer for output */
|
150
|
+
int written; /* total number of byte written */
|
151
|
+
int error;
|
152
|
+
};
|
153
|
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
154
|
+
|
155
|
+
/*
|
156
|
+
* Interfaces for input
|
157
|
+
*/
|
158
|
+
XMLPUBFUN void XMLCALL
|
159
|
+
xmlCleanupInputCallbacks (void);
|
160
|
+
|
161
|
+
XMLPUBFUN int XMLCALL
|
162
|
+
xmlPopInputCallbacks (void);
|
163
|
+
|
164
|
+
XMLPUBFUN void XMLCALL
|
165
|
+
xmlRegisterDefaultInputCallbacks (void);
|
166
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
167
|
+
xmlAllocParserInputBuffer (xmlCharEncoding enc);
|
168
|
+
|
169
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
170
|
+
xmlParserInputBufferCreateFilename (const char *URI,
|
171
|
+
xmlCharEncoding enc);
|
172
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
173
|
+
xmlParserInputBufferCreateFile (FILE *file,
|
174
|
+
xmlCharEncoding enc);
|
175
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
176
|
+
xmlParserInputBufferCreateFd (int fd,
|
177
|
+
xmlCharEncoding enc);
|
178
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
179
|
+
xmlParserInputBufferCreateMem (const char *mem, int size,
|
180
|
+
xmlCharEncoding enc);
|
181
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
182
|
+
xmlParserInputBufferCreateStatic (const char *mem, int size,
|
183
|
+
xmlCharEncoding enc);
|
184
|
+
XMLPUBFUN xmlParserInputBufferPtr XMLCALL
|
185
|
+
xmlParserInputBufferCreateIO (xmlInputReadCallback ioread,
|
186
|
+
xmlInputCloseCallback ioclose,
|
187
|
+
void *ioctx,
|
188
|
+
xmlCharEncoding enc);
|
189
|
+
XMLPUBFUN int XMLCALL
|
190
|
+
xmlParserInputBufferRead (xmlParserInputBufferPtr in,
|
191
|
+
int len);
|
192
|
+
XMLPUBFUN int XMLCALL
|
193
|
+
xmlParserInputBufferGrow (xmlParserInputBufferPtr in,
|
194
|
+
int len);
|
195
|
+
XMLPUBFUN int XMLCALL
|
196
|
+
xmlParserInputBufferPush (xmlParserInputBufferPtr in,
|
197
|
+
int len,
|
198
|
+
const char *buf);
|
199
|
+
XMLPUBFUN void XMLCALL
|
200
|
+
xmlFreeParserInputBuffer (xmlParserInputBufferPtr in);
|
201
|
+
XMLPUBFUN char * XMLCALL
|
202
|
+
xmlParserGetDirectory (const char *filename);
|
203
|
+
|
204
|
+
XMLPUBFUN int XMLCALL
|
205
|
+
xmlRegisterInputCallbacks (xmlInputMatchCallback matchFunc,
|
206
|
+
xmlInputOpenCallback openFunc,
|
207
|
+
xmlInputReadCallback readFunc,
|
208
|
+
xmlInputCloseCallback closeFunc);
|
209
|
+
|
210
|
+
xmlParserInputBufferPtr
|
211
|
+
__xmlParserInputBufferCreateFilename(const char *URI,
|
212
|
+
xmlCharEncoding enc);
|
213
|
+
|
214
|
+
#ifdef LIBXML_OUTPUT_ENABLED
|
215
|
+
/*
|
216
|
+
* Interfaces for output
|
217
|
+
*/
|
218
|
+
XMLPUBFUN void XMLCALL
|
219
|
+
xmlCleanupOutputCallbacks (void);
|
220
|
+
XMLPUBFUN void XMLCALL
|
221
|
+
xmlRegisterDefaultOutputCallbacks(void);
|
222
|
+
XMLPUBFUN xmlOutputBufferPtr XMLCALL
|
223
|
+
xmlAllocOutputBuffer (xmlCharEncodingHandlerPtr encoder);
|
224
|
+
|
225
|
+
XMLPUBFUN xmlOutputBufferPtr XMLCALL
|
226
|
+
xmlOutputBufferCreateFilename (const char *URI,
|
227
|
+
xmlCharEncodingHandlerPtr encoder,
|
228
|
+
int compression);
|
229
|
+
|
230
|
+
XMLPUBFUN xmlOutputBufferPtr XMLCALL
|
231
|
+
xmlOutputBufferCreateFile (FILE *file,
|
232
|
+
xmlCharEncodingHandlerPtr encoder);
|
233
|
+
|
234
|
+
XMLPUBFUN xmlOutputBufferPtr XMLCALL
|
235
|
+
xmlOutputBufferCreateBuffer (xmlBufferPtr buffer,
|
236
|
+
xmlCharEncodingHandlerPtr encoder);
|
237
|
+
|
238
|
+
XMLPUBFUN xmlOutputBufferPtr XMLCALL
|
239
|
+
xmlOutputBufferCreateFd (int fd,
|
240
|
+
xmlCharEncodingHandlerPtr encoder);
|
241
|
+
|
242
|
+
XMLPUBFUN xmlOutputBufferPtr XMLCALL
|
243
|
+
xmlOutputBufferCreateIO (xmlOutputWriteCallback iowrite,
|
244
|
+
xmlOutputCloseCallback ioclose,
|
245
|
+
void *ioctx,
|
246
|
+
xmlCharEncodingHandlerPtr encoder);
|
247
|
+
|
248
|
+
/* Couple of APIs to get the output without digging into the buffers */
|
249
|
+
XMLPUBFUN const xmlChar * XMLCALL
|
250
|
+
xmlOutputBufferGetContent (xmlOutputBufferPtr out);
|
251
|
+
XMLPUBFUN size_t XMLCALL
|
252
|
+
xmlOutputBufferGetSize (xmlOutputBufferPtr out);
|
253
|
+
|
254
|
+
XMLPUBFUN int XMLCALL
|
255
|
+
xmlOutputBufferWrite (xmlOutputBufferPtr out,
|
256
|
+
int len,
|
257
|
+
const char *buf);
|
258
|
+
XMLPUBFUN int XMLCALL
|
259
|
+
xmlOutputBufferWriteString (xmlOutputBufferPtr out,
|
260
|
+
const char *str);
|
261
|
+
XMLPUBFUN int XMLCALL
|
262
|
+
xmlOutputBufferWriteEscape (xmlOutputBufferPtr out,
|
263
|
+
const xmlChar *str,
|
264
|
+
xmlCharEncodingOutputFunc escaping);
|
265
|
+
|
266
|
+
XMLPUBFUN int XMLCALL
|
267
|
+
xmlOutputBufferFlush (xmlOutputBufferPtr out);
|
268
|
+
XMLPUBFUN int XMLCALL
|
269
|
+
xmlOutputBufferClose (xmlOutputBufferPtr out);
|
270
|
+
|
271
|
+
XMLPUBFUN int XMLCALL
|
272
|
+
xmlRegisterOutputCallbacks (xmlOutputMatchCallback matchFunc,
|
273
|
+
xmlOutputOpenCallback openFunc,
|
274
|
+
xmlOutputWriteCallback writeFunc,
|
275
|
+
xmlOutputCloseCallback closeFunc);
|
276
|
+
|
277
|
+
xmlOutputBufferPtr
|
278
|
+
__xmlOutputBufferCreateFilename(const char *URI,
|
279
|
+
xmlCharEncodingHandlerPtr encoder,
|
280
|
+
int compression);
|
281
|
+
|
282
|
+
#ifdef LIBXML_HTTP_ENABLED
|
283
|
+
/* This function only exists if HTTP support built into the library */
|
284
|
+
XMLPUBFUN void XMLCALL
|
285
|
+
xmlRegisterHTTPPostCallbacks (void );
|
286
|
+
#endif /* LIBXML_HTTP_ENABLED */
|
287
|
+
|
288
|
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
289
|
+
|
290
|
+
XMLPUBFUN xmlParserInputPtr XMLCALL
|
291
|
+
xmlCheckHTTPInput (xmlParserCtxtPtr ctxt,
|
292
|
+
xmlParserInputPtr ret);
|
293
|
+
|
294
|
+
/*
|
295
|
+
* A predefined entity loader disabling network accesses
|
296
|
+
*/
|
297
|
+
XMLPUBFUN xmlParserInputPtr XMLCALL
|
298
|
+
xmlNoNetExternalEntityLoader (const char *URL,
|
299
|
+
const char *ID,
|
300
|
+
xmlParserCtxtPtr ctxt);
|
301
|
+
|
302
|
+
/*
|
303
|
+
* xmlNormalizeWindowsPath is obsolete, don't use it.
|
304
|
+
* Check xmlCanonicPath in uri.h for a better alternative.
|
305
|
+
*/
|
306
|
+
XMLPUBFUN xmlChar * XMLCALL
|
307
|
+
xmlNormalizeWindowsPath (const xmlChar *path);
|
308
|
+
|
309
|
+
XMLPUBFUN int XMLCALL
|
310
|
+
xmlCheckFilename (const char *path);
|
311
|
+
/**
|
312
|
+
* Default 'file://' protocol callbacks
|
313
|
+
*/
|
314
|
+
XMLPUBFUN int XMLCALL
|
315
|
+
xmlFileMatch (const char *filename);
|
316
|
+
XMLPUBFUN void * XMLCALL
|
317
|
+
xmlFileOpen (const char *filename);
|
318
|
+
XMLPUBFUN int XMLCALL
|
319
|
+
xmlFileRead (void * context,
|
320
|
+
char * buffer,
|
321
|
+
int len);
|
322
|
+
XMLPUBFUN int XMLCALL
|
323
|
+
xmlFileClose (void * context);
|
324
|
+
|
325
|
+
/**
|
326
|
+
* Default 'http://' protocol callbacks
|
327
|
+
*/
|
328
|
+
#ifdef LIBXML_HTTP_ENABLED
|
329
|
+
XMLPUBFUN int XMLCALL
|
330
|
+
xmlIOHTTPMatch (const char *filename);
|
331
|
+
XMLPUBFUN void * XMLCALL
|
332
|
+
xmlIOHTTPOpen (const char *filename);
|
333
|
+
#ifdef LIBXML_OUTPUT_ENABLED
|
334
|
+
XMLPUBFUN void * XMLCALL
|
335
|
+
xmlIOHTTPOpenW (const char * post_uri,
|
336
|
+
int compression );
|
337
|
+
#endif /* LIBXML_OUTPUT_ENABLED */
|
338
|
+
XMLPUBFUN int XMLCALL
|
339
|
+
xmlIOHTTPRead (void * context,
|
340
|
+
char * buffer,
|
341
|
+
int len);
|
342
|
+
XMLPUBFUN int XMLCALL
|
343
|
+
xmlIOHTTPClose (void * context);
|
344
|
+
#endif /* LIBXML_HTTP_ENABLED */
|
345
|
+
|
346
|
+
/**
|
347
|
+
* Default 'ftp://' protocol callbacks
|
348
|
+
*/
|
349
|
+
#ifdef LIBXML_FTP_ENABLED
|
350
|
+
XMLPUBFUN int XMLCALL
|
351
|
+
xmlIOFTPMatch (const char *filename);
|
352
|
+
XMLPUBFUN void * XMLCALL
|
353
|
+
xmlIOFTPOpen (const char *filename);
|
354
|
+
XMLPUBFUN int XMLCALL
|
355
|
+
xmlIOFTPRead (void * context,
|
356
|
+
char * buffer,
|
357
|
+
int len);
|
358
|
+
XMLPUBFUN int XMLCALL
|
359
|
+
xmlIOFTPClose (void * context);
|
360
|
+
#endif /* LIBXML_FTP_ENABLED */
|
361
|
+
|
362
|
+
#ifdef __cplusplus
|
363
|
+
}
|
364
|
+
#endif
|
365
|
+
|
366
|
+
#endif /* __XML_IO_H__ */
|