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.
- data/CHANGES +41 -1
- data/LICENSE +3 -4
- data/README +37 -24
- data/Rakefile +2 -2
- data/ext/libxml/extconf.rb +31 -12
- data/ext/libxml/libxml.c +56 -858
- data/ext/libxml/ruby_libxml.h +93 -96
- data/ext/libxml/ruby_xml.c +855 -0
- data/ext/libxml/ruby_xml.h +9 -0
- data/ext/libxml/ruby_xml_attr.c +3 -9
- data/ext/libxml/ruby_xml_attr.h +2 -2
- data/ext/libxml/ruby_xml_attr_decl.c +2 -8
- data/ext/libxml/ruby_xml_attr_decl.h +1 -1
- data/ext/libxml/ruby_xml_attributes.c +6 -8
- data/ext/libxml/ruby_xml_attributes.h +1 -1
- data/ext/libxml/ruby_xml_document.c +915 -895
- data/ext/libxml/ruby_xml_document.h +2 -2
- data/ext/libxml/ruby_xml_dtd.c +257 -136
- data/ext/libxml/ruby_xml_dtd.h +1 -1
- data/ext/libxml/ruby_xml_encoding.c +55 -37
- data/ext/libxml/ruby_xml_encoding.h +1 -1
- data/ext/libxml/ruby_xml_error.c +526 -1058
- data/ext/libxml/ruby_xml_error.h +1 -1
- data/ext/libxml/ruby_xml_html_parser.c +2 -8
- data/ext/libxml/ruby_xml_html_parser.h +2 -2
- data/ext/libxml/ruby_xml_html_parser_context.c +175 -145
- data/ext/libxml/ruby_xml_html_parser_context.h +1 -1
- data/ext/libxml/ruby_xml_html_parser_options.c +12 -20
- data/ext/libxml/ruby_xml_html_parser_options.h +1 -1
- data/ext/libxml/ruby_xml_input_cbg.c +2 -8
- data/ext/libxml/ruby_xml_input_cbg.h +1 -1
- data/ext/libxml/ruby_xml_namespace.c +2 -8
- data/ext/libxml/ruby_xml_namespace.h +2 -2
- data/ext/libxml/ruby_xml_namespaces.c +1 -9
- data/ext/libxml/ruby_xml_namespaces.h +1 -1
- data/ext/libxml/ruby_xml_node.c +182 -121
- data/ext/libxml/ruby_xml_node.h +2 -2
- data/ext/libxml/ruby_xml_parser.c +2 -8
- data/ext/libxml/ruby_xml_parser.h +2 -2
- data/ext/libxml/ruby_xml_parser_context.c +952 -901
- data/ext/libxml/ruby_xml_parser_context.h +2 -2
- data/ext/libxml/ruby_xml_parser_options.c +2 -9
- data/ext/libxml/ruby_xml_parser_options.h +1 -1
- data/ext/libxml/ruby_xml_reader.c +1002 -993
- data/ext/libxml/ruby_xml_reader.h +1 -1
- data/ext/libxml/ruby_xml_relaxng.c +1 -7
- data/ext/libxml/ruby_xml_relaxng.h +1 -1
- data/ext/libxml/ruby_xml_sax2_handler.c +2 -2
- data/ext/libxml/ruby_xml_sax2_handler.h +1 -1
- data/ext/libxml/ruby_xml_sax_parser.c +2 -8
- data/ext/libxml/ruby_xml_sax_parser.h +2 -2
- data/ext/libxml/ruby_xml_schema.c +1 -7
- data/ext/libxml/ruby_xml_schema.h +1 -1
- data/ext/libxml/{version.h → ruby_xml_version.h} +2 -2
- data/ext/libxml/ruby_xml_xinclude.c +2 -8
- data/ext/libxml/ruby_xml_xinclude.h +2 -2
- data/ext/libxml/ruby_xml_xpath.c +17 -18
- data/ext/libxml/ruby_xml_xpath.h +2 -2
- data/ext/libxml/ruby_xml_xpath_context.c +387 -389
- data/ext/libxml/ruby_xml_xpath_context.h +2 -2
- data/ext/libxml/ruby_xml_xpath_expression.c +18 -8
- data/ext/libxml/ruby_xml_xpath_expression.h +1 -1
- data/ext/libxml/ruby_xml_xpath_object.c +19 -8
- data/ext/libxml/ruby_xml_xpath_object.h +1 -1
- data/ext/libxml/ruby_xml_xpointer.c +2 -8
- data/ext/libxml/ruby_xml_xpointer.h +2 -2
- data/ext/vc/libxml_ruby.sln +7 -1
- data/lib/libxml.rb +1 -12
- data/lib/libxml/attr.rb +0 -3
- data/lib/libxml/attr_decl.rb +0 -3
- data/lib/libxml/attributes.rb +0 -3
- data/lib/libxml/document.rb +31 -5
- data/lib/libxml/error.rb +8 -4
- data/lib/libxml/properties.rb +0 -5
- data/lib/libxml/sax_callbacks.rb +30 -19
- data/lib/libxml/tree.rb +0 -1
- data/lib/libxml/xpath_object.rb +0 -13
- data/test/model/definition.dtd +8 -0
- data/test/tc_attributes.rb +4 -1
- data/test/tc_document.rb +16 -0
- data/test/tc_dtd.rb +30 -2
- data/test/tc_html_parser.rb +55 -10
- data/test/tc_node.rb +67 -1
- data/test/tc_node_edit.rb +26 -6
- data/test/tc_node_text.rb +41 -23
- data/test/tc_parser.rb +50 -0
- data/test/tc_reader.rb +15 -0
- data/test/tc_relaxng.rb +1 -1
- data/test/tc_sax_parser.rb +37 -5
- data/test/tc_schema.rb +1 -1
- data/test/tc_xpath.rb +1 -0
- data/test/tc_xpath_expression.rb +4 -2
- metadata +6 -6
- data/ext/libxml/ruby_xml_state.c +0 -51
- data/ext/libxml/ruby_xml_state.h +0 -11
- data/ext/vc/libxml_ruby.vcproj +0 -460
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_xpath_context.h
|
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
|
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
|
-
|
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",
|
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
|
}
|
@@ -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
|
-
|
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);
|
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.c
|
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
|
-
|
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
|
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
|
10
|
+
void rxml_init_xpointer(void);
|
11
11
|
VALUE rxml_xpointer_point2(VALUE node, VALUE xptr_str);
|
12
12
|
|
13
13
|
#endif
|
data/ext/vc/libxml_ruby.sln
CHANGED
@@ -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
|
data/lib/libxml.rb
CHANGED
@@ -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'
|
data/lib/libxml/attr.rb
CHANGED
data/lib/libxml/attr_decl.rb
CHANGED
data/lib/libxml/attributes.rb
CHANGED
data/lib/libxml/document.rb
CHANGED
@@ -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
|
data/lib/libxml/error.rb
CHANGED
@@ -71,11 +71,15 @@ module LibXML
|
|
71
71
|
end
|
72
72
|
|
73
73
|
def to_s
|
74
|
-
|
75
|
-
|
74
|
+
msg = super
|
75
|
+
msg = msg ? msg.strip: ''
|
76
76
|
|
77
|
-
|
78
|
-
|
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
|
data/lib/libxml/properties.rb
CHANGED
data/lib/libxml/sax_callbacks.rb
CHANGED
@@ -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
|
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
|
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(
|
81
|
-
STDOUT << "on_comment
|
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 << "
|
94
|
-
|
95
|
-
|
96
|
-
|
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
|
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
|
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
|
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
|
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
|
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
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
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
|
data/lib/libxml/tree.rb
CHANGED
data/lib/libxml/xpath_object.rb
CHANGED
@@ -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;
|