libxml-ruby 2.9.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (139) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +811 -790
  3. data/LICENSE +20 -20
  4. data/MANIFEST +166 -166
  5. data/README.rdoc +188 -184
  6. data/Rakefile +1 -1
  7. data/ext/libxml/libxml.c +80 -80
  8. data/ext/libxml/ruby_libxml.h +75 -75
  9. data/ext/libxml/ruby_xml.c +0 -84
  10. data/ext/libxml/ruby_xml.h +0 -10
  11. data/ext/libxml/ruby_xml_attr.h +12 -12
  12. data/ext/libxml/ruby_xml_attr_decl.c +153 -153
  13. data/ext/libxml/ruby_xml_attr_decl.h +11 -11
  14. data/ext/libxml/ruby_xml_attributes.c +275 -275
  15. data/ext/libxml/ruby_xml_attributes.h +15 -15
  16. data/ext/libxml/ruby_xml_document.c +21 -27
  17. data/ext/libxml/ruby_xml_document.h +11 -11
  18. data/ext/libxml/ruby_xml_dtd.c +2 -13
  19. data/ext/libxml/ruby_xml_dtd.h +9 -9
  20. data/ext/libxml/ruby_xml_error.c +996 -996
  21. data/ext/libxml/ruby_xml_error.h +12 -12
  22. data/ext/libxml/ruby_xml_html_parser.c +89 -92
  23. data/ext/libxml/ruby_xml_html_parser.h +10 -10
  24. data/ext/libxml/ruby_xml_html_parser_context.h +10 -10
  25. data/ext/libxml/ruby_xml_html_parser_options.c +46 -46
  26. data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
  27. data/ext/libxml/ruby_xml_input_cbg.h +20 -20
  28. data/ext/libxml/ruby_xml_io.c +0 -1
  29. data/ext/libxml/ruby_xml_io.h +10 -10
  30. data/ext/libxml/ruby_xml_namespace.c +153 -153
  31. data/ext/libxml/ruby_xml_namespace.h +10 -10
  32. data/ext/libxml/ruby_xml_namespaces.c +293 -293
  33. data/ext/libxml/ruby_xml_namespaces.h +9 -9
  34. data/ext/libxml/ruby_xml_node.c +100 -143
  35. data/ext/libxml/ruby_xml_node.h +13 -11
  36. data/ext/libxml/ruby_xml_parser.c +91 -94
  37. data/ext/libxml/ruby_xml_parser.h +12 -12
  38. data/ext/libxml/ruby_xml_parser_context.h +10 -10
  39. data/ext/libxml/ruby_xml_parser_options.c +66 -66
  40. data/ext/libxml/ruby_xml_parser_options.h +12 -12
  41. data/ext/libxml/ruby_xml_reader.c +45 -37
  42. data/ext/libxml/ruby_xml_reader.h +17 -17
  43. data/ext/libxml/ruby_xml_relaxng.h +10 -10
  44. data/ext/libxml/ruby_xml_sax2_handler.c +3 -3
  45. data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
  46. data/ext/libxml/ruby_xml_sax_parser.c +116 -120
  47. data/ext/libxml/ruby_xml_sax_parser.h +10 -10
  48. data/ext/libxml/ruby_xml_schema.h +809 -809
  49. data/ext/libxml/ruby_xml_schema_attribute.c +109 -109
  50. data/ext/libxml/ruby_xml_schema_attribute.h +15 -15
  51. data/ext/libxml/ruby_xml_schema_element.c +94 -94
  52. data/ext/libxml/ruby_xml_schema_element.h +14 -14
  53. data/ext/libxml/ruby_xml_schema_facet.c +52 -52
  54. data/ext/libxml/ruby_xml_schema_facet.h +13 -13
  55. data/ext/libxml/ruby_xml_schema_type.c +259 -259
  56. data/ext/libxml/ruby_xml_schema_type.h +9 -9
  57. data/ext/libxml/ruby_xml_version.h +9 -9
  58. data/ext/libxml/ruby_xml_writer.c +1136 -1136
  59. data/ext/libxml/ruby_xml_writer.h +10 -10
  60. data/ext/libxml/ruby_xml_xinclude.c +16 -16
  61. data/ext/libxml/ruby_xml_xinclude.h +11 -11
  62. data/ext/libxml/ruby_xml_xpath.c +42 -36
  63. data/ext/libxml/ruby_xml_xpath.h +13 -13
  64. data/ext/libxml/ruby_xml_xpath_context.c +1 -1
  65. data/ext/libxml/ruby_xml_xpath_context.h +9 -9
  66. data/ext/libxml/ruby_xml_xpath_expression.c +81 -81
  67. data/ext/libxml/ruby_xml_xpath_expression.h +10 -10
  68. data/ext/libxml/ruby_xml_xpath_object.c +5 -2
  69. data/ext/libxml/ruby_xml_xpath_object.h +17 -17
  70. data/ext/libxml/ruby_xml_xpointer.c +99 -99
  71. data/ext/libxml/ruby_xml_xpointer.h +11 -11
  72. data/ext/vc/libxml_ruby.sln +17 -15
  73. data/lib/libxml.rb +1 -6
  74. data/lib/libxml/node.rb +2 -78
  75. data/lib/libxml/parser.rb +0 -266
  76. data/lib/libxml/sax_parser.rb +0 -17
  77. data/lib/libxml/schema.rb +66 -66
  78. data/lib/libxml/schema/attribute.rb +19 -19
  79. data/lib/libxml/schema/element.rb +27 -27
  80. data/lib/libxml/schema/type.rb +29 -29
  81. data/script/benchmark/depixelate +634 -634
  82. data/script/benchmark/hamlet.xml +9054 -9054
  83. data/script/benchmark/parsecount +170 -170
  84. data/script/benchmark/throughput +41 -41
  85. data/script/test +6 -6
  86. data/test/c14n/given/example-1.xml +14 -14
  87. data/test/c14n/given/example-2.xml +11 -11
  88. data/test/c14n/given/example-3.xml +18 -18
  89. data/test/c14n/given/example-4.xml +9 -9
  90. data/test/c14n/given/example-5.xml +12 -12
  91. data/test/c14n/given/example-6.xml +2 -2
  92. data/test/c14n/given/example-7.xml +11 -11
  93. data/test/c14n/given/example-8.xml +11 -11
  94. data/test/c14n/given/example-8.xpath +9 -9
  95. data/test/c14n/result/1-1-without-comments/example-1 +3 -3
  96. data/test/c14n/result/1-1-without-comments/example-2 +10 -10
  97. data/test/c14n/result/1-1-without-comments/example-3 +13 -13
  98. data/test/c14n/result/1-1-without-comments/example-4 +8 -8
  99. data/test/c14n/result/1-1-without-comments/example-5 +2 -2
  100. data/test/c14n/result/with-comments/example-1 +5 -5
  101. data/test/c14n/result/with-comments/example-2 +10 -10
  102. data/test/c14n/result/with-comments/example-3 +13 -13
  103. data/test/c14n/result/with-comments/example-4 +8 -8
  104. data/test/c14n/result/with-comments/example-5 +3 -3
  105. data/test/c14n/result/without-comments/example-1 +3 -3
  106. data/test/c14n/result/without-comments/example-2 +10 -10
  107. data/test/c14n/result/without-comments/example-3 +13 -13
  108. data/test/c14n/result/without-comments/example-4 +8 -8
  109. data/test/c14n/result/without-comments/example-5 +2 -2
  110. data/test/model/atom.xml +12 -12
  111. data/test/model/bands.iso-8859-1.xml +4 -4
  112. data/test/model/bands.utf-8.xml +4 -4
  113. data/test/model/bands.xml +4 -4
  114. data/test/model/books.xml +153 -153
  115. data/test/model/merge_bug_data.xml +58 -58
  116. data/test/model/ruby-lang.html +238 -238
  117. data/test/model/rubynet.xml +79 -79
  118. data/test/model/shiporder.rnc +28 -28
  119. data/test/model/shiporder.rng +86 -86
  120. data/test/model/shiporder.xml +22 -22
  121. data/test/model/shiporder.xsd +39 -39
  122. data/test/model/soap.xml +27 -27
  123. data/test/model/xinclude.xml +4 -4
  124. data/test/tc_attributes.rb +0 -6
  125. data/test/tc_error.rb +157 -158
  126. data/test/tc_node.rb +33 -17
  127. data/test/tc_node_edit.rb +0 -15
  128. data/test/tc_node_pi.rb +39 -39
  129. data/test/tc_parser.rb +0 -48
  130. data/test/tc_reader.rb +12 -53
  131. data/test/tc_writer.rb +447 -447
  132. data/test/tc_xpath.rb +1 -1
  133. data/test/test_helper.rb +2 -2
  134. metadata +3 -8
  135. data/ext/libxml/extconf.h +0 -4
  136. data/lib/libxml/ns.rb +0 -22
  137. data/lib/libxml/properties.rb +0 -23
  138. data/lib/libxml/reader.rb +0 -29
  139. data/lib/libxml/xpath_object.rb +0 -16
@@ -1,10 +1,10 @@
1
- #ifndef __RXML_WRITER__
2
- #define __RXML_WRITER__
3
-
4
- #ifdef LIBXML_WRITER_ENABLED
5
- #include <libxml/xmlwriter.h>
6
- #endif
7
-
8
- extern VALUE cXMLWriter;
9
- void rxml_init_writer(void);
10
- #endif
1
+ #ifndef __RXML_WRITER__
2
+ #define __RXML_WRITER__
3
+
4
+ #ifdef LIBXML_WRITER_ENABLED
5
+ #include <libxml/xmlwriter.h>
6
+ #endif
7
+
8
+ extern VALUE cXMLWriter;
9
+ void rxml_init_writer(void);
10
+ #endif
@@ -1,16 +1,16 @@
1
- #include "ruby_libxml.h"
2
- #include "ruby_xml_xinclude.h"
3
-
4
- VALUE cXMLXInclude;
5
-
6
- /*
7
- * Document-class: LibXML::XML::XInclude
8
- *
9
- * The ruby bindings do not currently expose libxml's
10
- * XInclude fuctionality.
11
- */
12
-
13
- void rxml_init_xinclude(void)
14
- {
15
- cXMLXInclude = rb_define_class_under(mXML, "XInclude", rb_cObject);
16
- }
1
+ #include "ruby_libxml.h"
2
+ #include "ruby_xml_xinclude.h"
3
+
4
+ VALUE cXMLXInclude;
5
+
6
+ /*
7
+ * Document-class: LibXML::XML::XInclude
8
+ *
9
+ * The ruby bindings do not currently expose libxml's
10
+ * XInclude fuctionality.
11
+ */
12
+
13
+ void rxml_init_xinclude(void)
14
+ {
15
+ cXMLXInclude = rb_define_class_under(mXML, "XInclude", rb_cObject);
16
+ }
@@ -1,11 +1,11 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XINCLUDE__
4
- #define __RXML_XINCLUDE__
5
-
6
- extern VALUE cXMLXInclude;
7
- extern VALUE eXMLXIncludeError;
8
-
9
- void rxml_init_xinclude(void);
10
-
11
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_XINCLUDE__
4
+ #define __RXML_XINCLUDE__
5
+
6
+ extern VALUE cXMLXInclude;
7
+ extern VALUE eXMLXIncludeError;
8
+
9
+ void rxml_init_xinclude(void);
10
+
11
+ #endif
@@ -74,17 +74,17 @@
74
74
  * ['ns0:http://services.somewhere.com', 'ns1:http://domain.somewhere.com'])
75
75
  */
76
76
 
77
-
78
77
  #include "ruby_libxml.h"
79
78
 
80
79
  VALUE mXPath;
81
80
 
82
- VALUE
83
- rxml_xpath_to_value(xmlXPathContextPtr xctxt, xmlXPathObjectPtr xobject) {
81
+ VALUE rxml_xpath_to_value(xmlXPathContextPtr xctxt, xmlXPathObjectPtr xobject)
82
+ {
84
83
  VALUE result;
85
84
  int type;
86
85
 
87
- if (xobject == NULL) {
86
+ if (xobject == NULL)
87
+ {
88
88
  /* xmlLastError is different than xctxt->lastError. Use
89
89
  xmlLastError since it has the message set while xctxt->lastError
90
90
  does not. */
@@ -92,7 +92,8 @@ rxml_xpath_to_value(xmlXPathContextPtr xctxt, xmlXPathObjectPtr xobject) {
92
92
  rxml_raise(xerror);
93
93
  }
94
94
 
95
- switch (type = xobject->type) {
95
+ switch (type = xobject->type)
96
+ {
96
97
  case XPATH_NODESET:
97
98
  result = rxml_xpath_object_wrap(xctxt->doc, xobject);
98
99
  break;
@@ -118,44 +119,49 @@ rxml_xpath_to_value(xmlXPathContextPtr xctxt, xmlXPathObjectPtr xobject) {
118
119
  return result;
119
120
  }
120
121
 
121
- xmlXPathObjectPtr
122
- rxml_xpath_from_value(VALUE value) {
122
+ xmlXPathObjectPtr rxml_xpath_from_value(VALUE value)
123
+ {
123
124
  xmlXPathObjectPtr result = NULL;
124
125
 
125
- switch (TYPE(value)) {
126
- case T_TRUE:
127
- case T_FALSE:
128
- result = xmlXPathNewBoolean(RTEST(value));
129
- break;
130
- case T_FIXNUM:
131
- case T_FLOAT:
132
- result = xmlXPathNewFloat(NUM2DBL(value));
133
- break;
134
- case T_STRING:
135
- result = xmlXPathWrapString(xmlStrdup((const xmlChar *)StringValuePtr(value)));
136
- break;
137
- case T_NIL:
138
- result = xmlXPathNewNodeSet(NULL);
139
- break;
140
- case T_ARRAY: {
141
- long i, j;
142
- result = xmlXPathNewNodeSet(NULL);
126
+ switch (TYPE(value))
127
+ {
128
+ case T_TRUE:
129
+ case T_FALSE:
130
+ result = xmlXPathNewBoolean(RTEST(value));
131
+ break;
132
+ case T_FIXNUM:
133
+ case T_FLOAT:
134
+ result = xmlXPathNewFloat(NUM2DBL(value));
135
+ break;
136
+ case T_STRING:
137
+ result = xmlXPathWrapString(xmlStrdup((const xmlChar *)StringValuePtr(value)));
138
+ break;
139
+ case T_NIL:
140
+ result = xmlXPathNewNodeSet(NULL);
141
+ break;
142
+ case T_ARRAY:
143
+ {
144
+ long i, j;
145
+ result = xmlXPathNewNodeSet(NULL);
143
146
 
144
- for (i = RARRAY_LEN(value); i > 0; i--) {
145
- xmlXPathObjectPtr obj = rxml_xpath_from_value(rb_ary_shift(value));
147
+ for (i = RARRAY_LEN(value); i > 0; i--)
148
+ {
149
+ xmlXPathObjectPtr obj = rxml_xpath_from_value(rb_ary_shift(value));
146
150
 
147
- if ((obj->nodesetval != NULL) && (obj->nodesetval->nodeNr != 0)) {
148
- for (j = 0; j < obj->nodesetval->nodeNr; j++) {
149
- xmlXPathNodeSetAdd(result->nodesetval, obj->nodesetval->nodeTab[j]);
150
- }
151
+ if ((obj->nodesetval != NULL) && (obj->nodesetval->nodeNr != 0))
152
+ {
153
+ for (j = 0; j < obj->nodesetval->nodeNr; j++)
154
+ {
155
+ xmlXPathNodeSetAdd(result->nodesetval, obj->nodesetval->nodeTab[j]);
151
156
  }
152
157
  }
153
- break;
154
158
  }
155
- default:
156
- rb_raise(rb_eTypeError,
157
- "can't convert object of type %s to XPath object", rb_obj_classname(value)
158
- );
159
+ break;
160
+ }
161
+ default:
162
+ rb_raise(rb_eTypeError,
163
+ "can't convert object of type %s to XPath object", rb_obj_classname(value)
164
+ );
159
165
  }
160
166
 
161
167
  return result;
@@ -1,13 +1,13 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XPATH__
4
- #define __RXML_XPATH__
5
-
6
- extern VALUE mXPath;
7
-
8
- void rxml_init_xpath(void);
9
-
10
- VALUE rxml_xpath_to_value(xmlXPathContextPtr, xmlXPathObjectPtr);
11
- xmlXPathObjectPtr rxml_xpath_from_value(VALUE);
12
-
13
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_XPATH__
4
+ #define __RXML_XPATH__
5
+
6
+ extern VALUE mXPath;
7
+
8
+ void rxml_init_xpath(void);
9
+
10
+ VALUE rxml_xpath_to_value(xmlXPathContextPtr, xmlXPathObjectPtr);
11
+ xmlXPathObjectPtr rxml_xpath_from_value(VALUE);
12
+
13
+ #endif
@@ -33,7 +33,7 @@ static void rxml_xpath_context_free(xmlXPathContextPtr ctxt)
33
33
 
34
34
  static void rxml_xpath_context_mark(xmlXPathContextPtr ctxt)
35
35
  {
36
- VALUE value = rxml_lookup_doc(ctxt->doc);
36
+ VALUE value = (VALUE)ctxt->doc->_private;
37
37
  rb_gc_mark(value);
38
38
  }
39
39
 
@@ -1,9 +1,9 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XPATH_CONTEXT__
4
- #define __RXML_XPATH_CONTEXT__
5
-
6
- extern VALUE cXMLXPathContext;
7
- void rxml_init_xpath_context(void);
8
-
9
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_XPATH_CONTEXT__
4
+ #define __RXML_XPATH_CONTEXT__
5
+
6
+ extern VALUE cXMLXPathContext;
7
+ void rxml_init_xpath_context(void);
8
+
9
+ #endif
@@ -1,81 +1,81 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #include "ruby_libxml.h"
4
- #include "ruby_xml_xpath.h"
5
- #include "ruby_xml_xpath_expression.h"
6
-
7
- /*
8
- * Document-class: LibXML::XML::XPath::Expression
9
- *
10
- * The XML::XPath::Expression class is used to compile
11
- * XPath expressions so they can be parsed only once
12
- * but reused multiple times.
13
- *
14
- * doc = XML::Document.string(IO.read('some xml file'))
15
- * expr = XPath::Expression.new('//first')
16
- * doc.root.each do |node|
17
- * result = node.find(expr) # many, many, many times
18
- * # ...
19
- * end
20
- */
21
-
22
- VALUE cXMLXPathExpression;
23
-
24
- static void rxml_xpath_expression_free(xmlXPathCompExprPtr expr)
25
- {
26
- xmlXPathFreeCompExpr(expr);
27
- }
28
-
29
- static VALUE rxml_xpath_expression_alloc(VALUE klass)
30
- {
31
- return Data_Wrap_Struct(cXMLXPathExpression, NULL,
32
- rxml_xpath_expression_free, NULL);
33
- }
34
-
35
- /* call-seq:
36
- * XPath::Expression.compile(expression) -> XPath::Expression
37
- *
38
- * Compiles an XPatch expression. This improves performance
39
- * when an XPath expression is called multiple times.
40
- *
41
- * doc = XML::Document.string('<header><first>hi</first></header>')
42
- * expr = XPath::Expression.new('//first')
43
- * nodes = doc.find(expr)
44
- */
45
- static VALUE rxml_xpath_expression_compile(VALUE klass, VALUE expression)
46
- {
47
- VALUE args[] = {expression};
48
- return rb_class_new_instance(1, args, cXMLXPathExpression);
49
- }
50
-
51
- /* call-seq:
52
- * XPath::Expression.new(expression) -> XPath::Expression
53
- *
54
- * Compiles an XPatch expression. This improves performance
55
- * when an XPath expression is called multiple times.
56
- *
57
- * doc = XML::Document.string('<header><first>hi</first></header>')
58
- * expr = XPath::Expression.new('//first')
59
- * nodes = doc.find(expr)
60
- */
61
- static VALUE rxml_xpath_expression_initialize(VALUE self, VALUE expression)
62
- {
63
- xmlXPathCompExprPtr compexpr = xmlXPathCompile((const xmlChar*)StringValueCStr(expression));
64
-
65
- if (compexpr == NULL)
66
- {
67
- xmlErrorPtr xerror = xmlGetLastError();
68
- rxml_raise(xerror);
69
- }
70
-
71
- DATA_PTR( self) = compexpr;
72
- return self;
73
- }
74
-
75
- void rxml_init_xpath_expression(void)
76
- {
77
- cXMLXPathExpression = rb_define_class_under(mXPath, "Expression", rb_cObject);
78
- rb_define_alloc_func(cXMLXPathExpression, rxml_xpath_expression_alloc);
79
- rb_define_singleton_method(cXMLXPathExpression, "compile", rxml_xpath_expression_compile, 1);
80
- rb_define_method(cXMLXPathExpression, "initialize", rxml_xpath_expression_initialize, 1);
81
- }
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #include "ruby_libxml.h"
4
+ #include "ruby_xml_xpath.h"
5
+ #include "ruby_xml_xpath_expression.h"
6
+
7
+ /*
8
+ * Document-class: LibXML::XML::XPath::Expression
9
+ *
10
+ * The XML::XPath::Expression class is used to compile
11
+ * XPath expressions so they can be parsed only once
12
+ * but reused multiple times.
13
+ *
14
+ * doc = XML::Document.string(IO.read('some xml file'))
15
+ * expr = XPath::Expression.new('//first')
16
+ * doc.root.each do |node|
17
+ * result = node.find(expr) # many, many, many times
18
+ * # ...
19
+ * end
20
+ */
21
+
22
+ VALUE cXMLXPathExpression;
23
+
24
+ static void rxml_xpath_expression_free(xmlXPathCompExprPtr expr)
25
+ {
26
+ xmlXPathFreeCompExpr(expr);
27
+ }
28
+
29
+ static VALUE rxml_xpath_expression_alloc(VALUE klass)
30
+ {
31
+ return Data_Wrap_Struct(cXMLXPathExpression, NULL,
32
+ rxml_xpath_expression_free, NULL);
33
+ }
34
+
35
+ /* call-seq:
36
+ * XPath::Expression.compile(expression) -> XPath::Expression
37
+ *
38
+ * Compiles an XPatch expression. This improves performance
39
+ * when an XPath expression is called multiple times.
40
+ *
41
+ * doc = XML::Document.string('<header><first>hi</first></header>')
42
+ * expr = XPath::Expression.new('//first')
43
+ * nodes = doc.find(expr)
44
+ */
45
+ static VALUE rxml_xpath_expression_compile(VALUE klass, VALUE expression)
46
+ {
47
+ VALUE args[] = {expression};
48
+ return rb_class_new_instance(1, args, cXMLXPathExpression);
49
+ }
50
+
51
+ /* call-seq:
52
+ * XPath::Expression.new(expression) -> XPath::Expression
53
+ *
54
+ * Compiles an XPatch expression. This improves performance
55
+ * when an XPath expression is called multiple times.
56
+ *
57
+ * doc = XML::Document.string('<header><first>hi</first></header>')
58
+ * expr = XPath::Expression.new('//first')
59
+ * nodes = doc.find(expr)
60
+ */
61
+ static VALUE rxml_xpath_expression_initialize(VALUE self, VALUE expression)
62
+ {
63
+ xmlXPathCompExprPtr compexpr = xmlXPathCompile((const xmlChar*)StringValueCStr(expression));
64
+
65
+ if (compexpr == NULL)
66
+ {
67
+ xmlErrorPtr xerror = xmlGetLastError();
68
+ rxml_raise(xerror);
69
+ }
70
+
71
+ DATA_PTR( self) = compexpr;
72
+ return self;
73
+ }
74
+
75
+ void rxml_init_xpath_expression(void)
76
+ {
77
+ cXMLXPathExpression = rb_define_class_under(mXPath, "Expression", rb_cObject);
78
+ rb_define_alloc_func(cXMLXPathExpression, rxml_xpath_expression_alloc);
79
+ rb_define_singleton_method(cXMLXPathExpression, "compile", rxml_xpath_expression_compile, 1);
80
+ rb_define_method(cXMLXPathExpression, "initialize", rxml_xpath_expression_initialize, 1);
81
+ }
@@ -1,10 +1,10 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XPATH_EXPRESSION__
4
- #define __RXML_XPATH_EXPRESSION__
5
-
6
- extern VALUE cXMLXPathExpression;
7
-
8
- void rxml_init_xpath_expression(void);
9
-
10
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_XPATH_EXPRESSION__
4
+ #define __RXML_XPATH_EXPRESSION__
5
+
6
+ extern VALUE cXMLXPathExpression;
7
+
8
+ void rxml_init_xpath_expression(void);
9
+
10
+ #endif
@@ -50,7 +50,7 @@ static void rxml_xpath_namespace_free(xmlNsPtr xns)
50
50
 
51
51
  static void rxml_xpath_object_mark(rxml_xpath_object *rxpop)
52
52
  {
53
- VALUE doc = rxml_lookup_doc(rxpop->xdoc);
53
+ VALUE doc = (VALUE)rxpop->xdoc->_private;
54
54
  rb_gc_mark(doc);
55
55
  rb_gc_mark(rxpop->nsnodes);
56
56
  }
@@ -59,6 +59,7 @@ VALUE rxml_xpath_object_wrap(xmlDocPtr xdoc, xmlXPathObjectPtr xpop)
59
59
  {
60
60
  int i;
61
61
  rxml_xpath_object *rxpop = ALLOC(rxml_xpath_object);
62
+
62
63
  /* Make sure Ruby's GC can find the array in the stack */
63
64
  VALUE nsnodes = rb_ary_new();
64
65
  rxpop->xdoc =xdoc;
@@ -67,7 +68,7 @@ VALUE rxml_xpath_object_wrap(xmlDocPtr xdoc, xmlXPathObjectPtr xpop)
67
68
  /* Find all the extra namespace nodes and wrap them. */
68
69
  if (xpop->nodesetval && xpop->nodesetval->nodeNr)
69
70
  {
70
- for (i = 0;i < xpop->nodesetval->nodeNr; i++)
71
+ for (i = 0; i < xpop->nodesetval->nodeNr; i++)
71
72
  {
72
73
  xmlNodePtr xnode = xpop->nodesetval->nodeTab[i];
73
74
  if (xnode != NULL && xnode->type == XML_NAMESPACE_DECL)
@@ -332,4 +333,6 @@ void rxml_init_xpath_object(void)
332
333
  rb_define_method(cXMLXPathObject, "[]", rxml_xpath_object_aref, 1);
333
334
  rb_define_method(cXMLXPathObject, "string", rxml_xpath_object_string, 0);
334
335
  rb_define_method(cXMLXPathObject, "debug", rxml_xpath_object_debug, 0);
336
+ rb_define_alias(cXMLXPathObject, "size", "length");
337
+
335
338
  }