libxml-ruby 4.1.1-x64-mingw-ucrt → 4.1.2-x64-mingw-ucrt
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/HISTORY +8 -0
- data/ext/libxml/extconf.rb +67 -61
- data/ext/libxml/ruby_xml_attr_decl.c +154 -153
- data/ext/libxml/ruby_xml_attributes.c +276 -275
- 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 +2 -2
- 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/libxml/schema/element.rb +27 -19
- data/test/test_schema.rb +237 -231
- metadata +3 -4
- data/lib/3.2/libxml_ruby.so +0 -0
@@ -1,112 +1,113 @@
|
|
1
|
-
#include "ruby_libxml.h"
|
2
|
-
#include "ruby_xml_relaxng.h"
|
3
|
-
|
4
|
-
#include <libxml/relaxng.h>
|
5
|
-
|
6
|
-
/*
|
7
|
-
* Document-class: LibXML::XML::RelaxNG
|
8
|
-
*
|
9
|
-
* The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
|
10
|
-
* of xml documents.
|
11
|
-
*
|
12
|
-
* Schemas can be created from XML documents, strings or URIs using the
|
13
|
-
* corresponding methods (new for URIs).
|
14
|
-
*
|
15
|
-
* Once a schema is prepared, an XML document can be validated by the
|
16
|
-
* XML::Document#validate_relaxng method providing the XML::RelaxNG object
|
17
|
-
* as parameter. The method will raise an exception if the document is
|
18
|
-
* not valid.
|
19
|
-
*
|
20
|
-
* Basic Usage:
|
21
|
-
*
|
22
|
-
* # parse schema as xml document
|
23
|
-
* relaxng_document = XML::Document.file('schema.rng')
|
24
|
-
*
|
25
|
-
* # prepare schema for validation
|
26
|
-
* relaxng_schema = XML::RelaxNG.document(relaxng_document)
|
27
|
-
*
|
28
|
-
* # parse xml document to be validated
|
29
|
-
* instance = XML::Document.file('instance.xml')
|
30
|
-
*
|
31
|
-
* # validate
|
32
|
-
* instance.validate_relaxng(relaxng_schema)
|
33
|
-
*/
|
34
|
-
|
35
|
-
VALUE cXMLRelaxNG;
|
36
|
-
|
37
|
-
static void rxml_relaxng_free(xmlRelaxNGPtr xrelaxng)
|
38
|
-
{
|
39
|
-
xmlRelaxNGFree(xrelaxng);
|
40
|
-
}
|
41
|
-
|
42
|
-
/*
|
43
|
-
* call-seq:
|
44
|
-
* XML::Relaxng.new(relaxng_uri) -> relaxng
|
45
|
-
*
|
46
|
-
* Create a new relaxng from the specified URI.
|
47
|
-
*/
|
48
|
-
static VALUE rxml_relaxng_init_from_uri(VALUE class, VALUE uri)
|
49
|
-
{
|
50
|
-
xmlRelaxNGParserCtxtPtr xparser;
|
51
|
-
xmlRelaxNGPtr xrelaxng;
|
52
|
-
|
53
|
-
Check_Type(uri, T_STRING);
|
54
|
-
|
55
|
-
xparser = xmlRelaxNGNewParserCtxt(StringValuePtr(uri));
|
56
|
-
xrelaxng = xmlRelaxNGParse(xparser);
|
57
|
-
xmlRelaxNGFreeParserCtxt(xparser);
|
58
|
-
|
59
|
-
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
60
|
-
}
|
61
|
-
|
62
|
-
/*
|
63
|
-
* call-seq:
|
64
|
-
* XML::RelaxNG.document(document) -> relaxng
|
65
|
-
*
|
66
|
-
* Create a new relaxng from the specified document.
|
67
|
-
*/
|
68
|
-
static VALUE rxml_relaxng_init_from_document(VALUE class, VALUE document)
|
69
|
-
{
|
70
|
-
xmlDocPtr xdoc;
|
71
|
-
xmlRelaxNGPtr xrelaxng;
|
72
|
-
xmlRelaxNGParserCtxtPtr xparser;
|
73
|
-
|
74
|
-
Data_Get_Struct(document, xmlDoc, xdoc);
|
75
|
-
|
76
|
-
xparser = xmlRelaxNGNewDocParserCtxt(xdoc);
|
77
|
-
xrelaxng = xmlRelaxNGParse(xparser);
|
78
|
-
xmlRelaxNGFreeParserCtxt(xparser);
|
79
|
-
|
80
|
-
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
81
|
-
}
|
82
|
-
|
83
|
-
/*
|
84
|
-
* call-seq:
|
85
|
-
* XML::RelaxNG.string("relaxng_data") -> "value"
|
86
|
-
*
|
87
|
-
* Create a new relaxng using the specified string.
|
88
|
-
*/
|
89
|
-
static VALUE rxml_relaxng_init_from_string(VALUE self, VALUE relaxng_str)
|
90
|
-
{
|
91
|
-
xmlRelaxNGParserCtxtPtr xparser;
|
92
|
-
xmlRelaxNGPtr xrelaxng;
|
93
|
-
|
94
|
-
Check_Type(relaxng_str, T_STRING);
|
95
|
-
|
96
|
-
xparser = xmlRelaxNGNewMemParserCtxt(StringValuePtr(relaxng_str), (int)strlen(StringValuePtr(relaxng_str)));
|
97
|
-
xrelaxng = xmlRelaxNGParse(xparser);
|
98
|
-
xmlRelaxNGFreeParserCtxt(xparser);
|
99
|
-
|
100
|
-
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
101
|
-
}
|
102
|
-
|
103
|
-
void rxml_init_relaxng(void)
|
104
|
-
{
|
105
|
-
cXMLRelaxNG = rb_define_class_under(mXML, "RelaxNG", rb_cObject);
|
106
|
-
|
107
|
-
rb_define_singleton_method(cXMLRelaxNG, "
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
1
|
+
#include "ruby_libxml.h"
|
2
|
+
#include "ruby_xml_relaxng.h"
|
3
|
+
|
4
|
+
#include <libxml/relaxng.h>
|
5
|
+
|
6
|
+
/*
|
7
|
+
* Document-class: LibXML::XML::RelaxNG
|
8
|
+
*
|
9
|
+
* The XML::RelaxNG class is used to prepare RelaxNG schemas for validation
|
10
|
+
* of xml documents.
|
11
|
+
*
|
12
|
+
* Schemas can be created from XML documents, strings or URIs using the
|
13
|
+
* corresponding methods (new for URIs).
|
14
|
+
*
|
15
|
+
* Once a schema is prepared, an XML document can be validated by the
|
16
|
+
* XML::Document#validate_relaxng method providing the XML::RelaxNG object
|
17
|
+
* as parameter. The method will raise an exception if the document is
|
18
|
+
* not valid.
|
19
|
+
*
|
20
|
+
* Basic Usage:
|
21
|
+
*
|
22
|
+
* # parse schema as xml document
|
23
|
+
* relaxng_document = XML::Document.file('schema.rng')
|
24
|
+
*
|
25
|
+
* # prepare schema for validation
|
26
|
+
* relaxng_schema = XML::RelaxNG.document(relaxng_document)
|
27
|
+
*
|
28
|
+
* # parse xml document to be validated
|
29
|
+
* instance = XML::Document.file('instance.xml')
|
30
|
+
*
|
31
|
+
* # validate
|
32
|
+
* instance.validate_relaxng(relaxng_schema)
|
33
|
+
*/
|
34
|
+
|
35
|
+
VALUE cXMLRelaxNG;
|
36
|
+
|
37
|
+
static void rxml_relaxng_free(xmlRelaxNGPtr xrelaxng)
|
38
|
+
{
|
39
|
+
xmlRelaxNGFree(xrelaxng);
|
40
|
+
}
|
41
|
+
|
42
|
+
/*
|
43
|
+
* call-seq:
|
44
|
+
* XML::Relaxng.new(relaxng_uri) -> relaxng
|
45
|
+
*
|
46
|
+
* Create a new relaxng from the specified URI.
|
47
|
+
*/
|
48
|
+
static VALUE rxml_relaxng_init_from_uri(VALUE class, VALUE uri)
|
49
|
+
{
|
50
|
+
xmlRelaxNGParserCtxtPtr xparser;
|
51
|
+
xmlRelaxNGPtr xrelaxng;
|
52
|
+
|
53
|
+
Check_Type(uri, T_STRING);
|
54
|
+
|
55
|
+
xparser = xmlRelaxNGNewParserCtxt(StringValuePtr(uri));
|
56
|
+
xrelaxng = xmlRelaxNGParse(xparser);
|
57
|
+
xmlRelaxNGFreeParserCtxt(xparser);
|
58
|
+
|
59
|
+
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
60
|
+
}
|
61
|
+
|
62
|
+
/*
|
63
|
+
* call-seq:
|
64
|
+
* XML::RelaxNG.document(document) -> relaxng
|
65
|
+
*
|
66
|
+
* Create a new relaxng from the specified document.
|
67
|
+
*/
|
68
|
+
static VALUE rxml_relaxng_init_from_document(VALUE class, VALUE document)
|
69
|
+
{
|
70
|
+
xmlDocPtr xdoc;
|
71
|
+
xmlRelaxNGPtr xrelaxng;
|
72
|
+
xmlRelaxNGParserCtxtPtr xparser;
|
73
|
+
|
74
|
+
Data_Get_Struct(document, xmlDoc, xdoc);
|
75
|
+
|
76
|
+
xparser = xmlRelaxNGNewDocParserCtxt(xdoc);
|
77
|
+
xrelaxng = xmlRelaxNGParse(xparser);
|
78
|
+
xmlRelaxNGFreeParserCtxt(xparser);
|
79
|
+
|
80
|
+
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
81
|
+
}
|
82
|
+
|
83
|
+
/*
|
84
|
+
* call-seq:
|
85
|
+
* XML::RelaxNG.string("relaxng_data") -> "value"
|
86
|
+
*
|
87
|
+
* Create a new relaxng using the specified string.
|
88
|
+
*/
|
89
|
+
static VALUE rxml_relaxng_init_from_string(VALUE self, VALUE relaxng_str)
|
90
|
+
{
|
91
|
+
xmlRelaxNGParserCtxtPtr xparser;
|
92
|
+
xmlRelaxNGPtr xrelaxng;
|
93
|
+
|
94
|
+
Check_Type(relaxng_str, T_STRING);
|
95
|
+
|
96
|
+
xparser = xmlRelaxNGNewMemParserCtxt(StringValuePtr(relaxng_str), (int)strlen(StringValuePtr(relaxng_str)));
|
97
|
+
xrelaxng = xmlRelaxNGParse(xparser);
|
98
|
+
xmlRelaxNGFreeParserCtxt(xparser);
|
99
|
+
|
100
|
+
return Data_Wrap_Struct(cXMLRelaxNG, NULL, rxml_relaxng_free, xrelaxng);
|
101
|
+
}
|
102
|
+
|
103
|
+
void rxml_init_relaxng(void)
|
104
|
+
{
|
105
|
+
cXMLRelaxNG = rb_define_class_under(mXML, "RelaxNG", rb_cObject);
|
106
|
+
rb_undef_alloc_func(cXMLRelaxNG);
|
107
|
+
rb_define_singleton_method(cXMLRelaxNG, "new", rxml_relaxng_init_from_uri, 1);
|
108
|
+
rb_define_singleton_method(cXMLRelaxNG, "from_string",
|
109
|
+
rxml_relaxng_init_from_string, 1);
|
110
|
+
rb_define_singleton_method(cXMLRelaxNG, "document",
|
111
|
+
rxml_relaxng_init_from_document, 1);
|
112
|
+
}
|
113
|
+
|