libxml-ruby 0.9.3-x86-mswin32-60 → 0.9.4-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,174 +1,174 @@
1
- /* $Id: ruby_xml_sax_parser.c 616 2008-11-22 09:25:12Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #include "ruby_libxml.h"
6
- #include "ruby_xml_sax_parser.h"
7
-
8
- /*
9
- * Document-class: LibXML::XML::SaxParser
10
- *
11
- * XML::SaxParser provides a callback based API for parsing documents,
12
- * in contrast to XML::Parser's tree based API and XML::Reader's stream
13
- * based API.
14
- *
15
- * Note that the XML::SaxParser API is fairly complex, not well standardized,
16
- * and does not directly support validation making entity, namespace and
17
- * base processing relatively hard.
18
- *
19
- * To use the XML::SaxParser, register a callback class via the
20
- * XML::SaxParser#callbacks=. It is easiest to include the
21
- * XML::SaxParser::Callbacks module in your class and override
22
- * the methods as needed.
23
- *
24
- * Basic example:
25
- *
26
- * class MyCallbacks
27
- * include XML::SaxParser::Callbacks
28
- * def on_start_element(element, attributes)
29
- * puts #Element started: #{element}"
30
- * end
31
- * end
32
- *
33
- * parser = XML::SaxParser.new
34
- * parser.callbacks = MyCallbacks.new
35
- * parser.parse
36
- */
37
-
38
- VALUE cXMLSaxParser;
39
- VALUE mXMLSaxParserCallbacks;
40
-
41
- static ID INPUT_ATTR;
42
- static ID CALLBACKS_ATTR;
43
-
44
- VALUE cbidOnInternalSubset;
45
- VALUE cbidOnIsStandalone;
46
- VALUE cbidOnHasInternalSubset;
47
- VALUE cbidOnHasExternalSubset;
48
- VALUE cbidOnStartDocument;
49
- VALUE cbidOnEndDocument;
50
- VALUE cbidOnStartElement;
51
- VALUE cbidOnEndElement;
52
- VALUE cbidOnReference;
53
- VALUE cbidOnCharacters;
54
- VALUE cbidOnProcessingInstruction;
55
- VALUE cbidOnComment;
56
- VALUE cbidOnXmlParserWarning;
57
- VALUE cbidOnXmlParserError;
58
- VALUE cbidOnXmlParserFatalError;
59
- VALUE cbidOnCdataBlock;
60
- VALUE cbidOnExternalSubset;
61
-
62
- #include "sax_parser_callbacks.inc"
63
-
64
- /*
65
- * call-seq:
66
- * sax_parser.initialize -> sax_parser
67
- *
68
- * Initiliazes instance of parser.
69
- */
70
- static VALUE
71
- rxml_sax_parser_initialize(VALUE self) {
72
- VALUE input = rb_class_new_instance(0, NULL, cXMLInput);
73
- rb_iv_set(self, "@input", input);
74
- return self;
75
- }
76
-
77
-
78
- /* Parsing data sources */
79
- static int
80
- rxml_sax_parser_parse_file(VALUE self, VALUE input) {
81
- VALUE file = rb_ivar_get(input, FILE_ATTR);
82
- return xmlSAXUserParseFile(&rxml_sax_hander_struct, self, StringValuePtr(file));
83
- }
84
-
85
- static int
86
- rxml_sax_parser_parse_string(VALUE self, VALUE input) {
87
- VALUE str = rb_ivar_get(input, STRING_ATTR);
88
- return xmlSAXUserParseMemory(&rxml_sax_hander_struct, self, StringValuePtr(str), RSTRING_LEN(str));
89
- }
90
-
91
- static int
92
- rxml_sax_parser_parse_io(VALUE self, VALUE input) {
93
- VALUE io = rb_ivar_get(input, IO_ATTR);
94
- VALUE encoding = rb_ivar_get(input, ENCODING_ATTR);
95
- xmlCharEncoding xmlEncoding = NUM2INT(encoding);
96
- xmlParserCtxtPtr ctxt = xmlCreateIOParserCtxt(&rxml_sax_hander_struct, self,
97
- (xmlInputReadCallback) rxml_read_callback,
98
- NULL, io, xmlEncoding);
99
- return xmlParseDocument(ctxt);
100
- }
101
-
102
-
103
- /*
104
- * call-seq:
105
- * parser.parse -> (true|false)
106
- *
107
- * Parse the input XML, generating callbacks to the object
108
- * registered via the +callbacks+ attributesibute.
109
- */
110
- static VALUE
111
- rxml_sax_parser_parse(VALUE self) {
112
- int status;
113
- VALUE input = rb_ivar_get(self, INPUT_ATTR);
114
-
115
- if (rb_ivar_get(input, FILE_ATTR) != Qnil)
116
- status = rxml_sax_parser_parse_file(self, input);
117
- else if (rb_ivar_get(input, STRING_ATTR) != Qnil)
118
- status = rxml_sax_parser_parse_string(self, input);
119
- else if (rb_ivar_get(input, IO_ATTR) != Qnil)
120
- status = rxml_sax_parser_parse_io(self, input);
121
- else
122
- rb_raise(rb_eArgError, "You must specify a parser data source");
123
-
124
- if (status)
125
- {
126
- rxml_raise(&xmlLastError);
127
- return Qfalse;
128
- }
129
- else
130
- {
131
- return(Qtrue);
132
- }
133
- }
134
-
135
- // Rdoc needs to know
136
- #ifdef RDOC_NEVER_DEFINED
137
- mLibXML = rb_define_module("LibXML");
138
- mXML = rb_define_module_under(mLibXML, "XML");
139
- #endif
140
-
141
- void
142
- ruby_init_xml_sax_parser(void) {
143
- /* SaxParser */
144
- cXMLSaxParser = rb_define_class_under(mXML, "SaxParser", rb_cObject);
145
-
146
- /* Atributes */
147
- CALLBACKS_ATTR = rb_intern("@callbacks");
148
- INPUT_ATTR = rb_intern("@input");
149
- rb_define_attr(cXMLSaxParser, "callbacks", 1, 1);
150
- rb_define_attr(cXMLSaxParser, "input", 1, 0);
151
-
152
- /* Instance Methods */
153
- rb_define_method(cXMLSaxParser, "initialize", rxml_sax_parser_initialize, 0);
154
- rb_define_method(cXMLSaxParser, "parse", rxml_sax_parser_parse, 0);
155
-
156
- /* SaxCallbacks */
157
- cbidOnInternalSubset = rb_intern("on_internal_subset");
158
- cbidOnIsStandalone = rb_intern("on_is_standalone");
159
- cbidOnHasInternalSubset = rb_intern("on_has_internal_subset");
160
- cbidOnHasExternalSubset = rb_intern("on_has_external_subset");
161
- cbidOnStartDocument = rb_intern("on_start_document");
162
- cbidOnEndDocument = rb_intern("on_end_document");
163
- cbidOnStartElement = rb_intern("on_start_element");
164
- cbidOnEndElement = rb_intern("on_end_element");
165
- cbidOnReference = rb_intern("on_reference");
166
- cbidOnCharacters = rb_intern("on_characters");
167
- cbidOnProcessingInstruction = rb_intern("on_processing_instruction");
168
- cbidOnComment = rb_intern("on_comment");
169
- cbidOnXmlParserWarning = rb_intern("on_parser_warning");
170
- cbidOnXmlParserError = rb_intern("on_parser_error");
171
- cbidOnXmlParserFatalError = rb_intern("on_parser_fatal_error");
172
- cbidOnCdataBlock = rb_intern("on_cdata_block");
173
- cbidOnExternalSubset = rb_intern("on_external_subset");
174
- }
1
+ /* $Id: ruby_xml_sax_parser.c 630 2008-11-24 06:53:01Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #include "ruby_libxml.h"
6
+ #include "ruby_xml_sax_parser.h"
7
+
8
+ /*
9
+ * Document-class: LibXML::XML::SaxParser
10
+ *
11
+ * XML::SaxParser provides a callback based API for parsing documents,
12
+ * in contrast to XML::Parser's tree based API and XML::Reader's stream
13
+ * based API.
14
+ *
15
+ * Note that the XML::SaxParser API is fairly complex, not well standardized,
16
+ * and does not directly support validation making entity, namespace and
17
+ * base processing relatively hard.
18
+ *
19
+ * To use the XML::SaxParser, register a callback class via the
20
+ * XML::SaxParser#callbacks=. It is easiest to include the
21
+ * XML::SaxParser::Callbacks module in your class and override
22
+ * the methods as needed.
23
+ *
24
+ * Basic example:
25
+ *
26
+ * class MyCallbacks
27
+ * include XML::SaxParser::Callbacks
28
+ * def on_start_element(element, attributes)
29
+ * puts #Element started: #{element}"
30
+ * end
31
+ * end
32
+ *
33
+ * parser = XML::SaxParser.new
34
+ * parser.callbacks = MyCallbacks.new
35
+ * parser.parse
36
+ */
37
+
38
+ VALUE cXMLSaxParser;
39
+ VALUE mXMLSaxParserCallbacks;
40
+
41
+ static ID INPUT_ATTR;
42
+ static ID CALLBACKS_ATTR;
43
+
44
+ VALUE cbidOnInternalSubset;
45
+ VALUE cbidOnIsStandalone;
46
+ VALUE cbidOnHasInternalSubset;
47
+ VALUE cbidOnHasExternalSubset;
48
+ VALUE cbidOnStartDocument;
49
+ VALUE cbidOnEndDocument;
50
+ VALUE cbidOnStartElement;
51
+ VALUE cbidOnEndElement;
52
+ VALUE cbidOnReference;
53
+ VALUE cbidOnCharacters;
54
+ VALUE cbidOnProcessingInstruction;
55
+ VALUE cbidOnComment;
56
+ VALUE cbidOnXmlParserWarning;
57
+ VALUE cbidOnXmlParserError;
58
+ VALUE cbidOnXmlParserFatalError;
59
+ VALUE cbidOnCdataBlock;
60
+ VALUE cbidOnExternalSubset;
61
+
62
+ #include "sax_parser_callbacks.inc"
63
+
64
+ /*
65
+ * call-seq:
66
+ * sax_parser.initialize -> sax_parser
67
+ *
68
+ * Initiliazes instance of parser.
69
+ */
70
+ static VALUE
71
+ rxml_sax_parser_initialize(VALUE self) {
72
+ VALUE input = rb_class_new_instance(0, NULL, cXMLInput);
73
+ rb_iv_set(self, "@input", input);
74
+ return self;
75
+ }
76
+
77
+
78
+ /* Parsing data sources */
79
+ static int
80
+ rxml_sax_parser_parse_file(VALUE self, VALUE input) {
81
+ VALUE file = rb_ivar_get(input, FILE_ATTR);
82
+ return xmlSAXUserParseFile((xmlSAXHandlerPtr)&rxml_sax_hander_struct, (void *)self, StringValuePtr(file));
83
+ }
84
+
85
+ static int
86
+ rxml_sax_parser_parse_string(VALUE self, VALUE input) {
87
+ VALUE str = rb_ivar_get(input, STRING_ATTR);
88
+ return xmlSAXUserParseMemory((xmlSAXHandlerPtr)&rxml_sax_hander_struct, (void *)self, StringValuePtr(str), RSTRING_LEN(str));
89
+ }
90
+
91
+ static int
92
+ rxml_sax_parser_parse_io(VALUE self, VALUE input) {
93
+ VALUE io = rb_ivar_get(input, IO_ATTR);
94
+ VALUE encoding = rb_ivar_get(input, ENCODING_ATTR);
95
+ xmlCharEncoding xmlEncoding = NUM2INT(encoding);
96
+ xmlParserCtxtPtr ctxt = xmlCreateIOParserCtxt((xmlSAXHandlerPtr)&rxml_sax_hander_struct, (void *)self,
97
+ (xmlInputReadCallback) rxml_read_callback,
98
+ NULL, (void *)io, xmlEncoding);
99
+ return xmlParseDocument(ctxt);
100
+ }
101
+
102
+
103
+ /*
104
+ * call-seq:
105
+ * parser.parse -> (true|false)
106
+ *
107
+ * Parse the input XML, generating callbacks to the object
108
+ * registered via the +callbacks+ attributesibute.
109
+ */
110
+ static VALUE
111
+ rxml_sax_parser_parse(VALUE self) {
112
+ int status;
113
+ VALUE input = rb_ivar_get(self, INPUT_ATTR);
114
+
115
+ if (rb_ivar_get(input, FILE_ATTR) != Qnil)
116
+ status = rxml_sax_parser_parse_file(self, input);
117
+ else if (rb_ivar_get(input, STRING_ATTR) != Qnil)
118
+ status = rxml_sax_parser_parse_string(self, input);
119
+ else if (rb_ivar_get(input, IO_ATTR) != Qnil)
120
+ status = rxml_sax_parser_parse_io(self, input);
121
+ else
122
+ rb_raise(rb_eArgError, "You must specify a parser data source");
123
+
124
+ if (status)
125
+ {
126
+ rxml_raise(&xmlLastError);
127
+ return Qfalse;
128
+ }
129
+ else
130
+ {
131
+ return(Qtrue);
132
+ }
133
+ }
134
+
135
+ // Rdoc needs to know
136
+ #ifdef RDOC_NEVER_DEFINED
137
+ mLibXML = rb_define_module("LibXML");
138
+ mXML = rb_define_module_under(mLibXML, "XML");
139
+ #endif
140
+
141
+ void
142
+ ruby_init_xml_sax_parser(void) {
143
+ /* SaxParser */
144
+ cXMLSaxParser = rb_define_class_under(mXML, "SaxParser", rb_cObject);
145
+
146
+ /* Atributes */
147
+ CALLBACKS_ATTR = rb_intern("@callbacks");
148
+ INPUT_ATTR = rb_intern("@input");
149
+ rb_define_attr(cXMLSaxParser, "callbacks", 1, 1);
150
+ rb_define_attr(cXMLSaxParser, "input", 1, 0);
151
+
152
+ /* Instance Methods */
153
+ rb_define_method(cXMLSaxParser, "initialize", rxml_sax_parser_initialize, 0);
154
+ rb_define_method(cXMLSaxParser, "parse", rxml_sax_parser_parse, 0);
155
+
156
+ /* SaxCallbacks */
157
+ cbidOnInternalSubset = rb_intern("on_internal_subset");
158
+ cbidOnIsStandalone = rb_intern("on_is_standalone");
159
+ cbidOnHasInternalSubset = rb_intern("on_has_internal_subset");
160
+ cbidOnHasExternalSubset = rb_intern("on_has_external_subset");
161
+ cbidOnStartDocument = rb_intern("on_start_document");
162
+ cbidOnEndDocument = rb_intern("on_end_document");
163
+ cbidOnStartElement = rb_intern("on_start_element");
164
+ cbidOnEndElement = rb_intern("on_end_element");
165
+ cbidOnReference = rb_intern("on_reference");
166
+ cbidOnCharacters = rb_intern("on_characters");
167
+ cbidOnProcessingInstruction = rb_intern("on_processing_instruction");
168
+ cbidOnComment = rb_intern("on_comment");
169
+ cbidOnXmlParserWarning = rb_intern("on_parser_warning");
170
+ cbidOnXmlParserError = rb_intern("on_parser_error");
171
+ cbidOnXmlParserFatalError = rb_intern("on_parser_fatal_error");
172
+ cbidOnCdataBlock = rb_intern("on_cdata_block");
173
+ cbidOnExternalSubset = rb_intern("on_external_subset");
174
+ }
@@ -1,12 +1,12 @@
1
- /* $Id: ruby_xml_sax_parser.h 616 2008-11-22 09:25:12Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #ifndef __rxml_SAX_PARSER__
6
- #define __rxml_SAX_PARSER__
7
-
8
- extern VALUE cXMLSaxParser;
9
-
10
- void ruby_init_xml_sax_parser(void);
11
-
12
- #endif
1
+ /* $Id: ruby_xml_sax_parser.h 616 2008-11-22 09:25:12Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #ifndef __rxml_SAX_PARSER__
6
+ #define __rxml_SAX_PARSER__
7
+
8
+ extern VALUE cXMLSaxParser;
9
+
10
+ void ruby_init_xml_sax_parser(void);
11
+
12
+ #endif
@@ -1,25 +1,13 @@
1
- /* $Id: ruby_xml_xpointer.h 614 2008-11-22 08:04:39Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #ifndef __rxml_XPOINTER__
6
- #define __rxml_XPOINTER__
7
-
8
- extern VALUE cXMLXPointer;
9
- extern VALUE eXMLXPointerInvalidExpression;
10
-
11
- typedef struct rxml_xpointer {
12
- VALUE xd;
13
- VALUE ctxt;
14
- /*
15
- * This needs to go into a xpointer data struct:
16
- *
17
- * xmlLocationSetPtr xptr;
18
- *
19
- * I also need an xpointer data struct type.
20
- */
21
- } rxml_xpointer;
22
-
23
- void ruby_init_xml_xpointer(void);
24
-
25
- #endif
1
+ /* $Id: ruby_xml_xpointer.h 630 2008-11-24 06:53:01Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #ifndef __rxml_XPOINTER__
6
+ #define __rxml_XPOINTER__
7
+
8
+ extern VALUE cXMLXPointer;
9
+
10
+ void ruby_init_xml_xpointer(void);
11
+ VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str);
12
+
13
+ #endif
data/ext/libxml/version.h CHANGED
@@ -1,9 +1,9 @@
1
1
  /* Don't nuke this block! It is used for automatically updating the
2
2
  * versions below. VERSION = string formatting, VERNUM = numbered
3
3
  * version for inline testing: increment both or none at all.*/
4
- #define RUBY_LIBXML_VERSION "0.9.3"
4
+ #define RUBY_LIBXML_VERSION "0.9.4"
5
5
  #define RUBY_LIBXML_VERNUM 0
6
6
  #define RUBY_LIBXML_VER_MAJ 0
7
7
  #define RUBY_LIBXML_VER_MIN 9
8
- #define RUBY_LIBXML_VER_MIC 3
8
+ #define RUBY_LIBXML_VER_MIC 4
9
9
  #define RUBY_LIBXML_VER_PATCH 0
Binary file
Binary file
@@ -63,7 +63,7 @@
63
63
  <Tool
64
64
  Name="VCLinkerTool"
65
65
  AdditionalDependencies="msvcrt-ruby18.lib libxml2.lib"
66
- OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\libxml-ruby-0.9.3-x86-mswin32-60\lib\$(ProjectName).so"
66
+ OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\libxml-ruby-0.9.4-x86-mswin32-60\lib\$(ProjectName).so"
67
67
  LinkIncremental="2"
68
68
  AdditionalLibraryDirectories="C:\Development\ruby\lib;C:\Development\msys\local\lib"
69
69
  GenerateDebugInformation="true"