libxml-ruby 3.0.0-x64-mingw32 → 3.1.0-x64-mingw32
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 +5 -5
- data/HISTORY +18 -0
- data/MANIFEST +34 -34
- data/README.rdoc +14 -1
- data/Rakefile +18 -8
- data/ext/libxml/ruby_xml_error.c +1 -1
- data/ext/libxml/ruby_xml_error.h +1 -1
- data/ext/libxml/ruby_xml_node.c +15 -16
- data/ext/libxml/ruby_xml_reader.c +7 -2
- data/ext/libxml/ruby_xml_schema.c +44 -66
- data/ext/libxml/ruby_xml_schema_element.c +15 -14
- data/ext/libxml/ruby_xml_schema_type.c +66 -93
- data/ext/libxml/ruby_xml_version.h +3 -3
- data/lib/libxml/schema.rb +0 -19
- data/lib/libxml/schema/element.rb +0 -8
- data/lib/libxml/schema/type.rb +0 -8
- data/libxml-ruby.gemspec +3 -2
- data/setup.rb +0 -1
- data/test/model/cwm_1_0.xml +11336 -0
- data/test/{tc_attr.rb → test_attr.rb} +1 -1
- data/test/{tc_attr_decl.rb → test_attr_decl.rb} +1 -1
- data/test/{tc_attributes.rb → test_attributes.rb} +1 -1
- data/test/{tc_canonicalize.rb → test_canonicalize.rb} +32 -28
- data/test/{tc_deprecated_require.rb → test_deprecated_require.rb} +0 -0
- data/test/{tc_document.rb → test_document.rb} +3 -3
- data/test/{tc_document_write.rb → test_document_write.rb} +1 -1
- data/test/{tc_dtd.rb → test_dtd.rb} +6 -6
- data/test/{tc_encoding.rb → test_encoding.rb} +6 -3
- data/test/{tc_encoding_sax.rb → test_encoding_sax.rb} +1 -1
- data/test/{tc_error.rb → test_error.rb} +1 -1
- data/test/test_helper.rb +0 -2
- data/test/{tc_html_parser.rb → test_html_parser.rb} +3 -2
- data/test/{tc_html_parser_context.rb → test_html_parser_context.rb} +1 -1
- data/test/{tc_namespace.rb → test_namespace.rb} +3 -4
- data/test/{tc_namespaces.rb → test_namespaces.rb} +5 -14
- data/test/{tc_node.rb → test_node.rb} +2 -2
- data/test/{tc_node_cdata.rb → test_node_cdata.rb} +1 -1
- data/test/{tc_node_comment.rb → test_node_comment.rb} +1 -1
- data/test/{tc_node_copy.rb → test_node_copy.rb} +2 -3
- data/test/{tc_node_edit.rb → test_node_edit.rb} +5 -6
- data/test/{tc_node_pi.rb → test_node_pi.rb} +2 -4
- data/test/{tc_node_text.rb → test_node_text.rb} +4 -5
- data/test/{tc_node_write.rb → test_node_write.rb} +1 -1
- data/test/{tc_node_xlink.rb → test_node_xlink.rb} +1 -1
- data/test/{tc_parser.rb → test_parser.rb} +7 -6
- data/test/{tc_parser_context.rb → test_parser_context.rb} +8 -8
- data/test/{tc_properties.rb → test_properties.rb} +1 -1
- data/test/{tc_reader.rb → test_reader.rb} +30 -20
- data/test/{tc_relaxng.rb → test_relaxng.rb} +2 -2
- data/test/{tc_sax_parser.rb → test_sax_parser.rb} +3 -3
- data/test/{tc_schema.rb → test_schema.rb} +18 -11
- data/test/test_suite.rb +38 -38
- data/test/{tc_traversal.rb → test_traversal.rb} +1 -1
- data/test/{tc_writer.rb → test_writer.rb} +1 -1
- data/test/{tc_xinclude.rb → test_xinclude.rb} +1 -1
- data/test/{tc_xml.rb → test_xml.rb} +61 -36
- data/test/{tc_xpath.rb → test_xpath.rb} +4 -4
- data/test/{tc_xpath_context.rb → test_xpath_context.rb} +1 -1
- data/test/{tc_xpath_expression.rb → test_xpath_expression.rb} +2 -2
- data/test/{tc_xpointer.rb → test_xpointer.rb} +1 -1
- metadata +84 -99
- data/lib/2.4/libxml_ruby.so +0 -0
- data/lib/libs/libiconv-2.dll +0 -0
- data/lib/libs/libxml2-2.dll +0 -0
- data/lib/libs/zlib1.dll +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6c251462b54a6274c73578e63d1d7b7f496c2d04eb9c736a41369e4db47a4287
|
4
|
+
data.tar.gz: c47353a4c4d67e8606bf1497307aff545f5af0ec4897095455b8593652688b90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cb5f97782afcb99ed768ece7618e95aa00b850a14ced7fd72ee0080183ce343f3cfe62aecfec28160174aeeccb985d52c941df7414d09cf582cf6d4dcadfc92
|
7
|
+
data.tar.gz: fd89222b49885b2e9ee2032dd1c6c6b2541af8816f73f0df55a23e6fa7c48b37456e83acd2dd626ec14d8dd878ec2ddef244ee10516670ff41661cf5f79cc32b
|
data/HISTORY
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
= Release History
|
2
2
|
|
3
|
+
== 3.1.0 / 2018-02-03 Charlie Savage
|
4
|
+
|
5
|
+
* Fix segmentation fault when adding one node to another node (Charlie Savage)
|
6
|
+
* Fix deprecated "assert_equal(nil, expected)" calls. #148 and #151. (utilum)
|
7
|
+
* Remove assigned but unused variables. #150 (utilum)
|
8
|
+
* Add Gemfile. #146. (Dorian Marié)
|
9
|
+
* Remove duplicate hash key in setup.rb. #147. (Dorian Marié)
|
10
|
+
* Fix gemspec by requiring Date. #149 (utilum)
|
11
|
+
* Restore default internal encoding after tests are completed. #123 (Charlie Savage)
|
12
|
+
* Remove duplicate method definitions. #145. (Charlie Savage)
|
13
|
+
* Remove SchemaElement#minOccurs and SchemaElement#maxOccurs since they actually did not work (Charlie Savage)
|
14
|
+
* Rename test files to follow Ruby conventions (Charlie Savage)
|
15
|
+
* Fix handling of node returned by Reader#expand. #142. (Charlie Savage)
|
16
|
+
* Add Travis Build support (Charlie Savage)
|
17
|
+
* Fix Fixnum deprecation (Charlie Savage)
|
18
|
+
* Cleanup schema code (Charlie Savage)
|
19
|
+
* Update Visual Studio project to 2017 (Charlie Savage)
|
20
|
+
|
3
21
|
== 3.0.0 / 2017-02-07 Charlie Savage
|
4
22
|
|
5
23
|
* Revamp how libxml-ruby manages memory. Instead of trying to return the same ruby object for each xmlnode,
|
data/MANIFEST
CHANGED
@@ -122,40 +122,40 @@ test/model/shiporder.xml
|
|
122
122
|
test/model/shiporder.xsd
|
123
123
|
test/model/soap.xml
|
124
124
|
test/model/xinclude.xml
|
125
|
-
test/
|
126
|
-
test/
|
127
|
-
test/
|
128
|
-
test/
|
129
|
-
test/
|
130
|
-
test/
|
131
|
-
test/
|
132
|
-
test/
|
133
|
-
test/
|
134
|
-
test/
|
135
|
-
test/
|
136
|
-
test/
|
137
|
-
test/
|
138
|
-
test/
|
139
|
-
test/
|
140
|
-
test/
|
141
|
-
test/
|
142
|
-
test/
|
143
|
-
test/
|
144
|
-
test/
|
145
|
-
test/
|
146
|
-
test/
|
147
|
-
test/
|
148
|
-
test/
|
149
|
-
test/
|
150
|
-
test/
|
151
|
-
test/
|
152
|
-
test/
|
153
|
-
test/
|
154
|
-
test/
|
155
|
-
test/
|
156
|
-
test/
|
157
|
-
test/
|
158
|
-
test/
|
125
|
+
test/test_attr.rb
|
126
|
+
test/test_attr_decl.rb
|
127
|
+
test/test_attributes.rb
|
128
|
+
test/test_deprecated_require.rb
|
129
|
+
test/test_document.rb
|
130
|
+
test/test_document_write.rb
|
131
|
+
test/test_dtd.rb
|
132
|
+
test/test_error.rb
|
133
|
+
test/test_html_parser.rb
|
134
|
+
test/test_namespace.rb
|
135
|
+
test/test_namespaces.rb
|
136
|
+
test/test_node.rb
|
137
|
+
test/test_node_cdata.rb
|
138
|
+
test/test_node_comment.rb
|
139
|
+
test/test_node_copy.rb
|
140
|
+
test/test_node_edit.rb
|
141
|
+
test/test_node_pi.rb
|
142
|
+
test/test_node_text.rb
|
143
|
+
test/test_node_write.rb
|
144
|
+
test/test_node_xlink.rb
|
145
|
+
test/test_parser.rb
|
146
|
+
test/test_parser_context.rb
|
147
|
+
test/test_properties.rb
|
148
|
+
test/test_reader.rb
|
149
|
+
test/test_relaxng.rb
|
150
|
+
test/test_sax_parser.rb
|
151
|
+
test/test_schema.rb
|
152
|
+
test/test_traversal.rb
|
153
|
+
test/test_xinclude.rb
|
154
|
+
test/test_xml.rb
|
155
|
+
test/test_xpath.rb
|
156
|
+
test/test_xpath_context.rb
|
157
|
+
test/test_xpath_expression.rb
|
158
|
+
test/test_xpointer.rb
|
159
159
|
test/test_suite.rb
|
160
160
|
Rakefile
|
161
161
|
HISTORY.rdoc
|
data/README.rdoc
CHANGED
@@ -11,7 +11,7 @@ We think libxml-ruby is the best XML library for Ruby because:
|
|
11
11
|
* Conformance - It passes all 1800+ tests from the OASIS XML Tests Suite
|
12
12
|
|
13
13
|
== Requirements
|
14
|
-
libxml-ruby requires Ruby 1.8.
|
14
|
+
libxml-ruby requires Ruby 1.8.7 or higher. It depends on libxml2 to
|
15
15
|
function propoerly. libxml2, in turn, depends on:
|
16
16
|
|
17
17
|
* libm (math routines: very standard)
|
@@ -118,6 +118,18 @@ libxml-ruby fully supports native, background Ruby threads. This of course
|
|
118
118
|
only applies to Ruby 1.9.x and higher since earlier versions of Ruby do not
|
119
119
|
support native threads.
|
120
120
|
|
121
|
+
== Tests
|
122
|
+
|
123
|
+
To run tests you first need to build the shared libary:
|
124
|
+
|
125
|
+
rake compile
|
126
|
+
|
127
|
+
Once you have build the shared libary, you can then run tests using rake:
|
128
|
+
|
129
|
+
rake test
|
130
|
+
|
131
|
+
+Travis build status: {<img src="https://travis-ci.org/xml4r/libxml-ruby.svg?branch=master" alt="Build Status" />}[https://travis-ci.org/xml4r/libxml-ruby]
|
132
|
+
|
121
133
|
== Performance
|
122
134
|
In addition to being feature rich and conformation, the main reason
|
123
135
|
people use libxml-ruby is for performance. Here are the results
|
@@ -186,3 +198,4 @@ and are no longer in scope (since if they were the document would not be freed).
|
|
186
198
|
|
187
199
|
== License
|
188
200
|
See LICENSE for license information.
|
201
|
+
|
data/Rakefile
CHANGED
@@ -16,13 +16,22 @@ spec = Gem::Specification.load("#{GEM_NAME}.gemspec")
|
|
16
16
|
task :default => [:test]
|
17
17
|
|
18
18
|
# Setup compile tasks
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
19
|
+
if RUBY_PLATFORM.match(/mswin32|mswin64|mingw32/)
|
20
|
+
Rake::ExtensionTask.new do |ext|
|
21
|
+
ext.gem_spec = spec
|
22
|
+
ext.name = SO_NAME
|
23
|
+
ext.ext_dir = "ext/libxml"
|
24
|
+
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
|
25
|
+
ext.config_options << "--with-xml2-include=C:/msys64/mingw64/include/libxml2"
|
26
|
+
end
|
27
|
+
else
|
28
|
+
Rake::ExtensionTask.new do |ext|
|
29
|
+
ext.gem_spec = spec
|
30
|
+
ext.name = SO_NAME
|
31
|
+
ext.ext_dir = "ext/libxml"
|
32
|
+
ext.lib_dir = "lib/#{RUBY_VERSION.sub(/\.\d$/, '')}"
|
33
|
+
ext.config_options << "--with-xml2-include=/usr/include/libxml2"
|
34
|
+
end
|
26
35
|
end
|
27
36
|
|
28
37
|
# Setup generic gem
|
@@ -32,7 +41,7 @@ Gem::PackageTask.new(spec) do |pkg|
|
|
32
41
|
end
|
33
42
|
|
34
43
|
# Setup Windows Gem
|
35
|
-
if RUBY_PLATFORM.match(/
|
44
|
+
if RUBY_PLATFORM.match(/mswin32|mswin64|mingw32/)
|
36
45
|
binaries = (FileList['lib/**/*.so',
|
37
46
|
'lib/**/*dll'])
|
38
47
|
|
@@ -77,5 +86,6 @@ end
|
|
77
86
|
# Test Task
|
78
87
|
Rake::TestTask.new do |t|
|
79
88
|
t.libs << "test"
|
89
|
+
t.test_files = FileList['test/test*.rb'] - ['test/test_suite.rb']
|
80
90
|
t.verbose = true
|
81
91
|
end
|
data/ext/libxml/ruby_xml_error.c
CHANGED
@@ -158,7 +158,7 @@ static VALUE rxml_error_reset_handler(VALUE self)
|
|
158
158
|
return self;
|
159
159
|
}
|
160
160
|
|
161
|
-
void rxml_raise(xmlErrorPtr xerror)
|
161
|
+
NORETURN(void rxml_raise(xmlErrorPtr xerror))
|
162
162
|
{
|
163
163
|
/* Wrap error up as Ruby object and send it off to ruby */
|
164
164
|
VALUE error = rxml_error_wrap(xerror);
|
data/ext/libxml/ruby_xml_error.h
CHANGED
data/ext/libxml/ruby_xml_node.c
CHANGED
@@ -57,7 +57,7 @@ static void rxml_node_free(xmlNodePtr xnode)
|
|
57
57
|
|
58
58
|
void rxml_node_manage(xmlNodePtr xnode, VALUE node)
|
59
59
|
{
|
60
|
-
RDATA(node)->dfree = rxml_node_free;
|
60
|
+
RDATA(node)->dfree = (RUBY_DATA_FUNC)rxml_node_free;
|
61
61
|
xnode->_private = (void*)node;
|
62
62
|
}
|
63
63
|
|
@@ -83,8 +83,11 @@ void rxml_node_mark(xmlNodePtr xnode)
|
|
83
83
|
{
|
84
84
|
if (xnode->doc)
|
85
85
|
{
|
86
|
-
|
87
|
-
|
86
|
+
if (xnode->doc->_private)
|
87
|
+
{
|
88
|
+
VALUE doc = (VALUE)xnode->doc->_private;
|
89
|
+
rb_gc_mark(doc);
|
90
|
+
}
|
88
91
|
}
|
89
92
|
else if (xnode->parent)
|
90
93
|
{
|
@@ -120,8 +123,7 @@ VALUE rxml_node_wrap(xmlNodePtr xnode)
|
|
120
123
|
|
121
124
|
static VALUE rxml_node_alloc(VALUE klass)
|
122
125
|
{
|
123
|
-
|
124
|
-
up mark and free yet until we assign the node. */
|
126
|
+
// This node was created from Ruby so we are responsible for freeing it not libxml
|
125
127
|
return Data_Wrap_Struct(klass, rxml_node_mark, rxml_node_free, NULL);
|
126
128
|
}
|
127
129
|
|
@@ -312,21 +314,18 @@ static VALUE rxml_node_modify_dom(VALUE self, VALUE target,
|
|
312
314
|
|
313
315
|
xmlUnlinkNode(xtarget);
|
314
316
|
|
315
|
-
|
317
|
+
// Target is about to have a parent, so stop having ruby manage it.
|
318
|
+
rxml_node_unmanage(xtarget, target);
|
319
|
+
|
320
|
+
// This target node could be freed here and be replaced by a different node
|
316
321
|
xresult = xmlFunc(xnode, xtarget);
|
317
322
|
|
318
323
|
if (!xresult)
|
319
|
-
|
320
|
-
|
321
|
-
/* Was the target freed? If yes, then wrap the new node */
|
322
|
-
if (xresult != xtarget)
|
323
|
-
{
|
324
|
-
RDATA(target)->data = xresult;
|
325
|
-
}
|
324
|
+
rxml_raise(&xmlLastError);
|
326
325
|
|
327
|
-
|
328
|
-
|
329
|
-
|
326
|
+
/* Assume the target was freed, we need to fix up the ruby object to point to the
|
327
|
+
newly returned node. */
|
328
|
+
RDATA(target)->data = xresult;
|
330
329
|
|
331
330
|
return target;
|
332
331
|
}
|
@@ -23,7 +23,7 @@
|
|
23
23
|
* reader = XML::Reader.string("<foo><bar>1</bar><bar>2</bar><bar>3</bar></foo>")
|
24
24
|
* reader.read
|
25
25
|
* assert_equal('foo', reader.name)
|
26
|
-
*
|
26
|
+
* assert_nil(reader.value)
|
27
27
|
*
|
28
28
|
* 3.times do |i|
|
29
29
|
* reader.read
|
@@ -995,7 +995,12 @@ static VALUE rxml_reader_expand(VALUE self)
|
|
995
995
|
}
|
996
996
|
else
|
997
997
|
{
|
998
|
-
|
998
|
+
/* We cannot call rxml_node_wrap here because its sets up a mark function
|
999
|
+
for the node. But according to the libxml docs (http://xmlsoft.org/html/libxml-xmlreader.html#xmlTextReaderExpand)
|
1000
|
+
this is only valid until the next xmlTextReaderRead call. At that point the node is freed (from reading
|
1001
|
+
the libxml2 source code. So don't set a mark or free function, because they will get called in the next
|
1002
|
+
garbage collection run and cause a segfault.*/
|
1003
|
+
return Data_Wrap_Struct(cXMLNode, NULL, NULL, xnode);
|
999
1004
|
}
|
1000
1005
|
}
|
1001
1006
|
|
@@ -8,7 +8,6 @@
|
|
8
8
|
#include "ruby_xml_schema_attribute.h"
|
9
9
|
#include "ruby_xml_schema_facet.h"
|
10
10
|
|
11
|
-
|
12
11
|
/*
|
13
12
|
* Document-class: LibXML::XML::Schema
|
14
13
|
*
|
@@ -152,7 +151,6 @@ static VALUE rxml_schema_id(VALUE self)
|
|
152
151
|
QNIL_OR_STRING(xschema->id)
|
153
152
|
}
|
154
153
|
|
155
|
-
|
156
154
|
static VALUE rxml_schema_document(VALUE self)
|
157
155
|
{
|
158
156
|
xmlSchemaPtr xschema;
|
@@ -162,21 +160,20 @@ static VALUE rxml_schema_document(VALUE self)
|
|
162
160
|
return rxml_node_wrap(xmlDocGetRootElement(xschema->doc));
|
163
161
|
}
|
164
162
|
|
165
|
-
static void
|
163
|
+
static void scan_namespaces(xmlSchemaImportPtr ximport, VALUE array, xmlChar *nsname)
|
166
164
|
{
|
167
|
-
VALUE schemas;
|
168
165
|
xmlNodePtr xnode;
|
169
166
|
xmlNsPtr xns;
|
170
167
|
|
171
|
-
|
172
|
-
|
173
|
-
xnode = xmlDocGetRootElement(
|
174
|
-
|
168
|
+
if (ximport->doc)
|
169
|
+
{
|
170
|
+
xnode = xmlDocGetRootElement(ximport->doc);
|
175
171
|
xns = xnode->nsDef;
|
176
172
|
|
177
|
-
while (xns)
|
178
|
-
|
179
|
-
|
173
|
+
while (xns)
|
174
|
+
{
|
175
|
+
VALUE namespace = rxml_namespace_wrap(xns);
|
176
|
+
rb_ary_push(array, namespace);
|
180
177
|
xns = xns->next;
|
181
178
|
}
|
182
179
|
}
|
@@ -184,95 +181,76 @@ static void storeNs(xmlSchemaImportPtr import, VALUE self, xmlChar *nsname)
|
|
184
181
|
|
185
182
|
static VALUE rxml_schema_namespaces(VALUE self)
|
186
183
|
{
|
187
|
-
VALUE
|
184
|
+
VALUE result;
|
188
185
|
xmlSchemaPtr xschema;
|
189
186
|
|
190
187
|
Data_Get_Struct(self, xmlSchema, xschema);
|
191
188
|
|
192
|
-
|
193
|
-
|
194
|
-
rb_iv_set(self, "@namespaces", schemas);
|
195
|
-
xmlHashScan(xschema->schemasImports, (xmlHashScanner) storeNs, (void *)self);
|
196
|
-
}
|
189
|
+
result = rb_ary_new();
|
190
|
+
xmlHashScan(xschema->schemasImports, (xmlHashScanner)scan_namespaces, (void *)result);
|
197
191
|
|
198
|
-
return
|
192
|
+
return result;
|
199
193
|
}
|
200
194
|
|
201
|
-
static void
|
195
|
+
static void scan_element(xmlSchemaElementPtr xelement, VALUE hash, xmlChar *name)
|
202
196
|
{
|
203
|
-
VALUE
|
204
|
-
|
205
|
-
|
206
|
-
types = rb_iv_get(self, "@types");
|
207
|
-
rtype = rxml_wrap_schema_type(type);
|
208
|
-
|
209
|
-
rb_hash_aset(types, rb_str_new2((const char*)name), rtype);
|
197
|
+
VALUE element = rxml_wrap_schema_element(xelement);
|
198
|
+
rb_hash_aset(hash, rb_str_new2((const char*)name), element);
|
210
199
|
}
|
211
200
|
|
212
|
-
static VALUE
|
213
|
-
|
214
|
-
static VALUE rxml_schema_types(VALUE self)
|
201
|
+
static VALUE rxml_schema_elements(VALUE self)
|
215
202
|
{
|
216
|
-
VALUE
|
203
|
+
VALUE result = rb_hash_new();
|
217
204
|
xmlSchemaPtr xschema;
|
218
205
|
|
219
206
|
Data_Get_Struct(self, xmlSchema, xschema);
|
207
|
+
xmlHashScan(xschema->elemDecl, (xmlHashScanner)scan_element, (void *)result);
|
220
208
|
|
221
|
-
|
222
|
-
types = rb_hash_new();
|
223
|
-
rb_iv_set(self, "@types", types);
|
224
|
-
rxml_schema_collect_types(self);
|
225
|
-
if(xschema != NULL && xschema->typeDecl != NULL)
|
226
|
-
xmlHashScan(xschema->typeDecl, (xmlHashScanner) storeType, (void *)self);
|
227
|
-
}
|
228
|
-
|
229
|
-
return rb_iv_get(self, "@types");
|
209
|
+
return result;
|
230
210
|
}
|
231
211
|
|
232
|
-
static void
|
212
|
+
static void scan_type(xmlSchemaTypePtr xtype, VALUE hash, xmlChar *name)
|
233
213
|
{
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
elements = rb_iv_get(self, "@elements");
|
238
|
-
relement = rxml_wrap_schema_element(element);
|
239
|
-
rb_hash_aset(elements, rb_str_new2((const char*)name), relement);
|
214
|
+
VALUE type = rxml_wrap_schema_type(xtype);
|
215
|
+
rb_hash_aset(hash, rb_str_new2((const char*)name), type);
|
240
216
|
}
|
241
217
|
|
242
|
-
static VALUE
|
218
|
+
static VALUE rxml_schema_types(VALUE self)
|
243
219
|
{
|
244
|
-
|
245
|
-
|
220
|
+
VALUE result = rb_hash_new();
|
221
|
+
xmlSchemaPtr xschema;
|
246
222
|
|
247
|
-
|
223
|
+
Data_Get_Struct(self, xmlSchema, xschema);
|
248
224
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
}
|
225
|
+
if (xschema != NULL && xschema->typeDecl != NULL)
|
226
|
+
{
|
227
|
+
xmlHashScan(xschema->typeDecl, (xmlHashScanner)scan_type, (void *)result);
|
228
|
+
}
|
254
229
|
|
255
|
-
|
230
|
+
return result;
|
256
231
|
}
|
257
232
|
|
258
|
-
static void
|
233
|
+
static void collect_imported_types(xmlSchemaImportPtr import, VALUE result)
|
259
234
|
{
|
260
|
-
if (import->imported && import->schema)
|
261
|
-
|
235
|
+
if (import->imported && import->schema)
|
236
|
+
{
|
237
|
+
xmlHashScan(import->schema->typeDecl, (xmlHashScanner)scan_type, (void *)result);
|
262
238
|
}
|
263
239
|
}
|
264
240
|
|
265
|
-
static VALUE
|
241
|
+
static VALUE rxml_schema_imported_types(VALUE self)
|
266
242
|
{
|
267
243
|
xmlSchemaPtr xschema;
|
244
|
+
VALUE result = rb_hash_new();
|
268
245
|
|
269
246
|
Data_Get_Struct(self, xmlSchema, xschema);
|
270
247
|
|
271
|
-
if(xschema)
|
272
|
-
|
248
|
+
if (xschema)
|
249
|
+
{
|
250
|
+
xmlHashScan(xschema->schemasImports, (xmlHashScanner)collect_imported_types, (void *)result);
|
273
251
|
}
|
274
252
|
|
275
|
-
return
|
253
|
+
return result;
|
276
254
|
}
|
277
255
|
|
278
256
|
void rxml_init_schema(void)
|
@@ -288,10 +266,10 @@ void rxml_init_schema(void)
|
|
288
266
|
rb_define_method(cXMLSchema, "version", rxml_schema_version, 0);
|
289
267
|
rb_define_method(cXMLSchema, "document", rxml_schema_document, 0);
|
290
268
|
|
291
|
-
rb_define_method(cXMLSchema, "_namespaces", rxml_schema_namespaces, 0);
|
292
|
-
rb_define_method(cXMLSchema, "_collect_types", rxml_schema_collect_types, 0);
|
293
|
-
rb_define_method(cXMLSchema, "types", rxml_schema_types, 0);
|
294
269
|
rb_define_method(cXMLSchema, "elements", rxml_schema_elements, 0);
|
270
|
+
rb_define_method(cXMLSchema, "imported_types", rxml_schema_imported_types, 0);
|
271
|
+
rb_define_method(cXMLSchema, "namespaces", rxml_schema_namespaces, 0);
|
272
|
+
rb_define_method(cXMLSchema, "types", rxml_schema_types, 0);
|
295
273
|
|
296
274
|
rxml_init_schema_facet();
|
297
275
|
rxml_init_schema_element();
|