libxml-ruby 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (96) hide show
  1. data/CHANGES +41 -1
  2. data/LICENSE +3 -4
  3. data/README +37 -24
  4. data/Rakefile +2 -2
  5. data/ext/libxml/extconf.rb +31 -12
  6. data/ext/libxml/libxml.c +56 -858
  7. data/ext/libxml/ruby_libxml.h +93 -96
  8. data/ext/libxml/ruby_xml.c +855 -0
  9. data/ext/libxml/ruby_xml.h +9 -0
  10. data/ext/libxml/ruby_xml_attr.c +3 -9
  11. data/ext/libxml/ruby_xml_attr.h +2 -2
  12. data/ext/libxml/ruby_xml_attr_decl.c +2 -8
  13. data/ext/libxml/ruby_xml_attr_decl.h +1 -1
  14. data/ext/libxml/ruby_xml_attributes.c +6 -8
  15. data/ext/libxml/ruby_xml_attributes.h +1 -1
  16. data/ext/libxml/ruby_xml_document.c +915 -895
  17. data/ext/libxml/ruby_xml_document.h +2 -2
  18. data/ext/libxml/ruby_xml_dtd.c +257 -136
  19. data/ext/libxml/ruby_xml_dtd.h +1 -1
  20. data/ext/libxml/ruby_xml_encoding.c +55 -37
  21. data/ext/libxml/ruby_xml_encoding.h +1 -1
  22. data/ext/libxml/ruby_xml_error.c +526 -1058
  23. data/ext/libxml/ruby_xml_error.h +1 -1
  24. data/ext/libxml/ruby_xml_html_parser.c +2 -8
  25. data/ext/libxml/ruby_xml_html_parser.h +2 -2
  26. data/ext/libxml/ruby_xml_html_parser_context.c +175 -145
  27. data/ext/libxml/ruby_xml_html_parser_context.h +1 -1
  28. data/ext/libxml/ruby_xml_html_parser_options.c +12 -20
  29. data/ext/libxml/ruby_xml_html_parser_options.h +1 -1
  30. data/ext/libxml/ruby_xml_input_cbg.c +2 -8
  31. data/ext/libxml/ruby_xml_input_cbg.h +1 -1
  32. data/ext/libxml/ruby_xml_namespace.c +2 -8
  33. data/ext/libxml/ruby_xml_namespace.h +2 -2
  34. data/ext/libxml/ruby_xml_namespaces.c +1 -9
  35. data/ext/libxml/ruby_xml_namespaces.h +1 -1
  36. data/ext/libxml/ruby_xml_node.c +182 -121
  37. data/ext/libxml/ruby_xml_node.h +2 -2
  38. data/ext/libxml/ruby_xml_parser.c +2 -8
  39. data/ext/libxml/ruby_xml_parser.h +2 -2
  40. data/ext/libxml/ruby_xml_parser_context.c +952 -901
  41. data/ext/libxml/ruby_xml_parser_context.h +2 -2
  42. data/ext/libxml/ruby_xml_parser_options.c +2 -9
  43. data/ext/libxml/ruby_xml_parser_options.h +1 -1
  44. data/ext/libxml/ruby_xml_reader.c +1002 -993
  45. data/ext/libxml/ruby_xml_reader.h +1 -1
  46. data/ext/libxml/ruby_xml_relaxng.c +1 -7
  47. data/ext/libxml/ruby_xml_relaxng.h +1 -1
  48. data/ext/libxml/ruby_xml_sax2_handler.c +2 -2
  49. data/ext/libxml/ruby_xml_sax2_handler.h +1 -1
  50. data/ext/libxml/ruby_xml_sax_parser.c +2 -8
  51. data/ext/libxml/ruby_xml_sax_parser.h +2 -2
  52. data/ext/libxml/ruby_xml_schema.c +1 -7
  53. data/ext/libxml/ruby_xml_schema.h +1 -1
  54. data/ext/libxml/{version.h → ruby_xml_version.h} +2 -2
  55. data/ext/libxml/ruby_xml_xinclude.c +2 -8
  56. data/ext/libxml/ruby_xml_xinclude.h +2 -2
  57. data/ext/libxml/ruby_xml_xpath.c +17 -18
  58. data/ext/libxml/ruby_xml_xpath.h +2 -2
  59. data/ext/libxml/ruby_xml_xpath_context.c +387 -389
  60. data/ext/libxml/ruby_xml_xpath_context.h +2 -2
  61. data/ext/libxml/ruby_xml_xpath_expression.c +18 -8
  62. data/ext/libxml/ruby_xml_xpath_expression.h +1 -1
  63. data/ext/libxml/ruby_xml_xpath_object.c +19 -8
  64. data/ext/libxml/ruby_xml_xpath_object.h +1 -1
  65. data/ext/libxml/ruby_xml_xpointer.c +2 -8
  66. data/ext/libxml/ruby_xml_xpointer.h +2 -2
  67. data/ext/vc/libxml_ruby.sln +7 -1
  68. data/lib/libxml.rb +1 -12
  69. data/lib/libxml/attr.rb +0 -3
  70. data/lib/libxml/attr_decl.rb +0 -3
  71. data/lib/libxml/attributes.rb +0 -3
  72. data/lib/libxml/document.rb +31 -5
  73. data/lib/libxml/error.rb +8 -4
  74. data/lib/libxml/properties.rb +0 -5
  75. data/lib/libxml/sax_callbacks.rb +30 -19
  76. data/lib/libxml/tree.rb +0 -1
  77. data/lib/libxml/xpath_object.rb +0 -13
  78. data/test/model/definition.dtd +8 -0
  79. data/test/tc_attributes.rb +4 -1
  80. data/test/tc_document.rb +16 -0
  81. data/test/tc_dtd.rb +30 -2
  82. data/test/tc_html_parser.rb +55 -10
  83. data/test/tc_node.rb +67 -1
  84. data/test/tc_node_edit.rb +26 -6
  85. data/test/tc_node_text.rb +41 -23
  86. data/test/tc_parser.rb +50 -0
  87. data/test/tc_reader.rb +15 -0
  88. data/test/tc_relaxng.rb +1 -1
  89. data/test/tc_sax_parser.rb +37 -5
  90. data/test/tc_schema.rb +1 -1
  91. data/test/tc_xpath.rb +1 -0
  92. data/test/tc_xpath_expression.rb +4 -2
  93. metadata +6 -6
  94. data/ext/libxml/ruby_xml_state.c +0 -51
  95. data/ext/libxml/ruby_xml_state.h +0 -11
  96. data/ext/vc/libxml_ruby.vcproj +0 -460
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_xpath_context.h 666 2008-12-07 00:16:50Z cfis $ */
1
+ /* $Id: ruby_xml_xpath_context.h 758 2009-01-25 20:36:03Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -6,6 +6,6 @@
6
6
  #define __RXML_XPATH_CONTEXT__
7
7
 
8
8
  extern VALUE cXMLXPathContext;
9
- void ruby_init_xml_xpath_context(void);
9
+ void rxml_init_xpath_context(void);
10
10
 
11
11
  #endif
@@ -34,6 +34,22 @@ static VALUE rxml_xpath_expression_alloc(VALUE klass)
34
34
  rxml_xpath_expression_free, NULL);
35
35
  }
36
36
 
37
+ /* call-seq:
38
+ * XPath::Expression.compile(expression) -> XPath::Expression
39
+ *
40
+ * Compiles an XPatch expression. This improves performance
41
+ * when an XPath expression is called multiple times.
42
+ *
43
+ * doc = XML::Document.string('<header><first>hi</first></header>')
44
+ * expr = XPath::Expression.new('//first')
45
+ * nodes = doc.find(expr)
46
+ */
47
+ static VALUE rxml_xpath_expression_compile(VALUE klass, VALUE expression)
48
+ {
49
+ VALUE args[] = {expression};
50
+ return rb_class_new_instance(1, args, cXMLXPathExpression);
51
+ }
52
+
37
53
  /* call-seq:
38
54
  * XPath::Expression.new(expression) -> XPath::Expression
39
55
  *
@@ -58,16 +74,10 @@ static VALUE rxml_xpath_expression_initialize(VALUE self, VALUE expression)
58
74
  return self;
59
75
  }
60
76
 
61
- // Rdoc needs to know
62
- #ifdef RDOC_NEVER_DEFINED
63
- mLibXML = rb_define_module("LibXML");
64
- mXPath = rb_define_module_under(mLibXML, "XPath");
65
- #endif
66
-
67
- void ruby_init_xml_xpath_expression(void)
77
+ void rxml_init_xpath_expression(void)
68
78
  {
69
79
  cXMLXPathExpression = rb_define_class_under(mXPath, "Expression", rb_cObject);
70
80
  rb_define_alloc_func(cXMLXPathExpression, rxml_xpath_expression_alloc);
71
- rb_define_singleton_method(cXMLXPathExpression, "compile", rb_class_new_instance, 1);
81
+ rb_define_singleton_method(cXMLXPathExpression, "compile", rxml_xpath_expression_compile, 1);
72
82
  rb_define_method(cXMLXPathExpression, "initialize", rxml_xpath_expression_initialize, 1);
73
83
  }
@@ -7,6 +7,6 @@
7
7
 
8
8
  extern VALUE cXMLXPathExpression;
9
9
 
10
- void ruby_init_xml_xpath_expression(void);
10
+ void rxml_init_xpath_expression(void);
11
11
 
12
12
  #endif
@@ -203,6 +203,23 @@ static VALUE rxml_xpath_object_first(VALUE self)
203
203
  return rxml_xpath_object_tabref(rxpop->xpop, 0);
204
204
  }
205
205
 
206
+ /*
207
+ * call-seq:
208
+ * xpath_object.last -> node
209
+ *
210
+ * Returns the last node in this node set, or nil if none exist.
211
+ */
212
+ static VALUE rxml_xpath_object_last(VALUE self)
213
+ {
214
+ rxml_xpath_object *rxpop;
215
+
216
+ if (rxml_xpath_object_empty_q(self) == Qtrue)
217
+ return Qnil;
218
+
219
+ Data_Get_Struct(self, rxml_xpath_object, rxpop);
220
+ return rxml_xpath_object_tabref(rxpop->xpop, -1);
221
+ }
222
+
206
223
  /*
207
224
  * call-seq:
208
225
  * xpath_object[i] -> node
@@ -301,13 +318,7 @@ static VALUE rxml_xpath_object_debug(VALUE self)
301
318
  #endif
302
319
  }
303
320
 
304
- // Rdoc needs to know
305
- #ifdef RDOC_NEVER_DEFINED
306
- mLibXML = rb_define_module("LibXML");
307
- mXPath = rb_define_module_under(mLibXML, "XPath");
308
- #endif
309
-
310
- void ruby_init_xml_xpath_object(void)
321
+ void rxml_init_xpath_object(void)
311
322
  {
312
323
  cXMLXPathObject = rb_define_class_under(mXPath, "Object", rb_cObject);
313
324
  rb_include_module(cXMLXPathObject, rb_mEnumerable);
@@ -316,8 +327,8 @@ void ruby_init_xml_xpath_object(void)
316
327
  rb_define_method(cXMLXPathObject, "xpath_type", rxml_xpath_object_get_type, 0);
317
328
  rb_define_method(cXMLXPathObject, "empty?", rxml_xpath_object_empty_q, 0);
318
329
  rb_define_method(cXMLXPathObject, "first", rxml_xpath_object_first, 0);
330
+ rb_define_method(cXMLXPathObject, "last", rxml_xpath_object_last, 0);
319
331
  rb_define_method(cXMLXPathObject, "length", rxml_xpath_object_length, 0);
320
- rb_define_method(cXMLXPathObject, "size", rxml_xpath_object_length, 0);
321
332
  rb_define_method(cXMLXPathObject, "to_a", rxml_xpath_object_to_a, 0);
322
333
  rb_define_method(cXMLXPathObject, "[]", rxml_xpath_object_aref, 1);
323
334
  rb_define_method(cXMLXPathObject, "string", rxml_xpath_object_string, 0);
@@ -13,7 +13,7 @@ typedef struct rxml_xpath_object
13
13
  } rxml_xpath_object;
14
14
 
15
15
 
16
- void ruby_init_xml_xpath_object(void);
16
+ void rxml_init_xpath_object(void);
17
17
  VALUE rxml_xpath_object_wrap(xmlDocPtr xdoc, xmlXPathObjectPtr xpop);
18
18
 
19
19
  #endif
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_xpointer.c 739 2009-01-23 03:42:09Z cfis $ */
1
+ /* $Id: ruby_xml_xpointer.c 758 2009-01-25 20:36:03Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -94,13 +94,7 @@ static VALUE rxml_xpointer_range(VALUE class, VALUE rstart, VALUE rend)
94
94
  #endif
95
95
  }
96
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)
97
+ void rxml_init_xpointer(void)
104
98
  {
105
99
  cXMLXPointer = rb_define_class_under(mXML, "XPointer", rb_cObject);
106
100
  rb_define_singleton_method(cXMLXPointer, "range", rxml_xpointer_range, 2);
@@ -1,4 +1,4 @@
1
- /* $Id: ruby_xml_xpointer.h 666 2008-12-07 00:16:50Z cfis $ */
1
+ /* $Id: ruby_xml_xpointer.h 758 2009-01-25 20:36:03Z cfis $ */
2
2
 
3
3
  /* Please see the LICENSE file for copyright and distribution information */
4
4
 
@@ -7,7 +7,7 @@
7
7
 
8
8
  extern VALUE cXMLXPointer;
9
9
 
10
- void ruby_init_xml_xpointer(void);
10
+ void rxml_init_xpointer(void);
11
11
  VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str);
12
12
 
13
13
  #endif
@@ -1,7 +1,9 @@
1
1
  
2
2
  Microsoft Visual Studio Solution File, Format Version 10.00
3
3
  # Visual Studio 2008
4
- Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml_ruby", "libxml_ruby.vcproj", "{0B65CD1D-EEB9-41AE-93BB-75496E504152}"
4
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml_ruby", "libxml_ruby_18\libxml_ruby.vcproj", "{0B65CD1D-EEB9-41AE-93BB-75496E504152}"
5
+ EndProject
6
+ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libxml_ruby_19", "libxml_ruby_19\libxml_ruby_19.vcproj", "{0E73156F-E619-4FD9-8327-113FE3CC942E}"
5
7
  EndProject
6
8
  Global
7
9
  GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -13,6 +15,10 @@ Global
13
15
  {0B65CD1D-EEB9-41AE-93BB-75496E504152}.Debug|Win32.Build.0 = Debug|Win32
14
16
  {0B65CD1D-EEB9-41AE-93BB-75496E504152}.Release|Win32.ActiveCfg = Release|Win32
15
17
  {0B65CD1D-EEB9-41AE-93BB-75496E504152}.Release|Win32.Build.0 = Release|Win32
18
+ {0E73156F-E619-4FD9-8327-113FE3CC942E}.Debug|Win32.ActiveCfg = Debug|Win32
19
+ {0E73156F-E619-4FD9-8327-113FE3CC942E}.Debug|Win32.Build.0 = Debug|Win32
20
+ {0E73156F-E619-4FD9-8327-113FE3CC942E}.Release|Win32.ActiveCfg = Release|Win32
21
+ {0E73156F-E619-4FD9-8327-113FE3CC942E}.Release|Win32.Build.0 = Release|Win32
16
22
  EndGlobalSection
17
23
  GlobalSection(SolutionProperties) = preSolution
18
24
  HideSolutionNode = FALSE
@@ -1,6 +1,3 @@
1
- # $Id: libxml.rb 710 2009-01-20 05:30:51Z cfis $
2
- # Please see the LICENSE file for copyright and distribution information
3
-
4
1
  # If running on Windows, then add the current directory to the PATH
5
2
  # for the current process so it can find the pre-built libxml2 and
6
3
  # iconv2 shared libraries (dlls).
@@ -30,12 +27,4 @@ require 'libxml/sax_callbacks'
30
27
  require 'libxml/xpath_object'
31
28
 
32
29
  # Deprecated
33
- require 'libxml/properties'
34
-
35
- # Map the LibXML module into the XML module for both backwards
36
- # compatibility and ease of use.
37
- #
38
- # DEPRECATED: Use require 'xml' instead!
39
- #
40
- # include LibXML
41
-
30
+ require 'libxml/properties'
@@ -1,6 +1,3 @@
1
- # $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $
2
- # Please see the LICENSE file for copyright and distribution information
3
-
4
1
  module LibXML
5
2
  module XML
6
3
  class Attr
@@ -1,6 +1,3 @@
1
- # $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $
2
- # Please see the LICENSE file for copyright and distribution information
3
-
4
1
  module LibXML
5
2
  module XML
6
3
  class AttrDecl
@@ -1,6 +1,3 @@
1
- # $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $
2
- # Please see the LICENSE file for copyright and distribution information
3
-
4
1
  module LibXML
5
2
  module XML
6
3
  class Attributes
@@ -114,9 +114,7 @@ module LibXML
114
114
  # nodes.each do |node|
115
115
  # ... do stuff ...
116
116
  # end
117
- #
118
- # nodes = nil
119
- # GC.start
117
+ # # nodes = nil # GC.start
120
118
  def find(xpath, nslist = nil)
121
119
  self.context(nslist).find(xpath)
122
120
  end
@@ -127,9 +125,37 @@ module LibXML
127
125
  def find_first(xpath, nslist = nil)
128
126
  find(xpath, nslist).first
129
127
  end
130
-
128
+
129
+ # Returns this node's type name
130
+ def node_type_name
131
+ case node_type
132
+ when XML::Node::DOCUMENT_NODE
133
+ 'document_xml'
134
+ when XML::Node::DOCB_DOCUMENT_NODE
135
+ 'document_docbook'
136
+ when XML::Node::HTML_DOCUMENT_NODE
137
+ 'document_html'
138
+ else
139
+ raise(UnknownType, "Unknown node type: %n", node.node_type);
140
+ end
141
+ end
131
142
  # :enddoc:
132
143
 
144
+ # Specifies if this is an DOCTYPE node
145
+ def document?
146
+ node_type == XML::Node::DOCUMENT_NODE
147
+ end
148
+
149
+ # Specifies if this is an docbook node
150
+ def docbook_doc?
151
+ node_type == XML::Node::DOCB_DOCUMENT_NODE
152
+ end
153
+
154
+ # Specifies if this is an html node
155
+ def html_doc?
156
+ node_type == XML::Node::HTML_DOCUMENT_NODE
157
+ end
158
+
133
159
  def dump
134
160
  warn('Document#dump is deprecated. Use Document#to_s instead.')
135
161
  self.to_s
@@ -161,4 +187,4 @@ module LibXML
161
187
  end
162
188
  end
163
189
  end
164
- end
190
+ end
@@ -71,11 +71,15 @@ module LibXML
71
71
  end
72
72
 
73
73
  def to_s
74
- msg = super
75
- msg = msg ? msg.strip: ''
74
+ msg = super
75
+ msg = msg ? msg.strip: ''
76
76
 
77
- sprintf("%s %s at %s:%d.", self.level_to_s, msg,
78
- self.file, self.line)
77
+ if self.line
78
+ sprintf("%s %s at %s:%d.", self.level_to_s, msg,
79
+ self.file, self.line)
80
+ else
81
+ sprintf("%s %s.", self.level_to_s, msg)
82
+ end
79
83
  end
80
84
  end
81
85
  end
@@ -1,8 +1,3 @@
1
- # $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $
2
- # Please see the LICENSE file for copyright and distribution information
3
-
4
-
5
- # This is for backwards compatibility and is DEPRECATED
6
1
  module LibXML
7
2
  module XML
8
3
  class Node
@@ -66,19 +66,22 @@ module LibXML
66
66
  module VerboseCallbacks
67
67
  # Called for a CDATA block event.
68
68
  def on_cdata_block(cdata)
69
- STDOUT << "on_cdata_block(" << cdata << ")\n"
69
+ STDOUT << "on_cdata_block" << "\n" <<
70
+ " cdata " << cdata << "\n"
70
71
  STDOUT.flush
71
72
  end
72
73
 
73
74
  # Called for a characters event.
74
75
  def on_characters(chars)
75
- STDOUT << "on_characters(" << chars << ")\n"
76
+ STDOUT << "on_characters" << "\n" <<
77
+ " chars " << chars << "\n"
76
78
  STDOUT.flush
77
79
  end
78
80
 
79
81
  # Called for a comment event.
80
- def on_comment(msg)
81
- STDOUT << "on_comment(" << msg << ")\n"
82
+ def on_comment(comment)
83
+ STDOUT << "on_comment" << "\n" <<
84
+ " comment: " << comment << "\n"
82
85
  STDOUT.flush
83
86
  end
84
87
 
@@ -90,22 +93,25 @@ module LibXML
90
93
 
91
94
  # Called for a end element event.
92
95
  def on_end_element_ns(name, prefix, uri)
93
- STDOUT << "on_end_element(" << name <<
94
- ", prefix: " << prefix <<
95
- ", uri: " << uri <<
96
- ")\n"
96
+ STDOUT << "on_end_element_ns" << "\n" <<
97
+ " name: " << name << "\n" <<
98
+ " prefix: " << prefix << "\n" <<
99
+ " uri: " << uri << "\n"
97
100
  STDOUT.flush
98
101
  end
99
102
 
100
103
  # Called for parser errors.
101
104
  def on_error(error)
102
- STDOUT << "on_error(" << error << ")\n"
105
+ STDOUT << "on_error" << "\n"
106
+ " error " << error << "\n"
103
107
  STDOUT.flush
104
108
  end
105
109
 
106
110
  # Called for an external subset event.
107
111
  def on_external_subset(name, external_id, system_id)
108
- STDOUT << "on_external_subset(" << name << ", " << external_id << ", " << system_id << ")\n"
112
+ STDOUT << "on_external_subset" << "\n"
113
+ " external_id " << external_id << "\n" <<
114
+ " system_id " << system_id << "\n"
109
115
  STDOUT.flush
110
116
  end
111
117
 
@@ -123,7 +129,9 @@ module LibXML
123
129
 
124
130
  # Called for an internal subset event.
125
131
  def on_internal_subset(name, external_id, system_id)
126
- STDOUT << "on_internal_subset(" << name << ", " << external_id << ", " << system_id << ")\n"
132
+ STDOUT << "on_internal_subset" << "\n"
133
+ " external_id " << external_id << "\n" <<
134
+ " system_id " << system_id << "\n"
127
135
  STDOUT.flush
128
136
  end
129
137
 
@@ -135,13 +143,16 @@ module LibXML
135
143
 
136
144
  # Called for an processing instruction event.
137
145
  def on_processing_instruction(target, data)
138
- STDOUT << "on_characters(" << target << ", " << data << ")\n"
146
+ STDOUT << "on_characters" << "\n"
147
+ " target: " << target << "\n" <<
148
+ " data: " << data << "\n"
139
149
  STDOUT.flush
140
150
  end
141
151
 
142
152
  # Called for a reference event.
143
153
  def on_reference(name)
144
- STDOUT << "on_reference(" << name << ")\n"
154
+ STDOUT << "on_reference:" << "\n" <<
155
+ " name:" << name << "\n"
145
156
  STDOUT.flush
146
157
  end
147
158
 
@@ -153,12 +164,12 @@ module LibXML
153
164
 
154
165
  # Called for a start element event.
155
166
  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"
167
+ STDOUT << "on_start_element_ns" << "\n" <<
168
+ " name: " << name << "\n" <<
169
+ " attr: " << (attributes || Hash.new).inspect << "\n" <<
170
+ " prefix: " << prefix << "\n" <<
171
+ " uri: " << uri << "\n" <<
172
+ " ns_defs: " << (namespaces || Hash.new).inspect << "\n"
162
173
  STDOUT.flush
163
174
  end
164
175
  end
@@ -1,4 +1,3 @@
1
- # This is for backwards compatibility and is DEPRECATED
2
1
  module LibXML
3
2
  module XML
4
3
  class Tree # :nodoc:
@@ -4,19 +4,6 @@ module LibXML
4
4
  class Object
5
5
  alias :size :length
6
6
 
7
- def first
8
- self[0]
9
- end
10
-
11
- def empty?
12
- self.length == 0
13
- end
14
-
15
- def debug
16
- warn("XPath::Object#debug is no longer available.")
17
- self
18
- end
19
-
20
7
  def set
21
8
  warn("XPath::Object#set is deprecated. Simply use the XPath::Object API instead")
22
9
  self
@@ -0,0 +1,8 @@
1
+ <!ELEMENT definition (primary_key|body|reasoning|products)* >
2
+ <!ATTLIST definition target_entity CDATA #REQUIRED>
3
+ <!ELEMENT primary_key (#PCDATA)>
4
+ <!ATTLIST primary_key name CDATA #REQUIRED>
5
+ <!ELEMENT body (#PCDATA)>
6
+ <!ELEMENT reasoning (#PCDATA)>
7
+ <!ELEMENT products (product*)>
8
+ <!ENTITY % product SYSTEM "lib/dtds/product.dtd"> %product;