libxml-ruby 0.9.6-x86-mswin32-60 → 0.9.7-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,107 +1,107 @@
1
- /* $Id: ruby_xml_xpointer.c 650 2008-11-30 03:40:22Z cfis $ */
2
-
3
- /* Please see the LICENSE file for copyright and distribution information */
4
-
5
- #include "ruby_libxml.h"
6
- #include "ruby_xml_xpointer.h"
7
-
8
- VALUE cXMLXPointer;
9
-
10
- /*
11
- * Document-class: LibXML::XML::XPointer
12
- *
13
- * The XML::Pointer class provides a standards based API for searching an xml document.
14
- * XPointer is based on the XML Path Language (XML::XPath) and is documented
15
- * at http://www.w3.org/TR/WD-xptr.
16
- */
17
-
18
- static VALUE rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str)
19
- {
20
- #ifdef LIBXML_XPTR_ENABLED
21
- xmlNodePtr xnode;
22
- xmlXPathContextPtr xctxt;
23
- xmlXPathObjectPtr xpop;
24
-
25
- VALUE context;
26
- VALUE result;
27
- VALUE argv[1];
28
-
29
- Check_Type(xptr_str, T_STRING);
30
- if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
31
- rb_raise(rb_eTypeError, "require an XML::Node object");
32
-
33
- Data_Get_Struct(rnode, xmlNode, xnode);
34
-
35
- argv[0] = rb_funcall(rnode, rb_intern("doc"), 0);
36
- context = rb_class_new_instance(1, argv, cXMLXPathContext);
37
- Data_Get_Struct(context, xmlXPathContext, xctxt);
38
-
39
- xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
40
- if (!xpop)
41
- rxml_raise(&xmlLastError);
42
-
43
- result = rxml_xpath_object_wrap(xpop);
44
- rb_iv_set(result, "@context", context);
45
-
46
- return(result);
47
- #else
48
- rb_warn("libxml was compiled without XPointer support");
49
- return (Qfalse);
50
- #endif
51
- }
52
-
53
- VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
54
- {
55
- return (rxml_xpointer_point(cXMLXPointer, node, xptr_str));
56
- }
57
-
58
- /*
59
- * call-seq:
60
- * XML::XPointer.range(start_node, end_node) -> xpath
61
- *
62
- * Create an xpath representing the range between the supplied
63
- * start and end node.
64
- */
65
- static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
66
- {
67
- #ifdef LIBXML_XPTR_ENABLED
68
- xmlNodePtr start, end;
69
- VALUE rxxp;
70
- xmlXPathObjectPtr xpath;
71
-
72
- if (rb_obj_is_kind_of(rstart, cXMLNode) == Qfalse)
73
- rb_raise(rb_eTypeError, "require an XML::Node object as a starting point");
74
- if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
75
- rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
76
-
77
- Data_Get_Struct(rstart, xmlNode, start);
78
- if (start == NULL)
79
- return(Qnil);
80
-
81
- Data_Get_Struct(rend, xmlNode, end);
82
- if (end == NULL)
83
- return(Qnil);
84
-
85
- xpath = xmlXPtrNewRangeNodes(start, end);
86
- if (xpath == NULL)
87
- rb_fatal("You shouldn't be able to have this happen");
88
-
89
- rxxp = rxml_xpath_object_wrap(xpath);
90
- return(rxxp);
91
- #else
92
- rb_warn("libxml was compiled without XPointer support");
93
- return (Qfalse);
94
- #endif
95
- }
96
-
97
- // Rdoc needs to know
98
- #ifdef RDOC_NEVER_DEFINED
99
- mLibXML = rb_define_module("LibXML");
100
- mXML = rb_define_module_under(mLibXML, "XML");
101
- #endif
102
-
103
- void ruby_init_xml_xpointer(void)
104
- {
105
- cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
106
- rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
107
- }
1
+ /* $Id: ruby_xml_xpointer.c 650 2008-11-30 03:40:22Z cfis $ */
2
+
3
+ /* Please see the LICENSE file for copyright and distribution information */
4
+
5
+ #include "ruby_libxml.h"
6
+ #include "ruby_xml_xpointer.h"
7
+
8
+ VALUE cXMLXPointer;
9
+
10
+ /*
11
+ * Document-class: LibXML::XML::XPointer
12
+ *
13
+ * The XML::Pointer class provides a standards based API for searching an xml document.
14
+ * XPointer is based on the XML Path Language (XML::XPath) and is documented
15
+ * at http://www.w3.org/TR/WD-xptr.
16
+ */
17
+
18
+ static VALUE rxml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str)
19
+ {
20
+ #ifdef LIBXML_XPTR_ENABLED
21
+ xmlNodePtr xnode;
22
+ xmlXPathContextPtr xctxt;
23
+ xmlXPathObjectPtr xpop;
24
+
25
+ VALUE context;
26
+ VALUE result;
27
+ VALUE argv[1];
28
+
29
+ Check_Type(xptr_str, T_STRING);
30
+ if (rb_obj_is_kind_of(rnode, cXMLNode) == Qfalse)
31
+ rb_raise(rb_eTypeError, "require an XML::Node object");
32
+
33
+ Data_Get_Struct(rnode, xmlNode, xnode);
34
+
35
+ argv[0] = rb_funcall(rnode, rb_intern("doc"), 0);
36
+ context = rb_class_new_instance(1, argv, cXMLXPathContext);
37
+ Data_Get_Struct(context, xmlXPathContext, xctxt);
38
+
39
+ xpop = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), xctxt);
40
+ if (!xpop)
41
+ rxml_raise(&xmlLastError);
42
+
43
+ result = rxml_xpath_object_wrap(xpop);
44
+ rb_iv_set(result, "@context", context);
45
+
46
+ return(result);
47
+ #else
48
+ rb_warn("libxml was compiled without XPointer support");
49
+ return (Qfalse);
50
+ #endif
51
+ }
52
+
53
+ VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str)
54
+ {
55
+ return (rxml_xpointer_point(cXMLXPointer, node, xptr_str));
56
+ }
57
+
58
+ /*
59
+ * call-seq:
60
+ * XML::XPointer.range(start_node, end_node) -> xpath
61
+ *
62
+ * Create an xpath representing the range between the supplied
63
+ * start and end node.
64
+ */
65
+ static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
66
+ {
67
+ #ifdef LIBXML_XPTR_ENABLED
68
+ xmlNodePtr start, end;
69
+ VALUE rxxp;
70
+ xmlXPathObjectPtr xpath;
71
+
72
+ if (rb_obj_is_kind_of(rstart, cXMLNode) == Qfalse)
73
+ rb_raise(rb_eTypeError, "require an XML::Node object as a starting point");
74
+ if (rb_obj_is_kind_of(rend, cXMLNode) == Qfalse)
75
+ rb_raise(rb_eTypeError, "require an XML::Node object as an ending point");
76
+
77
+ Data_Get_Struct(rstart, xmlNode, start);
78
+ if (start == NULL)
79
+ return(Qnil);
80
+
81
+ Data_Get_Struct(rend, xmlNode, end);
82
+ if (end == NULL)
83
+ return(Qnil);
84
+
85
+ xpath = xmlXPtrNewRangeNodes(start, end);
86
+ if (xpath == NULL)
87
+ rb_fatal("You shouldn't be able to have this happen");
88
+
89
+ rxxp = rxml_xpath_object_wrap(xpath);
90
+ return(rxxp);
91
+ #else
92
+ rb_warn("libxml was compiled without XPointer support");
93
+ return (Qfalse);
94
+ #endif
95
+ }
96
+
97
+ // Rdoc needs to know
98
+ #ifdef RDOC_NEVER_DEFINED
99
+ mLibXML = rb_define_module("LibXML");
100
+ mXML = rb_define_module_under(mLibXML, "XML");
101
+ #endif
102
+
103
+ void ruby_init_xml_xpointer(void)
104
+ {
105
+ cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
106
+ rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
107
+ }
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.6"
4
+ #define RUBY_LIBXML_VERSION "0.9.7"
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 6
8
+ #define RUBY_LIBXML_VER_MIC 7
9
9
  #define RUBY_LIBXML_VER_PATCH 0
Binary file
Binary file
@@ -249,6 +249,10 @@
249
249
  RelativePath="..\libxml\ruby_xml_relaxng.c"
250
250
  >
251
251
  </File>
252
+ <File
253
+ RelativePath="..\libxml\ruby_xml_sax2_handler.c"
254
+ >
255
+ </File>
252
256
  <File
253
257
  RelativePath="..\libxml\ruby_xml_sax_parser.c"
254
258
  >
@@ -355,6 +359,10 @@
355
359
  RelativePath="..\libxml\ruby_xml_relaxng.h"
356
360
  >
357
361
  </File>
362
+ <File
363
+ RelativePath="..\libxml\ruby_xml_sax2_handler.h"
364
+ >
365
+ </File>
358
366
  <File
359
367
  RelativePath="..\libxml\ruby_xml_sax_parser.h"
360
368
  >
data/lib/libxml/node.rb CHANGED
@@ -295,8 +295,8 @@ module LibXML
295
295
 
296
296
  # --- Deprecated Namespaces ---
297
297
  def namespace
298
- warn('Node#namespace is deprecated. Use Node#namespaces.namespace instead.')
299
- self.namespaces.namespace
298
+ warn('Node#namespace is deprecated. Use Node#namespaces instead.')
299
+ self.namespaces.entries
300
300
  end
301
301
 
302
302
  def namespace=(value)
@@ -304,6 +304,11 @@ module LibXML
304
304
  self.namespaces.namespace = value
305
305
  end
306
306
 
307
+ def namespace_node
308
+ warn('Node#namespace_node is deprecated. Use Node#namespaces.namespace instead.')
309
+ self.namespaces.namespace
310
+ end
311
+
307
312
  def ns
308
313
  warn('Node#ns is deprecated. Use Node#namespaces.namespace instead.')
309
314
  self.namespaces.namespace
@@ -2,103 +2,83 @@ module LibXML
2
2
  module XML
3
3
  class SaxParser
4
4
  module Callbacks
5
- # Called for an internal subset event.
6
- def on_internal_subset(name, external_id, system_id)
7
- end
8
-
9
- # Called for 'is standalone' event.
10
- def on_is_standalone
11
- end
12
-
13
- # Called for an internal subset notification event.
14
- def on_has_internal_subset
5
+ # Called for a CDATA block event.
6
+ def on_cdata_block(cdata)
15
7
  end
16
8
 
17
- # Called for an external subset notification event.
18
- def on_has_external_subset
9
+ # Called for a characters event.
10
+ def on_characters(chars)
19
11
  end
20
12
 
21
- # Called for a start document event.
22
- def on_start_document
13
+ # Called for a comment event.
14
+ def on_comment(msg)
23
15
  end
24
16
 
25
17
  # Called for a end document event.
26
18
  def on_end_document
27
19
  end
28
20
 
29
- # Called for a start element event.
30
- def on_start_element(name, attributes_hash)
21
+ # Called for a end element event.
22
+ def on_end_element_ns(name, prefix, uri)
31
23
  end
32
24
 
33
- # Called for a end element event.
34
- def on_end_element(name)
25
+ # Called for parser errors.
26
+ def on_error(msg)
35
27
  end
36
28
 
37
- # Called for a reference event.
38
- def on_reference(name)
29
+ # Called for an external subset event.
30
+ def on_external_subset(name, external_id, system_id)
39
31
  end
40
32
 
41
- # Called for a characters event.
42
- def on_characters(chars)
33
+ # Called for an external subset notification event.
34
+ def on_has_external_subset
43
35
  end
44
36
 
45
- # Called for an processing instruction event.
46
- def on_processing_instruction(target, data)
37
+ # Called for an internal subset notification event.
38
+ def on_has_internal_subset
47
39
  end
48
40
 
49
- # Called for a comment event.
50
- def on_comment(msg)
41
+ # Called for an internal subset event.
42
+ def on_internal_subset(name, external_id, system_id)
51
43
  end
52
44
 
53
- # Called for parser warnings.
54
- def on_parser_warning(msg)
45
+ # Called for 'is standalone' event.
46
+ def on_is_standalone
55
47
  end
56
48
 
57
- # Called for parser errors.
58
- def on_parser_error(msg)
49
+ # Called for an processing instruction event.
50
+ def on_processing_instruction(target, data)
59
51
  end
60
52
 
61
- # Called for fatal parser errors.
62
- def on_parser_fatal_error(msg)
53
+ # Called for a reference event.
54
+ def on_reference(name)
63
55
  end
64
56
 
65
- # Called for a CDATA block event.
66
- def on_cdata_block(cdata)
57
+ # Called for a start document event.
58
+ def on_start_document
67
59
  end
68
60
 
69
- # Called for an external subset event.
70
- def on_external_subset(name, external_id, system_id)
61
+ # Called for a start element event.
62
+ def on_start_element_ns(name, attributes, prefix, uri, namespaces)
71
63
  end
72
64
  end
73
65
 
74
66
  module VerboseCallbacks
75
- # Called for an internal subset event.
76
- def on_internal_subset(name, external_id, system_id)
77
- STDOUT << "on_internal_subset(" << name << ", " << external_id << ", " << system_id << ")\n"
78
- STDOUT.flush
79
- end
80
-
81
- # Called for 'is standalone' event.
82
- def on_is_standalone
83
- STDOUT << "on_is_standalone\n"
84
- STDOUT.flush
85
- end
86
-
87
- # Called for an internal subset notification event.
88
- def on_has_internal_subset
89
- STDOUT << "on_has_internal_subset\n"
67
+ # Called for a CDATA block event.
68
+ def on_cdata_block(cdata)
69
+ STDOUT << "on_cdata_block(" << cdata << ")\n"
90
70
  STDOUT.flush
91
71
  end
92
72
 
93
- # Called for an external subset notification event.
94
- def on_has_external_subset
95
- STDOUT << "on_has_internal_subset\n"
73
+ # Called for a characters event.
74
+ def on_characters(chars)
75
+ STDOUT << "on_characters(" << chars << ")\n"
96
76
  STDOUT.flush
97
77
  end
98
78
 
99
- # Called for a start document event.
100
- def on_start_document
101
- STDOUT << "on_start_document\n"
79
+ # Called for a comment event.
80
+ def on_comment(msg)
81
+ STDOUT << "on_comment(" << msg << ")\n"
102
82
  STDOUT.flush
103
83
  end
104
84
 
@@ -108,69 +88,77 @@ module LibXML
108
88
  STDOUT.flush
109
89
  end
110
90
 
111
- # Called for a start element event.
112
- def on_start_element(name, attributes_hash)
113
- STDOUT << "on_start_element(" << name << ", " << attributes_hash << ")\n"
91
+ # Called for a end element event.
92
+ def on_end_element_ns(name, prefix, uri)
93
+ STDOUT << "on_end_element(" << name <<
94
+ ", prefix: " << prefix <<
95
+ ", uri: " << uri <<
96
+ ")\n"
114
97
  STDOUT.flush
115
98
  end
116
99
 
117
- # Called for a end element event.
118
- def on_end_element(name)
119
- STDOUT << "on_end_element(" << name << ")\n"
100
+ # Called for parser errors.
101
+ def on_error(error)
102
+ STDOUT << "on_error(" << error << ")\n"
120
103
  STDOUT.flush
121
104
  end
122
105
 
123
- # Called for a reference event.
124
- def on_reference(name)
125
- STDOUT << "on_reference(" << name << ")\n"
106
+ # Called for an external subset event.
107
+ def on_external_subset(name, external_id, system_id)
108
+ STDOUT << "on_external_subset(" << name << ", " << external_id << ", " << system_id << ")\n"
126
109
  STDOUT.flush
127
110
  end
128
111
 
129
- # Called for a characters event.
130
- def on_characters(chars)
131
- STDOUT << "on_characters(" << chars << ")\n"
112
+ # Called for an external subset notification event.
113
+ def on_has_external_subset
114
+ STDOUT << "on_has_internal_subset\n"
132
115
  STDOUT.flush
133
116
  end
134
117
 
135
- # Called for an processing instruction event.
136
- def on_processing_instruction(target, data)
137
- STDOUT << "on_characters(" << target << ", " << data << ")\n"
118
+ # Called for an internal subset notification event.
119
+ def on_has_internal_subset
120
+ STDOUT << "on_has_internal_subset\n"
138
121
  STDOUT.flush
139
122
  end
140
123
 
141
- # Called for a comment event.
142
- def on_comment(msg)
143
- STDOUT << "on_comment(" << msg << ")\n"
124
+ # Called for an internal subset event.
125
+ def on_internal_subset(name, external_id, system_id)
126
+ STDOUT << "on_internal_subset(" << name << ", " << external_id << ", " << system_id << ")\n"
144
127
  STDOUT.flush
145
128
  end
146
129
 
147
- # Called for parser warnings.
148
- def on_parser_warning(msg)
149
- STDOUT << "on_parser_warning(" << msg << ")\n"
130
+ # Called for 'is standalone' event.
131
+ def on_is_standalone
132
+ STDOUT << "on_is_standalone\n"
150
133
  STDOUT.flush
151
134
  end
152
135
 
153
- # Called for parser errors.
154
- def on_parser_error(msg)
155
- STDOUT << "on_parser_error(" << msg << ")\n"
136
+ # Called for an processing instruction event.
137
+ def on_processing_instruction(target, data)
138
+ STDOUT << "on_characters(" << target << ", " << data << ")\n"
156
139
  STDOUT.flush
157
140
  end
158
141
 
159
- # Called for fatal parser errors.
160
- def on_parser_fatal_error(msg)
161
- STDOUT << "on_parser_fatal_error(" << msg << ")\n"
142
+ # Called for a reference event.
143
+ def on_reference(name)
144
+ STDOUT << "on_reference(" << name << ")\n"
162
145
  STDOUT.flush
163
146
  end
164
147
 
165
- # Called for a CDATA block event.
166
- def on_cdata_block(cdata)
167
- STDOUT << "on_cdata_block(" << cdata << ")\n"
148
+ # Called for a start document event.
149
+ def on_start_document
150
+ STDOUT << "on_start_document\n"
168
151
  STDOUT.flush
169
152
  end
170
153
 
171
- # Called for an external subset event.
172
- def on_external_subset(name, external_id, system_id)
173
- STDOUT << "on_external_subset(" << name << ", " << external_id << ", " << system_id << ")\n"
154
+ # Called for a start element event.
155
+ def on_start_element_ns(name, attributes, prefix, uri, namespaces)
156
+ STDOUT << "on_start_element_ns(" << name <<
157
+ ", attr " << (attributes || Hash.new).inspect <<
158
+ ", prefix: " << prefix <<
159
+ ", uri: " << uri << ")\n" <<
160
+ ", ns " << (namespaces || Hash.new).inspect <<
161
+ ")\n"
174
162
  STDOUT.flush
175
163
  end
176
164
  end