libxml-ruby 4.0.0-x64-mingw-ucrt → 4.1.2-x64-mingw-ucrt
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY +18 -0
- data/ext/libxml/extconf.rb +67 -61
- data/ext/libxml/ruby_xml.c +0 -40
- data/ext/libxml/ruby_xml_attr_decl.c +154 -153
- data/ext/libxml/ruby_xml_attributes.c +276 -275
- data/ext/libxml/ruby_xml_encoding.c +1 -1
- data/ext/libxml/ruby_xml_error.c +2 -2
- data/ext/libxml/ruby_xml_html_parser_context.c +0 -1
- data/ext/libxml/ruby_xml_input_cbg.c +4 -7
- data/ext/libxml/ruby_xml_parser.h +0 -2
- data/ext/libxml/ruby_xml_parser_options.h +0 -2
- data/ext/libxml/ruby_xml_reader.c +1245 -1242
- data/ext/libxml/ruby_xml_relaxng.c +113 -112
- data/ext/libxml/ruby_xml_schema.c +422 -420
- data/ext/libxml/ruby_xml_schema_attribute.c +108 -107
- data/ext/libxml/ruby_xml_schema_element.c +70 -69
- data/ext/libxml/ruby_xml_schema_type.c +252 -251
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/libxml/ruby_xml_writer.c +1138 -1137
- data/ext/libxml/ruby_xml_xpath_expression.c +81 -81
- data/ext/libxml/ruby_xml_xpath_object.c +340 -339
- data/lib/3.1/libxml_ruby.so +0 -0
- data/lib/libxml/error.rb +7 -7
- data/lib/libxml/schema/element.rb +27 -19
- data/test/test_error.rb +173 -157
- data/test/test_schema.rb +237 -231
- data/test/test_xml.rb +0 -8
- metadata +3 -4
- data/lib/3.2/libxml_ruby.so +0 -0
@@ -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
|
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
|
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 XPath 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 XPath 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
|
+
}
|