nokogiri 1.10.7 → 1.12.5-arm64-darwin
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 +1173 -884
- data/LICENSE.md +1 -1
- data/README.md +176 -96
- data/dependencies.yml +12 -12
- data/ext/nokogiri/depend +38 -358
- data/ext/nokogiri/extconf.rb +716 -414
- data/ext/nokogiri/gumbo.c +584 -0
- data/ext/nokogiri/html4_document.c +166 -0
- data/ext/nokogiri/html4_element_description.c +294 -0
- data/ext/nokogiri/html4_entity_lookup.c +37 -0
- data/ext/nokogiri/html4_sax_parser_context.c +120 -0
- data/ext/nokogiri/html4_sax_push_parser.c +95 -0
- data/ext/nokogiri/include/libexslt/exslt.h +102 -0
- data/ext/nokogiri/include/libexslt/exsltconfig.h +70 -0
- data/ext/nokogiri/include/libexslt/exsltexports.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/DOCBparser.h +96 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLparser.h +306 -0
- data/ext/nokogiri/include/libxml2/libxml/HTMLtree.h +147 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX.h +173 -0
- data/ext/nokogiri/include/libxml2/libxml/SAX2.h +178 -0
- data/ext/nokogiri/include/libxml2/libxml/c14n.h +128 -0
- data/ext/nokogiri/include/libxml2/libxml/catalog.h +182 -0
- data/ext/nokogiri/include/libxml2/libxml/chvalid.h +230 -0
- data/ext/nokogiri/include/libxml2/libxml/debugXML.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/dict.h +79 -0
- data/ext/nokogiri/include/libxml2/libxml/encoding.h +245 -0
- data/ext/nokogiri/include/libxml2/libxml/entities.h +151 -0
- data/ext/nokogiri/include/libxml2/libxml/globals.h +508 -0
- data/ext/nokogiri/include/libxml2/libxml/hash.h +236 -0
- data/ext/nokogiri/include/libxml2/libxml/list.h +137 -0
- data/ext/nokogiri/include/libxml2/libxml/nanoftp.h +163 -0
- data/ext/nokogiri/include/libxml2/libxml/nanohttp.h +81 -0
- data/ext/nokogiri/include/libxml2/libxml/parser.h +1243 -0
- data/ext/nokogiri/include/libxml2/libxml/parserInternals.h +644 -0
- data/ext/nokogiri/include/libxml2/libxml/pattern.h +100 -0
- data/ext/nokogiri/include/libxml2/libxml/relaxng.h +217 -0
- data/ext/nokogiri/include/libxml2/libxml/schemasInternals.h +958 -0
- data/ext/nokogiri/include/libxml2/libxml/schematron.h +142 -0
- data/ext/nokogiri/include/libxml2/libxml/threads.h +89 -0
- data/ext/nokogiri/include/libxml2/libxml/tree.h +1311 -0
- data/ext/nokogiri/include/libxml2/libxml/uri.h +94 -0
- data/ext/nokogiri/include/libxml2/libxml/valid.h +458 -0
- data/ext/nokogiri/include/libxml2/libxml/xinclude.h +129 -0
- data/ext/nokogiri/include/libxml2/libxml/xlink.h +189 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlIO.h +368 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlautomata.h +146 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlerror.h +945 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlexports.h +77 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmemory.h +224 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlmodule.h +57 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlreader.h +428 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlregexp.h +222 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlsave.h +88 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemas.h +246 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlschemastypes.h +151 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlstring.h +140 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlunicode.h +202 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlversion.h +485 -0
- data/ext/nokogiri/include/libxml2/libxml/xmlwriter.h +488 -0
- data/ext/nokogiri/include/libxml2/libxml/xpath.h +564 -0
- data/ext/nokogiri/include/libxml2/libxml/xpathInternals.h +632 -0
- data/ext/nokogiri/include/libxml2/libxml/xpointer.h +114 -0
- data/ext/nokogiri/include/libxslt/attributes.h +38 -0
- data/ext/nokogiri/include/libxslt/documents.h +93 -0
- data/ext/nokogiri/include/libxslt/extensions.h +262 -0
- data/ext/nokogiri/include/libxslt/extra.h +72 -0
- data/ext/nokogiri/include/libxslt/functions.h +78 -0
- data/ext/nokogiri/include/libxslt/imports.h +75 -0
- data/ext/nokogiri/include/libxslt/keys.h +53 -0
- data/ext/nokogiri/include/libxslt/namespaces.h +68 -0
- data/ext/nokogiri/include/libxslt/numbersInternals.h +73 -0
- data/ext/nokogiri/include/libxslt/pattern.h +84 -0
- data/ext/nokogiri/include/libxslt/preproc.h +43 -0
- data/ext/nokogiri/include/libxslt/security.h +104 -0
- data/ext/nokogiri/include/libxslt/templates.h +77 -0
- data/ext/nokogiri/include/libxslt/transform.h +207 -0
- data/ext/nokogiri/include/libxslt/variables.h +118 -0
- data/ext/nokogiri/include/libxslt/xslt.h +110 -0
- data/ext/nokogiri/include/libxslt/xsltInternals.h +1978 -0
- data/ext/nokogiri/include/libxslt/xsltconfig.h +180 -0
- data/ext/nokogiri/include/libxslt/xsltexports.h +142 -0
- data/ext/nokogiri/include/libxslt/xsltlocale.h +76 -0
- data/ext/nokogiri/include/libxslt/xsltutils.h +313 -0
- data/ext/nokogiri/libxml2_backwards_compat.c +121 -0
- data/ext/nokogiri/nokogiri.c +228 -91
- data/ext/nokogiri/nokogiri.h +191 -89
- data/ext/nokogiri/test_global_handlers.c +40 -0
- data/ext/nokogiri/xml_attr.c +15 -15
- data/ext/nokogiri/xml_attribute_decl.c +18 -18
- data/ext/nokogiri/xml_cdata.c +13 -18
- data/ext/nokogiri/xml_comment.c +19 -26
- data/ext/nokogiri/xml_document.c +267 -195
- data/ext/nokogiri/xml_document_fragment.c +13 -15
- data/ext/nokogiri/xml_dtd.c +54 -48
- data/ext/nokogiri/xml_element_content.c +31 -26
- data/ext/nokogiri/xml_element_decl.c +22 -22
- data/ext/nokogiri/xml_encoding_handler.c +28 -17
- data/ext/nokogiri/xml_entity_decl.c +32 -30
- data/ext/nokogiri/xml_entity_reference.c +16 -18
- data/ext/nokogiri/xml_namespace.c +60 -51
- data/ext/nokogiri/xml_node.c +493 -407
- data/ext/nokogiri/xml_node_set.c +174 -162
- data/ext/nokogiri/xml_processing_instruction.c +17 -19
- data/ext/nokogiri/xml_reader.c +197 -172
- data/ext/nokogiri/xml_relax_ng.c +52 -28
- data/ext/nokogiri/xml_sax_parser.c +112 -112
- data/ext/nokogiri/xml_sax_parser_context.c +105 -86
- data/ext/nokogiri/xml_sax_push_parser.c +36 -27
- data/ext/nokogiri/xml_schema.c +112 -33
- data/ext/nokogiri/xml_syntax_error.c +42 -21
- data/ext/nokogiri/xml_text.c +13 -17
- data/ext/nokogiri/xml_xpath_context.c +158 -73
- data/ext/nokogiri/xslt_stylesheet.c +158 -164
- data/gumbo-parser/CHANGES.md +63 -0
- data/gumbo-parser/Makefile +101 -0
- data/gumbo-parser/THANKS +27 -0
- data/lib/nokogiri/2.5/nokogiri.bundle +0 -0
- data/lib/nokogiri/2.6/nokogiri.bundle +0 -0
- data/lib/nokogiri/2.7/nokogiri.bundle +0 -0
- data/lib/nokogiri/3.0/nokogiri.bundle +0 -0
- data/lib/nokogiri/css/node.rb +1 -0
- data/lib/nokogiri/css/parser.rb +64 -63
- data/lib/nokogiri/css/parser.y +3 -3
- data/lib/nokogiri/css/parser_extras.rb +39 -36
- data/lib/nokogiri/css/syntax_error.rb +2 -1
- data/lib/nokogiri/css/tokenizer.rb +1 -0
- data/lib/nokogiri/css/xpath_visitor.rb +73 -43
- data/lib/nokogiri/css.rb +15 -14
- data/lib/nokogiri/decorators/slop.rb +1 -0
- data/lib/nokogiri/extension.rb +31 -0
- data/lib/nokogiri/gumbo.rb +14 -0
- data/lib/nokogiri/html.rb +32 -27
- data/lib/nokogiri/{html → html4}/builder.rb +3 -2
- data/lib/nokogiri/{html → html4}/document.rb +17 -30
- data/lib/nokogiri/{html → html4}/document_fragment.rb +18 -17
- data/lib/nokogiri/{html → html4}/element_description.rb +2 -1
- data/lib/nokogiri/{html → html4}/element_description_defaults.rb +2 -1
- data/lib/nokogiri/{html → html4}/entity_lookup.rb +2 -1
- data/lib/nokogiri/{html → html4}/sax/parser.rb +12 -14
- data/lib/nokogiri/html4/sax/parser_context.rb +19 -0
- data/lib/nokogiri/{html → html4}/sax/push_parser.rb +6 -5
- data/lib/nokogiri/html4.rb +40 -0
- data/lib/nokogiri/html5/document.rb +74 -0
- data/lib/nokogiri/html5/document_fragment.rb +80 -0
- data/lib/nokogiri/html5/node.rb +93 -0
- data/lib/nokogiri/html5.rb +473 -0
- data/lib/nokogiri/jruby/dependencies.rb +20 -0
- data/lib/nokogiri/syntax_error.rb +1 -0
- data/lib/nokogiri/version/constant.rb +5 -0
- data/lib/nokogiri/version/info.rb +215 -0
- data/lib/nokogiri/version.rb +3 -109
- data/lib/nokogiri/xml/attr.rb +1 -0
- data/lib/nokogiri/xml/attribute_decl.rb +1 -0
- data/lib/nokogiri/xml/builder.rb +41 -2
- data/lib/nokogiri/xml/cdata.rb +1 -0
- data/lib/nokogiri/xml/character_data.rb +1 -0
- data/lib/nokogiri/xml/document.rb +138 -41
- data/lib/nokogiri/xml/document_fragment.rb +5 -6
- data/lib/nokogiri/xml/dtd.rb +1 -0
- data/lib/nokogiri/xml/element_content.rb +1 -0
- data/lib/nokogiri/xml/element_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_decl.rb +1 -0
- data/lib/nokogiri/xml/entity_reference.rb +1 -0
- data/lib/nokogiri/xml/namespace.rb +1 -0
- data/lib/nokogiri/xml/node/save_options.rb +2 -1
- data/lib/nokogiri/xml/node.rb +629 -293
- data/lib/nokogiri/xml/node_set.rb +1 -0
- data/lib/nokogiri/xml/notation.rb +1 -0
- data/lib/nokogiri/xml/parse_options.rb +12 -3
- data/lib/nokogiri/xml/pp/character_data.rb +1 -0
- data/lib/nokogiri/xml/pp/node.rb +1 -0
- data/lib/nokogiri/xml/pp.rb +3 -2
- data/lib/nokogiri/xml/processing_instruction.rb +1 -0
- data/lib/nokogiri/xml/reader.rb +9 -12
- data/lib/nokogiri/xml/relax_ng.rb +7 -2
- data/lib/nokogiri/xml/sax/document.rb +25 -30
- data/lib/nokogiri/xml/sax/parser.rb +1 -0
- data/lib/nokogiri/xml/sax/parser_context.rb +1 -0
- data/lib/nokogiri/xml/sax/push_parser.rb +1 -0
- data/lib/nokogiri/xml/sax.rb +5 -4
- data/lib/nokogiri/xml/schema.rb +13 -4
- data/lib/nokogiri/xml/searchable.rb +25 -16
- data/lib/nokogiri/xml/syntax_error.rb +1 -0
- data/lib/nokogiri/xml/text.rb +1 -0
- data/lib/nokogiri/xml/xpath/syntax_error.rb +2 -1
- data/lib/nokogiri/xml/xpath.rb +4 -5
- data/lib/nokogiri/xml/xpath_context.rb +1 -0
- data/lib/nokogiri/xml.rb +36 -36
- data/lib/nokogiri/xslt/stylesheet.rb +2 -1
- data/lib/nokogiri/xslt.rb +17 -16
- data/lib/nokogiri.rb +32 -51
- data/lib/xsd/xmlparser/nokogiri.rb +1 -0
- metadata +182 -193
- data/ext/nokogiri/html_document.c +0 -170
- data/ext/nokogiri/html_document.h +0 -10
- data/ext/nokogiri/html_element_description.c +0 -279
- data/ext/nokogiri/html_element_description.h +0 -10
- data/ext/nokogiri/html_entity_lookup.c +0 -32
- data/ext/nokogiri/html_entity_lookup.h +0 -8
- data/ext/nokogiri/html_sax_parser_context.c +0 -116
- data/ext/nokogiri/html_sax_parser_context.h +0 -11
- data/ext/nokogiri/html_sax_push_parser.c +0 -87
- data/ext/nokogiri/html_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_attr.h +0 -9
- data/ext/nokogiri/xml_attribute_decl.h +0 -9
- data/ext/nokogiri/xml_cdata.h +0 -9
- data/ext/nokogiri/xml_comment.h +0 -9
- data/ext/nokogiri/xml_document.h +0 -23
- data/ext/nokogiri/xml_document_fragment.h +0 -10
- data/ext/nokogiri/xml_dtd.h +0 -10
- data/ext/nokogiri/xml_element_content.h +0 -10
- data/ext/nokogiri/xml_element_decl.h +0 -9
- data/ext/nokogiri/xml_encoding_handler.h +0 -8
- data/ext/nokogiri/xml_entity_decl.h +0 -10
- data/ext/nokogiri/xml_entity_reference.h +0 -9
- data/ext/nokogiri/xml_io.c +0 -61
- data/ext/nokogiri/xml_io.h +0 -11
- data/ext/nokogiri/xml_libxml2_hacks.c +0 -112
- data/ext/nokogiri/xml_libxml2_hacks.h +0 -12
- data/ext/nokogiri/xml_namespace.h +0 -14
- data/ext/nokogiri/xml_node.h +0 -13
- data/ext/nokogiri/xml_node_set.h +0 -12
- data/ext/nokogiri/xml_processing_instruction.h +0 -9
- data/ext/nokogiri/xml_reader.h +0 -10
- data/ext/nokogiri/xml_relax_ng.h +0 -9
- data/ext/nokogiri/xml_sax_parser.h +0 -39
- data/ext/nokogiri/xml_sax_parser_context.h +0 -10
- data/ext/nokogiri/xml_sax_push_parser.h +0 -9
- data/ext/nokogiri/xml_schema.h +0 -9
- data/ext/nokogiri/xml_syntax_error.h +0 -13
- data/ext/nokogiri/xml_text.h +0 -9
- data/ext/nokogiri/xml_xpath_context.h +0 -10
- data/ext/nokogiri/xslt_stylesheet.h +0 -14
- data/lib/nokogiri/html/sax/parser_context.rb +0 -16
- data/patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch +0 -78
- data/patches/libxml2/0002-Remove-script-macro-support.patch +0 -40
- data/patches/libxml2/0003-Update-entities-to-remove-handling-of-ssi.patch +0 -44
- data/patches/libxml2/0004-libxml2.la-is-in-top_builddir.patch +0 -25
- data/ports/archives/libxml2-2.9.10.tar.gz +0 -0
- data/ports/archives/libxslt-1.1.34.tar.gz +0 -0
data/ext/nokogiri/xml_reader.c
CHANGED
@@ -1,13 +1,17 @@
|
|
1
|
-
#include <
|
1
|
+
#include <nokogiri.h>
|
2
2
|
|
3
|
-
|
3
|
+
VALUE cNokogiriXmlReader;
|
4
|
+
|
5
|
+
static void
|
6
|
+
dealloc(xmlTextReaderPtr reader)
|
4
7
|
{
|
5
8
|
NOKOGIRI_DEBUG_START(reader);
|
6
9
|
xmlFreeTextReader(reader);
|
7
10
|
NOKOGIRI_DEBUG_END(reader);
|
8
11
|
}
|
9
12
|
|
10
|
-
static int
|
13
|
+
static int
|
14
|
+
has_attributes(xmlTextReaderPtr reader)
|
11
15
|
{
|
12
16
|
/*
|
13
17
|
* this implementation of xmlTextReaderHasAttributes explicitly includes
|
@@ -16,47 +20,39 @@ static int has_attributes(xmlTextReaderPtr reader)
|
|
16
20
|
*/
|
17
21
|
xmlNodePtr node ;
|
18
22
|
node = xmlTextReaderCurrentNode(reader);
|
19
|
-
if (node == NULL)
|
20
|
-
return(0);
|
23
|
+
if (node == NULL) {
|
24
|
+
return (0);
|
25
|
+
}
|
21
26
|
|
22
27
|
if ((node->type == XML_ELEMENT_NODE) &&
|
23
|
-
((node->properties != NULL) || (node->nsDef != NULL)))
|
24
|
-
return(1);
|
25
|
-
|
28
|
+
((node->properties != NULL) || (node->nsDef != NULL))) {
|
29
|
+
return (1);
|
30
|
+
}
|
31
|
+
return (0);
|
26
32
|
}
|
27
33
|
|
28
|
-
static void
|
34
|
+
static void
|
35
|
+
Nokogiri_xml_node_namespaces(xmlNodePtr node, VALUE attr_hash)
|
29
36
|
{
|
30
37
|
xmlNsPtr ns;
|
31
|
-
|
32
|
-
char *key ;
|
33
|
-
size_t keylen ;
|
38
|
+
VALUE key;
|
34
39
|
|
35
|
-
if (node->type != XML_ELEMENT_NODE) return ;
|
40
|
+
if (node->type != XML_ELEMENT_NODE) { return ; }
|
36
41
|
|
37
42
|
ns = node->nsDef;
|
38
43
|
while (ns != NULL) {
|
39
44
|
|
40
|
-
|
41
|
-
if (keylen > XMLNS_BUFFER_LEN) {
|
42
|
-
key = (char*)malloc(keylen) ;
|
43
|
-
} else {
|
44
|
-
key = buffer ;
|
45
|
-
}
|
46
|
-
|
45
|
+
key = rb_enc_str_new_cstr(XMLNS_PREFIX, rb_utf8_encoding());
|
47
46
|
if (ns->prefix) {
|
48
|
-
|
49
|
-
|
50
|
-
sprintf(key, "%s", XMLNS_PREFIX);
|
47
|
+
rb_str_cat_cstr(key, ":");
|
48
|
+
rb_str_cat_cstr(key, (const char *)ns->prefix);
|
51
49
|
}
|
52
50
|
|
51
|
+
key = rb_str_conv_enc(key, rb_utf8_encoding(), rb_default_internal_encoding());
|
53
52
|
rb_hash_aset(attr_hash,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
if (key != buffer) {
|
58
|
-
free(key);
|
59
|
-
}
|
53
|
+
key,
|
54
|
+
(ns->href ? NOKOGIRI_STR_NEW2(ns->href) : Qnil)
|
55
|
+
);
|
60
56
|
ns = ns->next ;
|
61
57
|
}
|
62
58
|
}
|
@@ -68,15 +64,16 @@ static void Nokogiri_xml_node_namespaces(xmlNodePtr node, VALUE attr_hash)
|
|
68
64
|
*
|
69
65
|
* Was an attribute generated from the default value in the DTD or schema?
|
70
66
|
*/
|
71
|
-
static VALUE
|
67
|
+
static VALUE
|
68
|
+
default_eh(VALUE self)
|
72
69
|
{
|
73
70
|
xmlTextReaderPtr reader;
|
74
71
|
int eh;
|
75
72
|
|
76
73
|
Data_Get_Struct(self, xmlTextReader, reader);
|
77
74
|
eh = xmlTextReaderIsDefault(reader);
|
78
|
-
if(eh == 0) return Qfalse;
|
79
|
-
if(eh == 1) return Qtrue;
|
75
|
+
if (eh == 0) { return Qfalse; }
|
76
|
+
if (eh == 1) { return Qtrue; }
|
80
77
|
|
81
78
|
return Qnil;
|
82
79
|
}
|
@@ -87,15 +84,16 @@ static VALUE default_eh(VALUE self)
|
|
87
84
|
*
|
88
85
|
* Does this node have a text value?
|
89
86
|
*/
|
90
|
-
static VALUE
|
87
|
+
static VALUE
|
88
|
+
value_eh(VALUE self)
|
91
89
|
{
|
92
90
|
xmlTextReaderPtr reader;
|
93
91
|
int eh;
|
94
92
|
|
95
93
|
Data_Get_Struct(self, xmlTextReader, reader);
|
96
94
|
eh = xmlTextReaderHasValue(reader);
|
97
|
-
if(eh == 0) return Qfalse;
|
98
|
-
if(eh == 1) return Qtrue;
|
95
|
+
if (eh == 0) { return Qfalse; }
|
96
|
+
if (eh == 1) { return Qtrue; }
|
99
97
|
|
100
98
|
return Qnil;
|
101
99
|
}
|
@@ -106,15 +104,16 @@ static VALUE value_eh(VALUE self)
|
|
106
104
|
*
|
107
105
|
* Does this node have attributes?
|
108
106
|
*/
|
109
|
-
static VALUE
|
107
|
+
static VALUE
|
108
|
+
attributes_eh(VALUE self)
|
110
109
|
{
|
111
110
|
xmlTextReaderPtr reader;
|
112
111
|
int eh;
|
113
112
|
|
114
113
|
Data_Get_Struct(self, xmlTextReader, reader);
|
115
114
|
eh = has_attributes(reader);
|
116
|
-
if(eh == 0) return Qfalse;
|
117
|
-
if(eh == 1) return Qtrue;
|
115
|
+
if (eh == 0) { return Qfalse; }
|
116
|
+
if (eh == 1) { return Qtrue; }
|
118
117
|
|
119
118
|
return Qnil;
|
120
119
|
}
|
@@ -125,7 +124,8 @@ static VALUE attributes_eh(VALUE self)
|
|
125
124
|
*
|
126
125
|
* Get a hash of namespaces for this Node
|
127
126
|
*/
|
128
|
-
static VALUE
|
127
|
+
static VALUE
|
128
|
+
namespaces(VALUE self)
|
129
129
|
{
|
130
130
|
xmlTextReaderPtr reader;
|
131
131
|
xmlNodePtr ptr;
|
@@ -135,11 +135,12 @@ static VALUE namespaces(VALUE self)
|
|
135
135
|
|
136
136
|
attr = rb_hash_new() ;
|
137
137
|
|
138
|
-
if (! has_attributes(reader))
|
138
|
+
if (! has_attributes(reader)) {
|
139
139
|
return attr ;
|
140
|
+
}
|
140
141
|
|
141
142
|
ptr = xmlTextReaderExpand(reader);
|
142
|
-
if(ptr == NULL) return Qnil;
|
143
|
+
if (ptr == NULL) { return Qnil; }
|
143
144
|
|
144
145
|
Nokogiri_xml_node_namespaces(ptr, attr);
|
145
146
|
|
@@ -147,30 +148,37 @@ static VALUE namespaces(VALUE self)
|
|
147
148
|
}
|
148
149
|
|
149
150
|
/*
|
150
|
-
*
|
151
|
-
*
|
152
|
-
*
|
153
|
-
* Get a list of attributes for this Node
|
151
|
+
* @overload attribute_nodes()
|
152
|
+
* Get the attributes of the current node as an Array of Attr
|
153
|
+
* @return [Array<Nokogiri::XML::Attr>]
|
154
154
|
*/
|
155
|
-
static VALUE
|
155
|
+
static VALUE
|
156
|
+
rb_xml_reader_attribute_nodes(VALUE rb_reader)
|
156
157
|
{
|
157
|
-
xmlTextReaderPtr
|
158
|
-
xmlNodePtr
|
159
|
-
VALUE
|
158
|
+
xmlTextReaderPtr c_reader;
|
159
|
+
xmlNodePtr c_node;
|
160
|
+
VALUE attr_nodes;
|
161
|
+
int j;
|
160
162
|
|
161
|
-
Data_Get_Struct(
|
163
|
+
Data_Get_Struct(rb_reader, xmlTextReader, c_reader);
|
162
164
|
|
163
|
-
|
165
|
+
if (! has_attributes(c_reader)) {
|
166
|
+
return rb_ary_new() ;
|
167
|
+
}
|
164
168
|
|
165
|
-
|
166
|
-
|
169
|
+
c_node = xmlTextReaderExpand(c_reader);
|
170
|
+
if (c_node == NULL) {
|
171
|
+
return Qnil;
|
172
|
+
}
|
167
173
|
|
168
|
-
|
169
|
-
if(ptr == NULL) return Qnil;
|
174
|
+
attr_nodes = noko_xml_node_attrs(c_node);
|
170
175
|
|
171
|
-
|
176
|
+
/* ensure that the Reader won't be GCed as long as a node is referenced */
|
177
|
+
for (j = 0 ; j < RARRAY_LEN(attr_nodes) ; j++) {
|
178
|
+
rb_iv_set(rb_ary_entry(attr_nodes, j), "@reader", rb_reader);
|
179
|
+
}
|
172
180
|
|
173
|
-
return
|
181
|
+
return attr_nodes;
|
174
182
|
}
|
175
183
|
|
176
184
|
/*
|
@@ -179,7 +187,8 @@ static VALUE attribute_nodes(VALUE self)
|
|
179
187
|
*
|
180
188
|
* Get the value of attribute at +index+
|
181
189
|
*/
|
182
|
-
static VALUE
|
190
|
+
static VALUE
|
191
|
+
attribute_at(VALUE self, VALUE index)
|
183
192
|
{
|
184
193
|
xmlTextReaderPtr reader;
|
185
194
|
xmlChar *value;
|
@@ -187,14 +196,14 @@ static VALUE attribute_at(VALUE self, VALUE index)
|
|
187
196
|
|
188
197
|
Data_Get_Struct(self, xmlTextReader, reader);
|
189
198
|
|
190
|
-
if(NIL_P(index)) return Qnil;
|
199
|
+
if (NIL_P(index)) { return Qnil; }
|
191
200
|
index = rb_Integer(index);
|
192
201
|
|
193
202
|
value = xmlTextReaderGetAttributeNo(
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
if(value == NULL) return Qnil;
|
203
|
+
reader,
|
204
|
+
(int)NUM2INT(index)
|
205
|
+
);
|
206
|
+
if (value == NULL) { return Qnil; }
|
198
207
|
|
199
208
|
rb_value = NOKOGIRI_STR_NEW2(value);
|
200
209
|
xmlFree(value);
|
@@ -207,7 +216,8 @@ static VALUE attribute_at(VALUE self, VALUE index)
|
|
207
216
|
*
|
208
217
|
* Get the value of attribute named +name+
|
209
218
|
*/
|
210
|
-
static VALUE
|
219
|
+
static VALUE
|
220
|
+
reader_attribute(VALUE self, VALUE name)
|
211
221
|
{
|
212
222
|
xmlTextReaderPtr reader;
|
213
223
|
xmlChar *value ;
|
@@ -215,11 +225,11 @@ static VALUE reader_attribute(VALUE self, VALUE name)
|
|
215
225
|
|
216
226
|
Data_Get_Struct(self, xmlTextReader, reader);
|
217
227
|
|
218
|
-
if(NIL_P(name)) return Qnil;
|
228
|
+
if (NIL_P(name)) { return Qnil; }
|
219
229
|
name = StringValue(name) ;
|
220
230
|
|
221
|
-
value = xmlTextReaderGetAttribute(reader, (xmlChar*)StringValueCStr(name));
|
222
|
-
if(value == NULL) return Qnil;
|
231
|
+
value = xmlTextReaderGetAttribute(reader, (xmlChar *)StringValueCStr(name));
|
232
|
+
if (value == NULL) { return Qnil; }
|
223
233
|
|
224
234
|
rb_value = NOKOGIRI_STR_NEW2(value);
|
225
235
|
xmlFree(value);
|
@@ -232,14 +242,15 @@ static VALUE reader_attribute(VALUE self, VALUE name)
|
|
232
242
|
*
|
233
243
|
* Get the number of attributes for the current node
|
234
244
|
*/
|
235
|
-
static VALUE
|
245
|
+
static VALUE
|
246
|
+
attribute_count(VALUE self)
|
236
247
|
{
|
237
248
|
xmlTextReaderPtr reader;
|
238
249
|
int count;
|
239
250
|
|
240
251
|
Data_Get_Struct(self, xmlTextReader, reader);
|
241
252
|
count = xmlTextReaderAttributeCount(reader);
|
242
|
-
if(count == -1) return Qnil;
|
253
|
+
if (count == -1) { return Qnil; }
|
243
254
|
|
244
255
|
return INT2NUM((long)count);
|
245
256
|
}
|
@@ -250,14 +261,15 @@ static VALUE attribute_count(VALUE self)
|
|
250
261
|
*
|
251
262
|
* Get the depth of the node
|
252
263
|
*/
|
253
|
-
static VALUE
|
264
|
+
static VALUE
|
265
|
+
depth(VALUE self)
|
254
266
|
{
|
255
267
|
xmlTextReaderPtr reader;
|
256
268
|
int depth;
|
257
269
|
|
258
270
|
Data_Get_Struct(self, xmlTextReader, reader);
|
259
271
|
depth = xmlTextReaderDepth(reader);
|
260
|
-
if(depth == -1) return Qnil;
|
272
|
+
if (depth == -1) { return Qnil; }
|
261
273
|
|
262
274
|
return INT2NUM((long)depth);
|
263
275
|
}
|
@@ -268,14 +280,15 @@ static VALUE depth(VALUE self)
|
|
268
280
|
*
|
269
281
|
* Get the XML version of the document being read
|
270
282
|
*/
|
271
|
-
static VALUE
|
283
|
+
static VALUE
|
284
|
+
xml_version(VALUE self)
|
272
285
|
{
|
273
286
|
xmlTextReaderPtr reader;
|
274
287
|
const char *version;
|
275
288
|
|
276
289
|
Data_Get_Struct(self, xmlTextReader, reader);
|
277
290
|
version = (const char *)xmlTextReaderConstXmlVersion(reader);
|
278
|
-
if(version == NULL) return Qnil;
|
291
|
+
if (version == NULL) { return Qnil; }
|
279
292
|
|
280
293
|
return NOKOGIRI_STR_NEW2(version);
|
281
294
|
}
|
@@ -286,14 +299,15 @@ static VALUE xml_version(VALUE self)
|
|
286
299
|
*
|
287
300
|
* Get the xml:lang scope within which the node resides.
|
288
301
|
*/
|
289
|
-
static VALUE
|
302
|
+
static VALUE
|
303
|
+
lang(VALUE self)
|
290
304
|
{
|
291
305
|
xmlTextReaderPtr reader;
|
292
306
|
const char *lang;
|
293
307
|
|
294
308
|
Data_Get_Struct(self, xmlTextReader, reader);
|
295
309
|
lang = (const char *)xmlTextReaderConstXmlLang(reader);
|
296
|
-
if(lang == NULL) return Qnil;
|
310
|
+
if (lang == NULL) { return Qnil; }
|
297
311
|
|
298
312
|
return NOKOGIRI_STR_NEW2(lang);
|
299
313
|
}
|
@@ -304,14 +318,15 @@ static VALUE lang(VALUE self)
|
|
304
318
|
*
|
305
319
|
* Get the text value of the node if present. Returns a utf-8 encoded string.
|
306
320
|
*/
|
307
|
-
static VALUE
|
321
|
+
static VALUE
|
322
|
+
value(VALUE self)
|
308
323
|
{
|
309
324
|
xmlTextReaderPtr reader;
|
310
325
|
const char *value;
|
311
326
|
|
312
327
|
Data_Get_Struct(self, xmlTextReader, reader);
|
313
328
|
value = (const char *)xmlTextReaderConstValue(reader);
|
314
|
-
if(value == NULL) return Qnil;
|
329
|
+
if (value == NULL) { return Qnil; }
|
315
330
|
|
316
331
|
return NOKOGIRI_STR_NEW2(value);
|
317
332
|
}
|
@@ -322,14 +337,15 @@ static VALUE value(VALUE self)
|
|
322
337
|
*
|
323
338
|
* Get the shorthand reference to the namespace associated with the node.
|
324
339
|
*/
|
325
|
-
static VALUE
|
340
|
+
static VALUE
|
341
|
+
prefix(VALUE self)
|
326
342
|
{
|
327
343
|
xmlTextReaderPtr reader;
|
328
344
|
const char *prefix;
|
329
345
|
|
330
346
|
Data_Get_Struct(self, xmlTextReader, reader);
|
331
347
|
prefix = (const char *)xmlTextReaderConstPrefix(reader);
|
332
|
-
if(prefix == NULL) return Qnil;
|
348
|
+
if (prefix == NULL) { return Qnil; }
|
333
349
|
|
334
350
|
return NOKOGIRI_STR_NEW2(prefix);
|
335
351
|
}
|
@@ -340,14 +356,15 @@ static VALUE prefix(VALUE self)
|
|
340
356
|
*
|
341
357
|
* Get the URI defining the namespace associated with the node
|
342
358
|
*/
|
343
|
-
static VALUE
|
359
|
+
static VALUE
|
360
|
+
namespace_uri(VALUE self)
|
344
361
|
{
|
345
362
|
xmlTextReaderPtr reader;
|
346
363
|
const char *uri;
|
347
364
|
|
348
365
|
Data_Get_Struct(self, xmlTextReader, reader);
|
349
366
|
uri = (const char *)xmlTextReaderConstNamespaceUri(reader);
|
350
|
-
if(uri == NULL) return Qnil;
|
367
|
+
if (uri == NULL) { return Qnil; }
|
351
368
|
|
352
369
|
return NOKOGIRI_STR_NEW2(uri);
|
353
370
|
}
|
@@ -358,14 +375,15 @@ static VALUE namespace_uri(VALUE self)
|
|
358
375
|
*
|
359
376
|
* Get the local name of the node
|
360
377
|
*/
|
361
|
-
static VALUE
|
378
|
+
static VALUE
|
379
|
+
local_name(VALUE self)
|
362
380
|
{
|
363
381
|
xmlTextReaderPtr reader;
|
364
382
|
const char *name;
|
365
383
|
|
366
384
|
Data_Get_Struct(self, xmlTextReader, reader);
|
367
385
|
name = (const char *)xmlTextReaderConstLocalName(reader);
|
368
|
-
if(name == NULL) return Qnil;
|
386
|
+
if (name == NULL) { return Qnil; }
|
369
387
|
|
370
388
|
return NOKOGIRI_STR_NEW2(name);
|
371
389
|
}
|
@@ -376,14 +394,15 @@ static VALUE local_name(VALUE self)
|
|
376
394
|
*
|
377
395
|
* Get the name of the node. Returns a utf-8 encoded string.
|
378
396
|
*/
|
379
|
-
static VALUE
|
397
|
+
static VALUE
|
398
|
+
name(VALUE self)
|
380
399
|
{
|
381
400
|
xmlTextReaderPtr reader;
|
382
401
|
const char *name;
|
383
402
|
|
384
403
|
Data_Get_Struct(self, xmlTextReader, reader);
|
385
404
|
name = (const char *)xmlTextReaderConstName(reader);
|
386
|
-
if(name == NULL) return Qnil;
|
405
|
+
if (name == NULL) { return Qnil; }
|
387
406
|
|
388
407
|
return NOKOGIRI_STR_NEW2(name);
|
389
408
|
}
|
@@ -394,14 +413,15 @@ static VALUE name(VALUE self)
|
|
394
413
|
*
|
395
414
|
* Get the xml:base of the node
|
396
415
|
*/
|
397
|
-
static VALUE
|
416
|
+
static VALUE
|
417
|
+
base_uri(VALUE self)
|
398
418
|
{
|
399
419
|
xmlTextReaderPtr reader;
|
400
|
-
const char *
|
420
|
+
const char *base_uri;
|
401
421
|
|
402
422
|
Data_Get_Struct(self, xmlTextReader, reader);
|
403
423
|
base_uri = (const char *)xmlTextReaderBaseUri(reader);
|
404
|
-
if (base_uri == NULL) return Qnil;
|
424
|
+
if (base_uri == NULL) { return Qnil; }
|
405
425
|
|
406
426
|
return NOKOGIRI_STR_NEW2(base_uri);
|
407
427
|
}
|
@@ -412,7 +432,8 @@ static VALUE base_uri(VALUE self)
|
|
412
432
|
*
|
413
433
|
* Get the state of the reader
|
414
434
|
*/
|
415
|
-
static VALUE
|
435
|
+
static VALUE
|
436
|
+
state(VALUE self)
|
416
437
|
{
|
417
438
|
xmlTextReaderPtr reader;
|
418
439
|
Data_Get_Struct(self, xmlTextReader, reader);
|
@@ -425,7 +446,8 @@ static VALUE state(VALUE self)
|
|
425
446
|
*
|
426
447
|
* Get the type of readers current node
|
427
448
|
*/
|
428
|
-
static VALUE
|
449
|
+
static VALUE
|
450
|
+
node_type(VALUE self)
|
429
451
|
{
|
430
452
|
xmlTextReaderPtr reader;
|
431
453
|
Data_Get_Struct(self, xmlTextReader, reader);
|
@@ -438,7 +460,8 @@ static VALUE node_type(VALUE self)
|
|
438
460
|
*
|
439
461
|
* Move the Reader forward through the XML document.
|
440
462
|
*/
|
441
|
-
static VALUE
|
463
|
+
static VALUE
|
464
|
+
read_more(VALUE self)
|
442
465
|
{
|
443
466
|
xmlTextReaderPtr reader;
|
444
467
|
xmlErrorPtr error;
|
@@ -453,14 +476,15 @@ static VALUE read_more(VALUE self)
|
|
453
476
|
ret = xmlTextReaderRead(reader);
|
454
477
|
xmlSetStructuredErrorFunc(NULL, NULL);
|
455
478
|
|
456
|
-
if(ret == 1) return self;
|
457
|
-
if(ret == 0) return Qnil;
|
479
|
+
if (ret == 1) { return self; }
|
480
|
+
if (ret == 0) { return Qnil; }
|
458
481
|
|
459
482
|
error = xmlGetLastError();
|
460
|
-
if(error)
|
483
|
+
if (error) {
|
461
484
|
rb_exc_raise(Nokogiri_wrap_xml_syntax_error(error));
|
462
|
-
else
|
485
|
+
} else {
|
463
486
|
rb_raise(rb_eRuntimeError, "Error pulling: %d", ret);
|
487
|
+
}
|
464
488
|
|
465
489
|
return Qnil;
|
466
490
|
}
|
@@ -472,10 +496,11 @@ static VALUE read_more(VALUE self)
|
|
472
496
|
* Read the contents of the current node, including child nodes and markup.
|
473
497
|
* Returns a utf-8 encoded string.
|
474
498
|
*/
|
475
|
-
static VALUE
|
499
|
+
static VALUE
|
500
|
+
inner_xml(VALUE self)
|
476
501
|
{
|
477
502
|
xmlTextReaderPtr reader;
|
478
|
-
xmlChar*
|
503
|
+
xmlChar *value;
|
479
504
|
VALUE str;
|
480
505
|
|
481
506
|
Data_Get_Struct(self, xmlTextReader, reader);
|
@@ -483,8 +508,8 @@ static VALUE inner_xml(VALUE self)
|
|
483
508
|
value = xmlTextReaderReadInnerXml(reader);
|
484
509
|
|
485
510
|
str = Qnil;
|
486
|
-
if(value) {
|
487
|
-
str = NOKOGIRI_STR_NEW2((char*)value);
|
511
|
+
if (value) {
|
512
|
+
str = NOKOGIRI_STR_NEW2((char *)value);
|
488
513
|
xmlFree(value);
|
489
514
|
}
|
490
515
|
|
@@ -498,7 +523,8 @@ static VALUE inner_xml(VALUE self)
|
|
498
523
|
* Read the current node and its contents, including child nodes and markup.
|
499
524
|
* Returns a utf-8 encoded string.
|
500
525
|
*/
|
501
|
-
static VALUE
|
526
|
+
static VALUE
|
527
|
+
outer_xml(VALUE self)
|
502
528
|
{
|
503
529
|
xmlTextReaderPtr reader;
|
504
530
|
xmlChar *value;
|
@@ -508,8 +534,8 @@ static VALUE outer_xml(VALUE self)
|
|
508
534
|
|
509
535
|
value = xmlTextReaderReadOuterXml(reader);
|
510
536
|
|
511
|
-
if(value) {
|
512
|
-
str = NOKOGIRI_STR_NEW2((char*)value);
|
537
|
+
if (value) {
|
538
|
+
str = NOKOGIRI_STR_NEW2((char *)value);
|
513
539
|
xmlFree(value);
|
514
540
|
}
|
515
541
|
return str;
|
@@ -521,31 +547,32 @@ static VALUE outer_xml(VALUE self)
|
|
521
547
|
*
|
522
548
|
* Create a new reader that parses +string+
|
523
549
|
*/
|
524
|
-
static VALUE
|
550
|
+
static VALUE
|
551
|
+
from_memory(int argc, VALUE *argv, VALUE klass)
|
525
552
|
{
|
526
553
|
VALUE rb_buffer, rb_url, encoding, rb_options;
|
527
554
|
xmlTextReaderPtr reader;
|
528
|
-
const char *
|
529
|
-
const char *
|
555
|
+
const char *c_url = NULL;
|
556
|
+
const char *c_encoding = NULL;
|
530
557
|
int c_options = 0;
|
531
558
|
VALUE rb_reader, args[3];
|
532
559
|
|
533
560
|
rb_scan_args(argc, argv, "13", &rb_buffer, &rb_url, &encoding, &rb_options);
|
534
561
|
|
535
|
-
if (!RTEST(rb_buffer)) rb_raise(rb_eArgError, "string cannot be nil");
|
536
|
-
if (RTEST(rb_url)) c_url = StringValueCStr(rb_url);
|
537
|
-
if (RTEST(encoding)) c_encoding = StringValueCStr(encoding);
|
538
|
-
if (RTEST(rb_options)) c_options = (int)NUM2INT(rb_options);
|
562
|
+
if (!RTEST(rb_buffer)) { rb_raise(rb_eArgError, "string cannot be nil"); }
|
563
|
+
if (RTEST(rb_url)) { c_url = StringValueCStr(rb_url); }
|
564
|
+
if (RTEST(encoding)) { c_encoding = StringValueCStr(encoding); }
|
565
|
+
if (RTEST(rb_options)) { c_options = (int)NUM2INT(rb_options); }
|
539
566
|
|
540
567
|
reader = xmlReaderForMemory(
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
if(reader == NULL) {
|
568
|
+
StringValuePtr(rb_buffer),
|
569
|
+
(int)RSTRING_LEN(rb_buffer),
|
570
|
+
c_url,
|
571
|
+
c_encoding,
|
572
|
+
c_options
|
573
|
+
);
|
574
|
+
|
575
|
+
if (reader == NULL) {
|
549
576
|
xmlFreeTextReader(reader);
|
550
577
|
rb_raise(rb_eRuntimeError, "couldn't create a parser");
|
551
578
|
}
|
@@ -565,32 +592,33 @@ static VALUE from_memory(int argc, VALUE *argv, VALUE klass)
|
|
565
592
|
*
|
566
593
|
* Create a new reader that parses +io+
|
567
594
|
*/
|
568
|
-
static VALUE
|
595
|
+
static VALUE
|
596
|
+
from_io(int argc, VALUE *argv, VALUE klass)
|
569
597
|
{
|
570
598
|
VALUE rb_io, rb_url, encoding, rb_options;
|
571
599
|
xmlTextReaderPtr reader;
|
572
|
-
const char *
|
573
|
-
const char *
|
600
|
+
const char *c_url = NULL;
|
601
|
+
const char *c_encoding = NULL;
|
574
602
|
int c_options = 0;
|
575
603
|
VALUE rb_reader, args[3];
|
576
604
|
|
577
605
|
rb_scan_args(argc, argv, "13", &rb_io, &rb_url, &encoding, &rb_options);
|
578
606
|
|
579
|
-
if (!RTEST(rb_io)) rb_raise(rb_eArgError, "io cannot be nil");
|
580
|
-
if (RTEST(rb_url)) c_url = StringValueCStr(rb_url);
|
581
|
-
if (RTEST(encoding)) c_encoding = StringValueCStr(encoding);
|
582
|
-
if (RTEST(rb_options)) c_options = (int)NUM2INT(rb_options);
|
607
|
+
if (!RTEST(rb_io)) { rb_raise(rb_eArgError, "io cannot be nil"); }
|
608
|
+
if (RTEST(rb_url)) { c_url = StringValueCStr(rb_url); }
|
609
|
+
if (RTEST(encoding)) { c_encoding = StringValueCStr(encoding); }
|
610
|
+
if (RTEST(rb_options)) { c_options = (int)NUM2INT(rb_options); }
|
583
611
|
|
584
612
|
reader = xmlReaderForIO(
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
if(reader == NULL) {
|
613
|
+
(xmlInputReadCallback)noko_io_read,
|
614
|
+
(xmlInputCloseCallback)noko_io_close,
|
615
|
+
(void *)rb_io,
|
616
|
+
c_url,
|
617
|
+
c_encoding,
|
618
|
+
c_options
|
619
|
+
);
|
620
|
+
|
621
|
+
if (reader == NULL) {
|
594
622
|
xmlFreeTextReader(reader);
|
595
623
|
rb_raise(rb_eRuntimeError, "couldn't create a parser");
|
596
624
|
}
|
@@ -610,59 +638,56 @@ static VALUE from_io(int argc, VALUE *argv, VALUE klass)
|
|
610
638
|
*
|
611
639
|
* Returns true if the current node is empty, otherwise false.
|
612
640
|
*/
|
613
|
-
static VALUE
|
641
|
+
static VALUE
|
642
|
+
empty_element_p(VALUE self)
|
614
643
|
{
|
615
644
|
xmlTextReaderPtr reader;
|
616
645
|
|
617
646
|
Data_Get_Struct(self, xmlTextReader, reader);
|
618
647
|
|
619
|
-
if(xmlTextReaderIsEmptyElement(reader))
|
648
|
+
if (xmlTextReaderIsEmptyElement(reader)) {
|
620
649
|
return Qtrue;
|
650
|
+
}
|
621
651
|
|
622
652
|
return Qfalse;
|
623
653
|
}
|
624
654
|
|
625
|
-
|
626
|
-
|
627
|
-
void init_xml_reader()
|
655
|
+
void
|
656
|
+
noko_init_xml_reader()
|
628
657
|
{
|
629
|
-
VALUE module = rb_define_module("Nokogiri");
|
630
|
-
VALUE xml = rb_define_module_under(module, "XML");
|
631
|
-
|
632
658
|
/*
|
633
659
|
* The Reader parser allows you to effectively pull parse an XML document.
|
634
660
|
* Once instantiated, call Nokogiri::XML::Reader#each to iterate over each
|
635
661
|
* node. Note that you may only iterate over the document once!
|
636
662
|
*/
|
637
|
-
|
638
|
-
|
639
|
-
cNokogiriXmlReader
|
640
|
-
|
641
|
-
rb_define_singleton_method(
|
642
|
-
rb_define_singleton_method(
|
643
|
-
|
644
|
-
rb_define_method(
|
645
|
-
rb_define_method(
|
646
|
-
rb_define_method(
|
647
|
-
rb_define_method(
|
648
|
-
rb_define_method(
|
649
|
-
rb_define_method(
|
650
|
-
rb_define_method(
|
651
|
-
rb_define_method(
|
652
|
-
rb_define_method(
|
653
|
-
rb_define_method(
|
654
|
-
rb_define_method(
|
655
|
-
rb_define_method(
|
656
|
-
rb_define_method(
|
657
|
-
rb_define_method(
|
658
|
-
rb_define_method(
|
659
|
-
rb_define_method(
|
660
|
-
rb_define_method(
|
661
|
-
rb_define_method(
|
662
|
-
rb_define_method(
|
663
|
-
rb_define_method(
|
664
|
-
rb_define_method(
|
665
|
-
rb_define_method(
|
666
|
-
|
667
|
-
rb_define_private_method(klass, "attr_nodes", attribute_nodes, 0);
|
663
|
+
cNokogiriXmlReader = rb_define_class_under(mNokogiriXml, "Reader", rb_cObject);
|
664
|
+
|
665
|
+
rb_undef_alloc_func(cNokogiriXmlReader);
|
666
|
+
|
667
|
+
rb_define_singleton_method(cNokogiriXmlReader, "from_memory", from_memory, -1);
|
668
|
+
rb_define_singleton_method(cNokogiriXmlReader, "from_io", from_io, -1);
|
669
|
+
|
670
|
+
rb_define_method(cNokogiriXmlReader, "attribute", reader_attribute, 1);
|
671
|
+
rb_define_method(cNokogiriXmlReader, "attribute_at", attribute_at, 1);
|
672
|
+
rb_define_method(cNokogiriXmlReader, "attribute_count", attribute_count, 0);
|
673
|
+
rb_define_method(cNokogiriXmlReader, "attribute_nodes", rb_xml_reader_attribute_nodes, 0);
|
674
|
+
rb_define_method(cNokogiriXmlReader, "attributes?", attributes_eh, 0);
|
675
|
+
rb_define_method(cNokogiriXmlReader, "base_uri", base_uri, 0);
|
676
|
+
rb_define_method(cNokogiriXmlReader, "default?", default_eh, 0);
|
677
|
+
rb_define_method(cNokogiriXmlReader, "depth", depth, 0);
|
678
|
+
rb_define_method(cNokogiriXmlReader, "empty_element?", empty_element_p, 0);
|
679
|
+
rb_define_method(cNokogiriXmlReader, "inner_xml", inner_xml, 0);
|
680
|
+
rb_define_method(cNokogiriXmlReader, "lang", lang, 0);
|
681
|
+
rb_define_method(cNokogiriXmlReader, "local_name", local_name, 0);
|
682
|
+
rb_define_method(cNokogiriXmlReader, "name", name, 0);
|
683
|
+
rb_define_method(cNokogiriXmlReader, "namespace_uri", namespace_uri, 0);
|
684
|
+
rb_define_method(cNokogiriXmlReader, "namespaces", namespaces, 0);
|
685
|
+
rb_define_method(cNokogiriXmlReader, "node_type", node_type, 0);
|
686
|
+
rb_define_method(cNokogiriXmlReader, "outer_xml", outer_xml, 0);
|
687
|
+
rb_define_method(cNokogiriXmlReader, "prefix", prefix, 0);
|
688
|
+
rb_define_method(cNokogiriXmlReader, "read", read_more, 0);
|
689
|
+
rb_define_method(cNokogiriXmlReader, "state", state, 0);
|
690
|
+
rb_define_method(cNokogiriXmlReader, "value", value, 0);
|
691
|
+
rb_define_method(cNokogiriXmlReader, "value?", value_eh, 0);
|
692
|
+
rb_define_method(cNokogiriXmlReader, "xml_version", xml_version, 0);
|
668
693
|
}
|