libxml-ruby 2.7.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/HISTORY +33 -11
- data/README.rdoc +7 -7
- data/Rakefile +80 -77
- data/ext/libxml/extconf.h +4 -5
- data/ext/libxml/extconf.rb +57 -118
- data/ext/libxml/libxml.c +4 -0
- data/ext/libxml/ruby_xml.c +977 -893
- data/ext/libxml/ruby_xml.h +20 -10
- data/ext/libxml/ruby_xml_attr.c +333 -333
- data/ext/libxml/ruby_xml_attr_decl.c +2 -2
- data/ext/libxml/ruby_xml_cbg.c +85 -85
- data/ext/libxml/ruby_xml_document.c +1133 -1147
- data/ext/libxml/ruby_xml_dtd.c +261 -268
- data/ext/libxml/ruby_xml_encoding.c +262 -260
- data/ext/libxml/ruby_xml_encoding.h +19 -19
- data/ext/libxml/ruby_xml_html_parser_context.c +337 -338
- data/ext/libxml/ruby_xml_input_cbg.c +191 -191
- data/ext/libxml/ruby_xml_io.c +52 -50
- data/ext/libxml/ruby_xml_namespace.c +2 -2
- data/ext/libxml/ruby_xml_node.c +1446 -1452
- data/ext/libxml/ruby_xml_parser_context.c +999 -1001
- data/ext/libxml/ruby_xml_reader.c +1226 -1228
- data/ext/libxml/ruby_xml_relaxng.c +110 -111
- data/ext/libxml/ruby_xml_sax2_handler.c +326 -328
- data/ext/libxml/ruby_xml_schema.c +300 -301
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/ext/libxml/ruby_xml_writer.c +34 -16
- data/ext/libxml/ruby_xml_xpath.c +188 -187
- data/ext/libxml/ruby_xml_xpath_context.c +360 -361
- data/ext/libxml/ruby_xml_xpath_object.c +335 -335
- data/libxml-ruby.gemspec +47 -44
- data/test/tc_attr.rb +5 -7
- data/test/tc_attr_decl.rb +5 -6
- data/test/tc_attributes.rb +1 -2
- data/test/tc_canonicalize.rb +1 -2
- data/test/tc_deprecated_require.rb +1 -2
- data/test/tc_document.rb +4 -5
- data/test/tc_document_write.rb +2 -3
- data/test/tc_dtd.rb +4 -5
- data/test/tc_encoding.rb +126 -126
- data/test/tc_encoding_sax.rb +4 -3
- data/test/tc_error.rb +14 -15
- data/test/tc_html_parser.rb +15 -7
- data/test/tc_html_parser_context.rb +1 -2
- data/test/tc_namespace.rb +2 -3
- data/test/tc_namespaces.rb +5 -6
- data/test/tc_node.rb +2 -3
- data/test/tc_node_cdata.rb +2 -3
- data/test/tc_node_comment.rb +1 -2
- data/test/tc_node_copy.rb +1 -2
- data/test/tc_node_edit.rb +5 -7
- data/test/tc_node_pi.rb +1 -2
- data/test/tc_node_text.rb +2 -3
- data/test/tc_node_write.rb +2 -3
- data/test/tc_node_xlink.rb +1 -2
- data/test/tc_parser.rb +18 -24
- data/test/tc_parser_context.rb +6 -7
- data/test/tc_properties.rb +1 -2
- data/test/tc_reader.rb +9 -10
- data/test/tc_relaxng.rb +4 -5
- data/test/tc_sax_parser.rb +9 -10
- data/test/tc_schema.rb +4 -5
- data/test/tc_traversal.rb +1 -2
- data/test/tc_writer.rb +1 -2
- data/test/tc_xinclude.rb +1 -2
- data/test/tc_xml.rb +1 -2
- data/test/tc_xpath.rb +8 -9
- data/test/tc_xpath_context.rb +3 -4
- data/test/tc_xpath_expression.rb +3 -4
- data/test/tc_xpointer.rb +1 -3
- data/test/test_helper.rb +3 -1
- data/test/test_suite.rb +0 -1
- metadata +90 -72
- data/test/etc_doc_to_s.rb +0 -21
- data/test/ets_doc_file.rb +0 -17
- data/test/ets_doc_to_s.rb +0 -23
- data/test/ets_gpx.rb +0 -28
- data/test/ets_node_gc.rb +0 -23
- data/test/ets_test.xml +0 -2
- data/test/ets_tsr.rb +0 -11
- data/test/model/kml_sample.xml +0 -915
- data/test/remove_test.rb +0 -9
- data/test/tc_gc.rb +0 -86
- data/test/tc_parser.rb.orig +0 -384
@@ -1,111 +1,110 @@
|
|
1
|
-
#include "ruby_libxml.h"
|
2
|
-
#include "ruby_xml_relaxng.h"
|
3
|
-
|
4
|
-
/*
|
5
|
-
* Document-class: LibXML::XML::RelaxNG
|
6
|
-
*
|
7
|
-
* The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
|
8
|
-
* of xml documents.
|
9
|
-
*
|
10
|
-
* Schemas can be created from XML documents, strings or URIs using the
|
11
|
-
* corresponding methods (new for URIs).
|
12
|
-
*
|
13
|
-
* Once a schema is prepared, an XML document can be validated by the
|
14
|
-
* XML::Document#validate_relaxng method providing the XML::RelaxNG object
|
15
|
-
* as parameter. The method will raise an exception if the document is
|
16
|
-
* not valid.
|
17
|
-
*
|
18
|
-
* Basic Usage:
|
19
|
-
*
|
20
|
-
* # parse schema as xml document
|
21
|
-
* relaxng_document = XML::Document.file('schema.rng')
|
22
|
-
*
|
23
|
-
* # prepare schema for validation
|
24
|
-
* relaxng_schema = XML::RelaxNG.document(relaxng_document)
|
25
|
-
*
|
26
|
-
* # parse xml document to be validated
|
27
|
-
* instance = XML::Document.file('instance.xml')
|
28
|
-
*
|
29
|
-
* # validate
|
30
|
-
* instance.validate_relaxng(relaxng_schema)
|
31
|
-
*/
|
32
|
-
|
33
|
-
VALUE cXMLRelaxNG;
|
34
|
-
|
35
|
-
static void rxml_relaxng_free(xmlRelaxNGPtr xrelaxng)
|
36
|
-
{
|
37
|
-
xmlRelaxNGFree(xrelaxng);
|
38
|
-
}
|
39
|
-
|
40
|
-
/*
|
41
|
-
* call-seq:
|
42
|
-
* XML::Relaxng.new(relaxng_uri) -> relaxng
|
43
|
-
*
|
44
|
-
* Create a new relaxng from the specified URI.
|
45
|
-
*/
|
46
|
-
static VALUE rxml_relaxng_init_from_uri(VALUE class, VALUE uri)
|
47
|
-
{
|
48
|
-
xmlRelaxNGParserCtxtPtr xparser;
|
49
|
-
xmlRelaxNGPtr xrelaxng;
|
50
|
-
|
51
|
-
Check_Type(uri, T_STRING);
|
52
|
-
|
53
|
-
xparser = xmlRelaxNGNewParserCtxt(StringValuePtr(uri));
|
54
|
-
xrelaxng = xmlRelaxNGParse(xparser);
|
55
|
-
xmlRelaxNGFreeParserCtxt(xparser);
|
56
|
-
|
57
|
-
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
58
|
-
}
|
59
|
-
|
60
|
-
/*
|
61
|
-
* call-seq:
|
62
|
-
* XML::RelaxNG.document(document) -> relaxng
|
63
|
-
*
|
64
|
-
* Create a new relaxng from the specified document.
|
65
|
-
*/
|
66
|
-
static VALUE rxml_relaxng_init_from_document(VALUE class, VALUE document)
|
67
|
-
{
|
68
|
-
xmlDocPtr xdoc;
|
69
|
-
xmlRelaxNGPtr xrelaxng;
|
70
|
-
xmlRelaxNGParserCtxtPtr xparser;
|
71
|
-
|
72
|
-
Data_Get_Struct(document, xmlDoc, xdoc);
|
73
|
-
|
74
|
-
xparser = xmlRelaxNGNewDocParserCtxt(xdoc);
|
75
|
-
xrelaxng = xmlRelaxNGParse(xparser);
|
76
|
-
xmlRelaxNGFreeParserCtxt(xparser);
|
77
|
-
|
78
|
-
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
79
|
-
}
|
80
|
-
|
81
|
-
/*
|
82
|
-
* call-seq:
|
83
|
-
* XML::RelaxNG.string("relaxng_data") -> "value"
|
84
|
-
*
|
85
|
-
* Create a new relaxng using the specified string.
|
86
|
-
*/
|
87
|
-
static VALUE rxml_relaxng_init_from_string(VALUE self, VALUE relaxng_str)
|
88
|
-
{
|
89
|
-
xmlRelaxNGParserCtxtPtr xparser;
|
90
|
-
xmlRelaxNGPtr xrelaxng;
|
91
|
-
|
92
|
-
Check_Type(relaxng_str, T_STRING);
|
93
|
-
|
94
|
-
xparser = xmlRelaxNGNewMemParserCtxt(StringValuePtr(relaxng_str), strlen(
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
cXMLRelaxNG
|
105
|
-
rb_define_singleton_method(cXMLRelaxNG, "
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
1
|
+
#include "ruby_libxml.h"
|
2
|
+
#include "ruby_xml_relaxng.h"
|
3
|
+
|
4
|
+
/*
|
5
|
+
* Document-class: LibXML::XML::RelaxNG
|
6
|
+
*
|
7
|
+
* The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
|
8
|
+
* of xml documents.
|
9
|
+
*
|
10
|
+
* Schemas can be created from XML documents, strings or URIs using the
|
11
|
+
* corresponding methods (new for URIs).
|
12
|
+
*
|
13
|
+
* Once a schema is prepared, an XML document can be validated by the
|
14
|
+
* XML::Document#validate_relaxng method providing the XML::RelaxNG object
|
15
|
+
* as parameter. The method will raise an exception if the document is
|
16
|
+
* not valid.
|
17
|
+
*
|
18
|
+
* Basic Usage:
|
19
|
+
*
|
20
|
+
* # parse schema as xml document
|
21
|
+
* relaxng_document = XML::Document.file('schema.rng')
|
22
|
+
*
|
23
|
+
* # prepare schema for validation
|
24
|
+
* relaxng_schema = XML::RelaxNG.document(relaxng_document)
|
25
|
+
*
|
26
|
+
* # parse xml document to be validated
|
27
|
+
* instance = XML::Document.file('instance.xml')
|
28
|
+
*
|
29
|
+
* # validate
|
30
|
+
* instance.validate_relaxng(relaxng_schema)
|
31
|
+
*/
|
32
|
+
|
33
|
+
VALUE cXMLRelaxNG;
|
34
|
+
|
35
|
+
static void rxml_relaxng_free(xmlRelaxNGPtr xrelaxng)
|
36
|
+
{
|
37
|
+
xmlRelaxNGFree(xrelaxng);
|
38
|
+
}
|
39
|
+
|
40
|
+
/*
|
41
|
+
* call-seq:
|
42
|
+
* XML::Relaxng.new(relaxng_uri) -> relaxng
|
43
|
+
*
|
44
|
+
* Create a new relaxng from the specified URI.
|
45
|
+
*/
|
46
|
+
static VALUE rxml_relaxng_init_from_uri(VALUE class, VALUE uri)
|
47
|
+
{
|
48
|
+
xmlRelaxNGParserCtxtPtr xparser;
|
49
|
+
xmlRelaxNGPtr xrelaxng;
|
50
|
+
|
51
|
+
Check_Type(uri, T_STRING);
|
52
|
+
|
53
|
+
xparser = xmlRelaxNGNewParserCtxt(StringValuePtr(uri));
|
54
|
+
xrelaxng = xmlRelaxNGParse(xparser);
|
55
|
+
xmlRelaxNGFreeParserCtxt(xparser);
|
56
|
+
|
57
|
+
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
58
|
+
}
|
59
|
+
|
60
|
+
/*
|
61
|
+
* call-seq:
|
62
|
+
* XML::RelaxNG.document(document) -> relaxng
|
63
|
+
*
|
64
|
+
* Create a new relaxng from the specified document.
|
65
|
+
*/
|
66
|
+
static VALUE rxml_relaxng_init_from_document(VALUE class, VALUE document)
|
67
|
+
{
|
68
|
+
xmlDocPtr xdoc;
|
69
|
+
xmlRelaxNGPtr xrelaxng;
|
70
|
+
xmlRelaxNGParserCtxtPtr xparser;
|
71
|
+
|
72
|
+
Data_Get_Struct(document, xmlDoc, xdoc);
|
73
|
+
|
74
|
+
xparser = xmlRelaxNGNewDocParserCtxt(xdoc);
|
75
|
+
xrelaxng = xmlRelaxNGParse(xparser);
|
76
|
+
xmlRelaxNGFreeParserCtxt(xparser);
|
77
|
+
|
78
|
+
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
79
|
+
}
|
80
|
+
|
81
|
+
/*
|
82
|
+
* call-seq:
|
83
|
+
* XML::RelaxNG.string("relaxng_data") -> "value"
|
84
|
+
*
|
85
|
+
* Create a new relaxng using the specified string.
|
86
|
+
*/
|
87
|
+
static VALUE rxml_relaxng_init_from_string(VALUE self, VALUE relaxng_str)
|
88
|
+
{
|
89
|
+
xmlRelaxNGParserCtxtPtr xparser;
|
90
|
+
xmlRelaxNGPtr xrelaxng;
|
91
|
+
|
92
|
+
Check_Type(relaxng_str, T_STRING);
|
93
|
+
|
94
|
+
xparser = xmlRelaxNGNewMemParserCtxt(StringValuePtr(relaxng_str), (int)strlen(StringValuePtr(relaxng_str)));
|
95
|
+
xrelaxng = xmlRelaxNGParse(xparser);
|
96
|
+
xmlRelaxNGFreeParserCtxt(xparser);
|
97
|
+
|
98
|
+
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
99
|
+
}
|
100
|
+
|
101
|
+
void rxml_init_relaxng(void)
|
102
|
+
{
|
103
|
+
cXMLRelaxNG = rb_define_class_under(mXML, "RelaxNG", rb_cObject);
|
104
|
+
rb_define_singleton_method(cXMLRelaxNG, "new", rxml_relaxng_init_from_uri, 1);
|
105
|
+
rb_define_singleton_method(cXMLRelaxNG, "from_string",
|
106
|
+
rxml_relaxng_init_from_string, 1);
|
107
|
+
rb_define_singleton_method(cXMLRelaxNG, "document",
|
108
|
+
rxml_relaxng_init_from_document, 1);
|
109
|
+
}
|
110
|
+
|