libxml-ruby 0.6.0-x86-mswin32-60 → 0.7.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (171) hide show
  1. data/CHANGES +42 -0
  2. data/README +123 -117
  3. data/doc/classes/XML.html +226 -0
  4. data/doc/classes/XML/Attr.html +969 -0
  5. data/doc/classes/XML/Attributes.html +487 -0
  6. data/doc/classes/XML/Document.html +1423 -0
  7. data/doc/classes/XML/Dtd.html +159 -0
  8. data/doc/classes/XML/Error.html +111 -0
  9. data/doc/classes/XML/HTMLParser.html +330 -0
  10. data/doc/classes/XML/InputCallbacks.html +154 -0
  11. data/doc/classes/XML/NS.html +366 -0
  12. data/doc/classes/XML/Node.html +3292 -0
  13. data/doc/classes/XML/Node/FailedModify.html +111 -0
  14. data/doc/classes/XML/Node/Set.html +435 -0
  15. data/doc/classes/XML/Node/SetNamespace.html +111 -0
  16. data/doc/classes/XML/Node/UnknownType.html +111 -0
  17. data/doc/classes/XML/Parser.html +2178 -0
  18. data/doc/classes/XML/Parser/Context.html +1233 -0
  19. data/doc/classes/XML/Parser/ParseError.html +111 -0
  20. data/doc/classes/XML/Reader.html +2173 -0
  21. data/doc/classes/XML/SaxParser.html +396 -0
  22. data/doc/classes/XML/SiblingEnum.html +142 -0
  23. data/doc/classes/XML/State.html +118 -0
  24. data/doc/classes/XML/Tree.html +224 -0
  25. data/doc/classes/XML/XInclude.html +117 -0
  26. data/doc/classes/XML/XInclude/Error.html +111 -0
  27. data/doc/classes/XML/XMLParserOptions.html +198 -0
  28. data/doc/classes/XML/XPath.html +269 -0
  29. data/doc/classes/XML/XPath/Context.html +193 -0
  30. data/doc/classes/XML/XPath/InvalidPath.html +111 -0
  31. data/doc/classes/XML/XPath/Object.html +439 -0
  32. data/doc/classes/XML/XPointer.html +164 -0
  33. data/doc/classes/XML/XPointer/Context.html +117 -0
  34. data/doc/classes/XML/XPointer/Context/InvalidPath.html +111 -0
  35. data/doc/classes/XML/XPointer/InvalidExpression.html +111 -0
  36. data/doc/classes/singleton.html +114 -0
  37. data/doc/created.rid +1 -0
  38. data/doc/files/CHANGES.html +375 -0
  39. data/doc/files/LICENSE.html +133 -0
  40. data/doc/files/README.html +279 -0
  41. data/doc/files/VERSION.html +107 -0
  42. data/doc/files/ext/libxml/cbg_c.html +101 -0
  43. data/doc/files/ext/libxml/libxml_c.html +101 -0
  44. data/doc/files/ext/libxml/ruby_xml_attr_c.html +101 -0
  45. data/doc/files/ext/libxml/ruby_xml_attributes_c.html +101 -0
  46. data/doc/files/ext/libxml/ruby_xml_document_c.html +101 -0
  47. data/doc/files/ext/libxml/ruby_xml_dtd_c.html +101 -0
  48. data/doc/files/ext/libxml/ruby_xml_html_parser_c.html +101 -0
  49. data/doc/files/ext/libxml/ruby_xml_input_cbg_c.html +101 -0
  50. data/doc/files/ext/libxml/ruby_xml_node_c.html +101 -0
  51. data/doc/files/ext/libxml/ruby_xml_node_set_c.html +101 -0
  52. data/doc/files/ext/libxml/ruby_xml_ns_c.html +101 -0
  53. data/doc/files/ext/libxml/ruby_xml_parser_c.html +101 -0
  54. data/doc/files/ext/libxml/ruby_xml_parser_context_c.html +101 -0
  55. data/doc/files/ext/libxml/ruby_xml_reader_c.html +101 -0
  56. data/doc/files/ext/libxml/ruby_xml_sax_parser_c.html +101 -0
  57. data/doc/files/ext/libxml/ruby_xml_schema_c.html +101 -0
  58. data/doc/files/ext/libxml/ruby_xml_state_c.html +101 -0
  59. data/doc/files/ext/libxml/ruby_xml_tree_c.html +101 -0
  60. data/doc/files/ext/libxml/ruby_xml_xinclude_c.html +101 -0
  61. data/doc/files/ext/libxml/ruby_xml_xpath_c.html +101 -0
  62. data/doc/files/ext/libxml/ruby_xml_xpath_context_c.html +101 -0
  63. data/doc/files/ext/libxml/ruby_xml_xpath_object_c.html +101 -0
  64. data/doc/files/ext/libxml/ruby_xml_xpointer_c.html +101 -0
  65. data/doc/files/ext/libxml/ruby_xml_xpointer_context_c.html +101 -0
  66. data/doc/files/lib/libxml_rb.html +115 -0
  67. data/doc/files/lib/xml/libxml_rb.html +114 -0
  68. data/doc/fr_class_index.html +60 -0
  69. data/doc/fr_file_index.html +56 -0
  70. data/doc/fr_method_index.html +373 -0
  71. data/doc/index.html +24 -0
  72. data/doc/rdoc-style.css +208 -0
  73. data/ext/libxml/cbg.c +76 -76
  74. data/ext/libxml/extconf.rb +308 -308
  75. data/ext/libxml/libxml.c +58 -62
  76. data/ext/libxml/ruby_libxml.h +1 -0
  77. data/ext/libxml/ruby_xml_attr.c +201 -113
  78. data/ext/libxml/ruby_xml_attr.h +6 -9
  79. data/ext/libxml/ruby_xml_attributes.c +268 -0
  80. data/ext/libxml/ruby_xml_attributes.h +17 -0
  81. data/ext/libxml/ruby_xml_document.c +80 -66
  82. data/ext/libxml/ruby_xml_dtd.c +2 -2
  83. data/ext/libxml/ruby_xml_dtd.h +17 -17
  84. data/ext/libxml/ruby_xml_html_parser.c +18 -19
  85. data/ext/libxml/ruby_xml_html_parser.h +29 -29
  86. data/ext/libxml/ruby_xml_input_cbg.c +6 -0
  87. data/ext/libxml/ruby_xml_input_cbg.h +20 -20
  88. data/ext/libxml/ruby_xml_node.c +438 -536
  89. data/ext/libxml/ruby_xml_node.h +17 -27
  90. data/ext/libxml/ruby_xml_node_set.c +10 -9
  91. data/ext/libxml/ruby_xml_node_set.h +20 -20
  92. data/ext/libxml/ruby_xml_ns.c +60 -69
  93. data/ext/libxml/ruby_xml_ns.h +12 -21
  94. data/ext/libxml/ruby_xml_parser.c +54 -53
  95. data/ext/libxml/ruby_xml_parser.h +31 -31
  96. data/ext/libxml/ruby_xml_parser_context.c +37 -91
  97. data/ext/libxml/ruby_xml_parser_context.h +20 -22
  98. data/ext/libxml/ruby_xml_reader.h +14 -14
  99. data/ext/libxml/ruby_xml_sax_parser.c +55 -55
  100. data/ext/libxml/ruby_xml_sax_parser.h +56 -56
  101. data/ext/libxml/ruby_xml_schema.c +44 -51
  102. data/ext/libxml/ruby_xml_schema.h +16 -16
  103. data/ext/libxml/ruby_xml_state.c +35 -96
  104. data/ext/libxml/ruby_xml_state.h +2 -3
  105. data/ext/libxml/ruby_xml_tree.h +12 -12
  106. data/ext/libxml/ruby_xml_xinclude.h +13 -13
  107. data/ext/libxml/ruby_xml_xpath.c +57 -18
  108. data/ext/libxml/ruby_xml_xpath.h +23 -23
  109. data/ext/libxml/ruby_xml_xpath_context.c +11 -7
  110. data/ext/libxml/ruby_xml_xpath_context.h +20 -20
  111. data/ext/libxml/ruby_xml_xpath_object.c +9 -16
  112. data/ext/libxml/ruby_xml_xpath_object.h +4 -10
  113. data/ext/libxml/ruby_xml_xpointer.c +11 -11
  114. data/ext/libxml/ruby_xml_xpointer.h +27 -27
  115. data/ext/libxml/ruby_xml_xpointer_context.h +18 -18
  116. data/ext/libxml/version.h +2 -2
  117. data/lib/libxml.rb +134 -125
  118. data/lib/libxml_ruby.so +0 -0
  119. data/mingw/libiconv-2.dll +0 -0
  120. data/mingw/libxml2-2.dll +0 -0
  121. data/mingw/libxml_ruby.so +0 -0
  122. data/test/ets_copy_bug.rb +1 -1
  123. data/test/ets_copy_bug2.rb +16 -27
  124. data/test/ets_doc_to_s.rb +1 -1
  125. data/test/ets_gpx.rb +1 -1
  126. data/test/ets_node_gc.rb +1 -1
  127. data/test/ets_tsr.rb +1 -1
  128. data/test/tc_well_formed.rb +1 -1
  129. data/test/tc_xml_attributes.rb +106 -0
  130. data/test/tc_xml_document.rb +10 -10
  131. data/test/tc_xml_document_write3.rb +1 -1
  132. data/test/tc_xml_dtd.rb +49 -0
  133. data/test/tc_xml_html_parser.rb +3 -3
  134. data/test/tc_xml_node.rb +69 -33
  135. data/test/tc_xml_node_attr.rb +170 -0
  136. data/test/{tc_xml_node8.rb → tc_xml_node_cdata.rb} +2 -2
  137. data/test/{tc_xml_node9.rb → tc_xml_node_comment.rb} +3 -3
  138. data/test/tc_xml_node_edit.rb +91 -0
  139. data/test/tc_xml_parser.rb +97 -50
  140. data/test/tc_xml_parser_context.rb +61 -23
  141. data/test/tc_xml_schema.rb +39 -0
  142. data/test/tc_xml_xinclude.rb +5 -6
  143. data/test/tc_xml_xpath.rb +51 -27
  144. data/test/test_suite.rb +27 -0
  145. data/vc/{libxml.sln → libxml_ruby.sln} +5 -5
  146. data/vc/{libxml.vcproj → libxml_ruby.vcproj} +9 -1
  147. metadata +106 -54
  148. data/mingw/mingw.rake +0 -36
  149. data/test/dtd-test.rb +0 -24
  150. data/test/merge_bug.rb +0 -55
  151. data/test/schema-test.rb +0 -74
  152. data/test/tc_xml_node2.rb +0 -25
  153. data/test/tc_xml_node3.rb +0 -27
  154. data/test/tc_xml_node4.rb +0 -86
  155. data/test/tc_xml_node5.rb +0 -52
  156. data/test/tc_xml_node6.rb +0 -27
  157. data/test/tc_xml_node7.rb +0 -35
  158. data/test/tc_xml_parser2.rb +0 -16
  159. data/test/tc_xml_parser3.rb +0 -23
  160. data/test/tc_xml_parser4.rb +0 -33
  161. data/test/tc_xml_parser5.rb +0 -27
  162. data/test/tc_xml_parser6.rb +0 -23
  163. data/test/tc_xml_parser7.rb +0 -28
  164. data/test/tc_xml_parser8.rb +0 -32
  165. data/test/tc_xml_parser9.rb +0 -11
  166. data/test/tc_xml_xpath2.rb +0 -14
  167. data/work/vc/debug/libxml.exp +0 -0
  168. data/work/vc/debug/libxml.ilk +0 -0
  169. data/work/vc/debug/libxml.lib +0 -0
  170. data/work/vc/debug/libxml.pdb +0 -0
  171. data/work/vc/debug/libxml.so +0 -0
@@ -1,14 +1,14 @@
1
- /* Copyright (c) 2006 Apple Computer Inc.
2
- * Please see the LICENSE file for copyright and distribution information. */
3
-
4
- #ifndef __RUBY_XML_READER__
5
- #define __RUBY_XML_READER__
6
-
7
- extern VALUE cXMLReader;
8
-
9
- void ruby_init_xml_reader(void);
10
-
11
- /* Exported to be used by XML::Document#reader */
12
- VALUE ruby_xml_reader_new_walker(VALUE self, VALUE doc);
13
-
14
- #endif /* __RUBY_XML_READER__ */
1
+ /* Copyright (c) 2006 Apple Computer Inc.
2
+ * Please see the LICENSE file for copyright and distribution information. */
3
+
4
+ #ifndef __RUBY_XML_READER__
5
+ #define __RUBY_XML_READER__
6
+
7
+ extern VALUE cXMLReader;
8
+
9
+ void ruby_init_xml_reader(void);
10
+
11
+ /* Exported to be used by XML::Document#reader */
12
+ VALUE ruby_xml_reader_new_walker(VALUE self, VALUE doc);
13
+
14
+ #endif /* __RUBY_XML_READER__ */
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_sax_parser.c 300 2008-07-01 19:14:15Z cfis $ */
1
+ /* $Id: ruby_xml_sax_parser.c 339 2008-07-09 08:36:26Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -29,61 +29,61 @@ VALUE cbidOnExternalSubset;
29
29
  #include "sax_parser_callbacks.inc"
30
30
 
31
31
  void
32
- ruby_xml_sax_parser_free(ruby_xml_sax_parser *rxsp) {
32
+ ruby_xml_sax_parser_free(ruby_xml_sax_parser *nodesp) {
33
33
  /* Apparently this isn't needed: time will tell */
34
- /* if (rxsp->xsh != NULL) */
35
- /* xmlFreeSax_Parser(rxsp->sax_parser); */
34
+ /* if (nodesp->xsh != NULL) */
35
+ /* xmlFreeSax_Parser(nodesp->sax_parser); */
36
36
  }
37
37
 
38
38
  void
39
- ruby_xml_sax_parser_mark(ruby_xml_sax_parser *rxsp) {
40
- if (rxsp->callbackHandler && (rxsp->callbackHandler != Qnil)) {
41
- rb_gc_mark(rxsp->callbackHandler);
39
+ ruby_xml_sax_parser_mark(ruby_xml_sax_parser *nodesp) {
40
+ if (nodesp->callbackHandler && (nodesp->callbackHandler != Qnil)) {
41
+ rb_gc_mark(nodesp->callbackHandler);
42
42
  }
43
43
 
44
- if (rxsp->filename && (rxsp->filename != Qnil)) {
45
- rb_gc_mark(rxsp->filename);
44
+ if (nodesp->filename && (nodesp->filename != Qnil)) {
45
+ rb_gc_mark(nodesp->filename);
46
46
  }
47
47
 
48
- if (rxsp->str && (rxsp->str != Qnil)) {
49
- rb_gc_mark(rxsp->str);
48
+ if (nodesp->str && (nodesp->str != Qnil)) {
49
+ rb_gc_mark(nodesp->str);
50
50
  }
51
51
  }
52
52
 
53
53
  /*
54
54
  * call-seq:
55
- * XML::SaxParser.new => sax_parser
55
+ * XML::SaxParser.new -> sax_parser
56
56
  *
57
57
  * Create a new XML::SaxParser instance.
58
58
  */
59
59
  VALUE
60
60
  ruby_xml_sax_parser_new(VALUE class) {
61
- ruby_xml_sax_parser *rxsp;
61
+ ruby_xml_sax_parser *nodesp;
62
62
 
63
- rxsp = ALLOC(ruby_xml_sax_parser);
64
- rxsp->xsh = &rubySAXHandlerStruct;
63
+ nodesp = ALLOC(ruby_xml_sax_parser);
64
+ nodesp->xsh = &rubySAXHandlerStruct;
65
65
 
66
- rxsp->callbackHandler = Qnil;
67
- rxsp->xpc = NULL;
68
- rxsp->filename = Qnil;
69
- rxsp->str = Qnil;
66
+ nodesp->callbackHandler = Qnil;
67
+ nodesp->xpc = NULL;
68
+ nodesp->filename = Qnil;
69
+ nodesp->str = Qnil;
70
70
 
71
71
  return(Data_Wrap_Struct(class, ruby_xml_sax_parser_mark,
72
- ruby_xml_sax_parser_free, rxsp));
72
+ ruby_xml_sax_parser_free, nodesp));
73
73
  }
74
74
 
75
75
 
76
76
  /*
77
77
  * call-seq:
78
- * sax_parser.callbacks => #<XML::SaxParser::Callbacks subclass>
78
+ * sax_parser.callbacks -> #<XML::SaxParser::Callbacks subclass>
79
79
  *
80
80
  * Obtain the callbacks used by this parser.
81
81
  */
82
82
  VALUE
83
83
  ruby_xml_sax_parser_callbacks_get(VALUE self) {
84
- ruby_xml_sax_parser *rxsp;
85
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
86
- return(rxsp->callbackHandler);
84
+ ruby_xml_sax_parser *nodesp;
85
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
86
+ return(nodesp->callbackHandler);
87
87
  }
88
88
 
89
89
 
@@ -92,30 +92,30 @@ ruby_xml_sax_parser_callbacks_get(VALUE self) {
92
92
  * sax_parser.callbacks = #<XML::SaxParser::Callbacks subclass>
93
93
  *
94
94
  * Set the callbacks used by this parser. The value assigned to
95
- * this attribute will usually be an object that extends the the
95
+ * this attributesibute will usually be an object that extends the the
96
96
  * XML::SaxParser::Callbacks module, overriding the callbacks it
97
97
  * wishes to process.
98
98
  */
99
99
  VALUE
100
100
  ruby_xml_sax_parser_callbacks_set(VALUE self, VALUE callbacks) {
101
- ruby_xml_sax_parser *rxsp;
102
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
103
- rxsp->callbackHandler = callbacks;
104
- return(rxsp->callbackHandler);
101
+ ruby_xml_sax_parser *nodesp;
102
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
103
+ nodesp->callbackHandler = callbacks;
104
+ return(nodesp->callbackHandler);
105
105
  }
106
106
 
107
107
 
108
108
  /*
109
109
  * call-seq:
110
- * sax_parser.filename => "filename"
110
+ * sax_parser.filename -> "filename"
111
111
  *
112
112
  * Obtain the filename this parser reads from.
113
113
  */
114
114
  VALUE
115
115
  ruby_xml_sax_parser_filename_get(VALUE self) {
116
- ruby_xml_sax_parser *rxsp;
117
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
118
- return(rxsp->filename);
116
+ ruby_xml_sax_parser *nodesp;
117
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
118
+ return(nodesp->filename);
119
119
  }
120
120
 
121
121
 
@@ -127,35 +127,35 @@ ruby_xml_sax_parser_filename_get(VALUE self) {
127
127
  */
128
128
  VALUE
129
129
  ruby_xml_sax_parser_filename_set(VALUE self, VALUE filename) {
130
- ruby_xml_sax_parser *rxsp;
130
+ ruby_xml_sax_parser *nodesp;
131
131
  Check_Type(filename, T_STRING);
132
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
133
- rxsp->filename = filename;
134
- return(rxsp->filename);
132
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
133
+ nodesp->filename = filename;
134
+ return(nodesp->filename);
135
135
  }
136
136
 
137
137
 
138
138
  /*
139
139
  * call-seq:
140
- * parser.parse => (true|false)
140
+ * parser.parse -> (true|false)
141
141
  *
142
142
  * Parse the input XML, generating callbacks to the object
143
- * registered via the +callbacks+ attribute.
143
+ * registered via the +callbacks+ attributesibute.
144
144
  */
145
145
  VALUE
146
146
  ruby_xml_sax_parser_parse(VALUE self) {
147
147
  char *str;
148
148
  int status = 1;
149
- ruby_xml_sax_parser *rxsp;
149
+ ruby_xml_sax_parser *nodesp;
150
150
 
151
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
151
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
152
152
 
153
- if (rxsp->filename != Qnil) {
154
- status = xmlSAXUserParseFile(rxsp->xsh, rxsp, StringValuePtr(rxsp->filename));
155
- } else if (rxsp->str != Qnil) {
156
- str = StringValuePtr(rxsp->str);
153
+ if (nodesp->filename != Qnil) {
154
+ status = xmlSAXUserParseFile(nodesp->xsh, nodesp, StringValuePtr(nodesp->filename));
155
+ } else if (nodesp->str != Qnil) {
156
+ str = StringValuePtr(nodesp->str);
157
157
  status = //ruby_xml_document_new(cXMLDocument,
158
- xmlSAXUserParseMemory(rxsp->xsh, rxsp,
158
+ xmlSAXUserParseMemory(nodesp->xsh, nodesp,
159
159
  str, strlen(str)); //);
160
160
  }
161
161
 
@@ -171,15 +171,15 @@ ruby_xml_sax_parser_parse(VALUE self) {
171
171
 
172
172
  /*
173
173
  * call-seq:
174
- * parser.string => "xml"
174
+ * parser.string -> "xml"
175
175
  *
176
176
  * Obtain the parser's input string.
177
177
  */
178
178
  VALUE
179
179
  ruby_xml_sax_parser_str_get(VALUE self) {
180
- ruby_xml_sax_parser *rxsp;
181
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
182
- return(rxsp->str);
180
+ ruby_xml_sax_parser *nodesp;
181
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
182
+ return(nodesp->str);
183
183
  }
184
184
 
185
185
 
@@ -191,11 +191,11 @@ ruby_xml_sax_parser_str_get(VALUE self) {
191
191
  */
192
192
  VALUE
193
193
  ruby_xml_sax_parser_str_set(VALUE self, VALUE str) {
194
- ruby_xml_sax_parser *rxsp;
194
+ ruby_xml_sax_parser *nodesp;
195
195
  Check_Type(str, T_STRING);
196
- Data_Get_Struct(self, ruby_xml_sax_parser, rxsp);
197
- rxsp->str = str;
198
- return(rxsp->str);
196
+ Data_Get_Struct(self, ruby_xml_sax_parser, nodesp);
197
+ nodesp->str = str;
198
+ return(nodesp->str);
199
199
  }
200
200
 
201
201
 
@@ -276,7 +276,7 @@ ruby_xml_sax_callbacks_on_end_document(int argc, VALUE *argv, VALUE self) {
276
276
 
277
277
  /*
278
278
  * call-seq:
279
- * callbacks.on_start_element(name, attr_hash)
279
+ * callbacks.on_start_element(name, attributes_hash)
280
280
  *
281
281
  * Called for an element start event.
282
282
  */
@@ -1,56 +1,56 @@
1
- /* $Id: ruby_xml_sax_parser.h 111 2006-11-20 01:39:14Z roscopeco $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #ifndef __RUBY_XML_SAX_PARSER__
6
- #define __RUBY_XML_SAX_PARSER__
7
-
8
- extern VALUE cXMLSaxParser;
9
- extern VALUE mXMLSaxParserCallbacks;
10
-
11
- /*
12
- typedef struct ruby_xml_sax_parser_callbacks {
13
- VALUE internalSubset;
14
- VALUE isStandalone;
15
- VALUE hasInternalSubset;
16
- VALUE hasExternalSubset;
17
- VALUE resolveEntity;
18
- VALUE getEntity;
19
- VALUE entityDecl;
20
- VALUE notationDecl;
21
- VALUE attributeDecl;
22
- VALUE elementDecl;
23
- VALUE unparsedEntityDecl;
24
- VALUE setDocumentLocator;
25
- VALUE startDocument;
26
- VALUE endDocument;
27
- VALUE startElement;
28
- VALUE endElement;
29
- VALUE reference;
30
- VALUE characters;
31
- VALUE ignorableWhitespace;
32
- VALUE processingInstruction;
33
- VALUE comment;
34
- VALUE xmlParserWarning;
35
- VALUE xmlParserError;
36
- VALUE xmlParserFatalError;
37
- VALUE getParameterEntity;
38
- VALUE cdataBlock;
39
- VALUE externalSubset;
40
- } ruby_xml_sax_parser_callbacks;
41
- */
42
-
43
- typedef struct ruby_xml_sax_parser {
44
- xmlParserCtxtPtr xpc;
45
- xmlSAXHandlerPtr xsh;
46
- //ruby_xml_sax_parser_callbacks *cbp;
47
- VALUE callbackHandler;
48
- VALUE filename;
49
- VALUE str;
50
- } ruby_xml_sax_parser;
51
-
52
- void ruby_xml_sax_parser_free(ruby_xml_sax_parser *rxsp);
53
- void ruby_init_xml_sax_parser(void);
54
- VALUE ruby_xml_sax_parser_new(VALUE class);
55
-
56
- #endif
1
+ /* $Id: ruby_xml_sax_parser.h 111 2006-11-20 01:39:14Z roscopeco $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #ifndef __RUBY_XML_SAX_PARSER__
6
+ #define __RUBY_XML_SAX_PARSER__
7
+
8
+ extern VALUE cXMLSaxParser;
9
+ extern VALUE mXMLSaxParserCallbacks;
10
+
11
+ /*
12
+ typedef struct ruby_xml_sax_parser_callbacks {
13
+ VALUE internalSubset;
14
+ VALUE isStandalone;
15
+ VALUE hasInternalSubset;
16
+ VALUE hasExternalSubset;
17
+ VALUE resolveEntity;
18
+ VALUE getEntity;
19
+ VALUE entityDecl;
20
+ VALUE notationDecl;
21
+ VALUE attributeDecl;
22
+ VALUE elementDecl;
23
+ VALUE unparsedEntityDecl;
24
+ VALUE setDocumentLocator;
25
+ VALUE startDocument;
26
+ VALUE endDocument;
27
+ VALUE startElement;
28
+ VALUE endElement;
29
+ VALUE reference;
30
+ VALUE characters;
31
+ VALUE ignorableWhitespace;
32
+ VALUE processingInstruction;
33
+ VALUE comment;
34
+ VALUE xmlParserWarning;
35
+ VALUE xmlParserError;
36
+ VALUE xmlParserFatalError;
37
+ VALUE getParameterEntity;
38
+ VALUE cdataBlock;
39
+ VALUE externalSubset;
40
+ } ruby_xml_sax_parser_callbacks;
41
+ */
42
+
43
+ typedef struct ruby_xml_sax_parser {
44
+ xmlParserCtxtPtr xpc;
45
+ xmlSAXHandlerPtr xsh;
46
+ //ruby_xml_sax_parser_callbacks *cbp;
47
+ VALUE callbackHandler;
48
+ VALUE filename;
49
+ VALUE str;
50
+ } ruby_xml_sax_parser;
51
+
52
+ void ruby_xml_sax_parser_free(ruby_xml_sax_parser *rxsp);
53
+ void ruby_init_xml_sax_parser(void);
54
+ VALUE ruby_xml_sax_parser_new(VALUE class);
55
+
56
+ #endif
@@ -20,66 +20,66 @@ ruby_xml_schema_free(ruby_xml_schema *rxschema) {
20
20
 
21
21
  /*
22
22
  * call-seq:
23
- * XML::Schema.new(schema_uri) => schema
23
+ * XML::Schema.new(schema_uri) -> schema
24
24
  *
25
25
  * Create a new schema from the specified URI.
26
26
  */
27
27
  VALUE
28
- ruby_xml_schema_init_from_uri(int argc, VALUE *argv, VALUE class) {
28
+ ruby_xml_schema_init_from_uri(VALUE class, VALUE uri) {
29
29
  xmlSchemaParserCtxtPtr parser;
30
30
  ruby_xml_schema *schema;
31
-
32
- VALUE uri;
33
- VALUE result = Qnil;
34
-
35
- switch (argc) {
36
- case 1:
37
- rb_scan_args(argc, argv, "10", &uri);
38
- Check_Type(uri, T_STRING);
39
-
40
- parser = xmlSchemaNewParserCtxt(StringValuePtr(uri));
41
- schema = ALLOC(ruby_xml_schema);
42
- schema->schema = xmlSchemaParse(parser);
43
- xmlSchemaFreeParserCtxt(parser);
44
-
45
- result = Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, schema);
46
- break;
47
- default:
48
- rb_raise(rb_eArgError, "wrong number of arguments (need 1)");
49
- }
50
- return(result);
31
+
32
+ Check_Type(uri, T_STRING);
33
+
34
+ parser = xmlSchemaNewParserCtxt(StringValuePtr(uri));
35
+ schema = ALLOC(ruby_xml_schema);
36
+ schema->schema = xmlSchemaParse(parser);
37
+ xmlSchemaFreeParserCtxt(parser);
38
+
39
+ return Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, schema);
51
40
  }
52
41
 
53
42
  /*
54
43
  * call-seq:
55
- * XML::Schema.from_string("schema_data") => "value"
44
+ * XML::Schema.document(document) -> schema
56
45
  *
57
- * Create a new schema using the specified string.
46
+ * Create a new schema from the specified URI.
58
47
  */
59
48
  VALUE
60
- ruby_xml_schema_init_from_str(int argc, VALUE *argv, VALUE class) {
61
- VALUE schema_str;
49
+ ruby_xml_schema_init_from_document(VALUE class, VALUE document) {
50
+ ruby_xml_document_t *rdoc;
51
+ ruby_xml_schema *schema;
52
+ xmlSchemaParserCtxtPtr parser;
53
+
54
+ Data_Get_Struct(document, ruby_xml_document_t, rdoc);
55
+
56
+ parser = xmlSchemaNewDocParserCtxt(rdoc->doc);
57
+ schema = ALLOC(ruby_xml_schema);
58
+ schema->schema = xmlSchemaParse(parser);
59
+ xmlSchemaFreeParserCtxt(parser);
60
+
61
+ return Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, schema);
62
+ }
62
63
 
64
+ /*
65
+ * call-seq:
66
+ * XML::Schema.string("schema_data") -> "value"
67
+ *
68
+ * Create a new schema using the specified string.
69
+ */
70
+ VALUE
71
+ ruby_xml_schema_init_from_string(VALUE self, VALUE schema_str) {
63
72
  xmlSchemaParserCtxtPtr parser;
64
- //xmlSchemaPtr sptr;
65
73
  ruby_xml_schema *rxschema;
66
74
 
67
- switch (argc) {
68
- case 1:
69
- rb_scan_args(argc, argv, "10", &schema_str);
75
+ Check_Type(schema_str, T_STRING);
70
76
 
71
- Check_Type(schema_str, T_STRING);
77
+ parser = xmlSchemaNewMemParserCtxt(StringValuePtr(schema_str), strlen(StringValuePtr(schema_str)));
78
+ rxschema = ALLOC(ruby_xml_schema);
79
+ rxschema->schema = xmlSchemaParse(parser);
80
+ xmlSchemaFreeParserCtxt(parser);
72
81
 
73
- parser = xmlSchemaNewMemParserCtxt(StringValuePtr(schema_str), strlen(StringValuePtr(schema_str)));
74
- rxschema = ALLOC(ruby_xml_schema);
75
- rxschema->schema = xmlSchemaParse(parser);
76
- xmlSchemaFreeParserCtxt(parser);
77
-
78
- return( Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, rxschema) );
79
- default:
80
- rb_raise(rb_eArgError, "wrong number of arguments (need 1)");
81
- }
82
- return Qnil;
82
+ return Data_Wrap_Struct(cXMLSchema, ruby_xml_schema_mark, ruby_xml_schema_free, rxschema);
83
83
  }
84
84
 
85
85
  /* TODO what is this patch doing here?
@@ -130,17 +130,10 @@ ruby_xml_schema_init_from_str(int argc, VALUE *argv, VALUE class) {
130
130
  } else if (!strcmp(method, "validate_schema_buffer")) {
131
131
  */
132
132
 
133
- void ruby_schema_free(ruby_xml_schema *rxs) {
134
- }
135
-
136
- // Rdoc needs to know
137
- #ifdef RDOC_NEVER_DEFINED
138
- mXML = rb_define_module("XML");
139
- #endif
140
-
141
133
  void ruby_init_xml_schema(void) {
142
134
  cXMLSchema = rb_define_class_under(mXML, "Schema", rb_cObject);
143
- rb_define_singleton_method(cXMLSchema, "new", ruby_xml_schema_init_from_uri, -1);
144
- rb_define_singleton_method(cXMLSchema, "from_string", ruby_xml_schema_init_from_str, -1);
135
+ rb_define_singleton_method(cXMLSchema, "new", ruby_xml_schema_init_from_uri, 1);
136
+ rb_define_singleton_method(cXMLSchema, "from_string", ruby_xml_schema_init_from_string, 1);
137
+ rb_define_singleton_method(cXMLSchema, "document", ruby_xml_schema_init_from_document, 1);
145
138
  }
146
139