libxml-ruby 0.8.3-x86-mswin32-60 → 0.9.0-x86-mswin32-60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGES +18 -0
- data/RAKEFILE +15 -39
- data/README +48 -47
- data/ext/libxml/libxml.c +847 -22
- data/ext/libxml/ruby_libxml.h +71 -95
- data/ext/libxml/ruby_xml_attr.c +500 -500
- data/ext/libxml/ruby_xml_attributes.c +1 -1
- data/ext/libxml/ruby_xml_document.c +1144 -1135
- data/ext/libxml/ruby_xml_document.h +4 -11
- data/ext/libxml/ruby_xml_dtd.c +27 -0
- data/ext/libxml/ruby_xml_encoding.c +164 -0
- data/ext/libxml/ruby_xml_encoding.h +13 -0
- data/ext/libxml/ruby_xml_error.c +941 -0
- data/ext/libxml/ruby_xml_error.h +13 -0
- data/ext/libxml/ruby_xml_html_parser.c +71 -387
- data/ext/libxml/ruby_xml_html_parser.h +1 -17
- data/ext/libxml/ruby_xml_input.c +179 -0
- data/ext/libxml/ruby_xml_input.h +18 -0
- data/ext/libxml/ruby_xml_input_cbg.c +17 -3
- data/ext/libxml/ruby_xml_node.c +1566 -1582
- data/ext/libxml/ruby_xml_node.h +1 -4
- data/ext/libxml/ruby_xml_ns.c +14 -3
- data/ext/libxml/ruby_xml_parser.c +164 -1398
- data/ext/libxml/ruby_xml_parser.h +5 -17
- data/ext/libxml/ruby_xml_parser_context.c +131 -169
- data/ext/libxml/ruby_xml_parser_context.h +2 -9
- data/ext/libxml/ruby_xml_reader.c +910 -945
- data/ext/libxml/ruby_xml_relaxng.c +32 -3
- data/ext/libxml/ruby_xml_sax_parser.c +106 -364
- data/ext/libxml/ruby_xml_sax_parser.h +1 -37
- data/ext/libxml/ruby_xml_schema.c +174 -145
- data/ext/libxml/ruby_xml_xinclude.c +9 -5
- data/ext/libxml/ruby_xml_xpath.c +25 -6
- data/ext/libxml/ruby_xml_xpath.h +1 -2
- data/ext/libxml/ruby_xml_xpath_context.c +17 -19
- data/ext/libxml/ruby_xml_xpath_object.c +60 -56
- data/ext/libxml/ruby_xml_xpointer.c +11 -5
- data/ext/libxml/sax_parser_callbacks.inc +42 -37
- data/ext/libxml/version.h +3 -3
- data/ext/mingw/Rakefile +20 -27
- data/ext/mingw/build.rake +41 -0
- data/{lib → ext/mingw}/libiconv-2.dll +0 -0
- data/ext/mingw/libxml2-2.dll +0 -0
- data/ext/mingw/libxml_ruby.dll.a +0 -0
- data/ext/mingw/libxml_ruby.so +0 -0
- data/ext/vc/libxml_ruby.vcproj +23 -15
- data/lib/libxml.rb +8 -2
- data/lib/libxml/document.rb +16 -4
- data/lib/libxml/error.rb +84 -0
- data/lib/libxml/hpricot.rb +76 -0
- data/lib/libxml/html_parser.rb +61 -0
- data/lib/libxml/node.rb +36 -25
- data/lib/libxml/parser.rb +312 -33
- data/lib/libxml/parser_context.rb +17 -0
- data/lib/libxml/properties.rb +15 -2
- data/lib/libxml/reader.rb +15 -0
- data/lib/libxml/sax_callbacks.rb +179 -0
- data/lib/libxml/sax_parser.rb +42 -0
- data/lib/libxml/tree.rb +1 -2
- data/lib/libxml/xpath_object.rb +12 -0
- data/test/model/atom.xml +4 -0
- data/test/tc_attributes.rb +43 -19
- data/test/tc_document.rb +1 -1
- data/test/tc_document_write.rb +15 -8
- data/test/tc_dtd.rb +36 -20
- data/test/tc_encoding.rb +13 -0
- data/test/tc_error.rb +136 -0
- data/test/tc_node.rb +2 -3
- data/test/tc_node_copy.rb +1 -1
- data/test/tc_node_edit.rb +6 -0
- data/test/tc_ns.rb +18 -0
- data/test/tc_parser.rb +113 -228
- data/test/tc_parser_context.rb +1 -2
- data/test/tc_reader.rb +24 -14
- data/test/tc_relaxng.rb +18 -6
- data/test/tc_sax_parser.rb +48 -13
- data/test/tc_schema.rb +20 -8
- data/test/tc_well_formed.rb +2 -1
- data/test/tc_xml.rb +212 -0
- data/test/tc_xpath.rb +60 -46
- data/test/tc_xpointer.rb +7 -11
- data/test/test_suite.rb +4 -3
- metadata +32 -115
- data/doc/rdoc/classes/LibXML.html +0 -241
- data/doc/rdoc/classes/LibXML/XML.html +0 -185
- data/doc/rdoc/classes/LibXML/XML/Attr.html +0 -1010
- data/doc/rdoc/classes/LibXML/XML/Attributes.html +0 -526
- data/doc/rdoc/classes/LibXML/XML/Document.html +0 -1489
- data/doc/rdoc/classes/LibXML/XML/Dtd.html +0 -213
- data/doc/rdoc/classes/LibXML/XML/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/HTMLParser.html +0 -348
- data/doc/rdoc/classes/LibXML/XML/InputCallbacks.html +0 -160
- data/doc/rdoc/classes/LibXML/XML/NS.html +0 -381
- data/doc/rdoc/classes/LibXML/XML/Node.html +0 -3396
- data/doc/rdoc/classes/LibXML/XML/Node/FailedModify.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/Set.html +0 -440
- data/doc/rdoc/classes/LibXML/XML/Node/SetNamespace.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Node/UnknownType.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Parser.html +0 -2239
- data/doc/rdoc/classes/LibXML/XML/Parser/Context.html +0 -1255
- data/doc/rdoc/classes/LibXML/XML/Parser/ParseError.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/Reader.html +0 -2264
- data/doc/rdoc/classes/LibXML/XML/RelaxNG.html +0 -237
- data/doc/rdoc/classes/LibXML/XML/SaxParser.html +0 -415
- data/doc/rdoc/classes/LibXML/XML/Schema.html +0 -308
- data/doc/rdoc/classes/LibXML/XML/State.html +0 -124
- data/doc/rdoc/classes/LibXML/XML/Tree.html +0 -111
- data/doc/rdoc/classes/LibXML/XML/XInclude.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XInclude/Error.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XMLParserOptions.html +0 -198
- data/doc/rdoc/classes/LibXML/XML/XPath.html +0 -184
- data/doc/rdoc/classes/LibXML/XML/XPath/Context.html +0 -404
- data/doc/rdoc/classes/LibXML/XML/XPath/InvalidPath.html +0 -172
- data/doc/rdoc/classes/LibXML/XML/XPath/Object.html +0 -627
- data/doc/rdoc/classes/LibXML/XML/XPointer.html +0 -170
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context.html +0 -123
- data/doc/rdoc/classes/LibXML/XML/XPointer/Context/InvalidPath.html +0 -117
- data/doc/rdoc/classes/LibXML/XML/XPointer/InvalidExpression.html +0 -124
- data/doc/rdoc/classes/singleton.html +0 -114
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/CHANGES.html +0 -442
- data/doc/rdoc/files/LICENSE.html +0 -133
- data/doc/rdoc/files/README.html +0 -388
- data/doc/rdoc/files/VERSION.html +0 -107
- data/doc/rdoc/files/ext/libxml/cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/libxml_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attr_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_attributes_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_document_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_dtd_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_html_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_input_cbg_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_node_set_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_ns_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_parser_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_reader_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_relaxng_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_sax_parser_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_schema_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_state_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xinclude_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_context_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpath_object_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_c.html +0 -101
- data/doc/rdoc/files/ext/libxml/ruby_xml_xpointer_context_c.html +0 -101
- data/doc/rdoc/files/lib/libxml/attr_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/attributes_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/document_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/node_set_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/parser_options_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml/parser_rb.html +0 -101
- data/doc/rdoc/files/lib/libxml/properties_rb.html +0 -108
- data/doc/rdoc/files/lib/libxml/tree_rb.html +0 -107
- data/doc/rdoc/files/lib/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml/libxml_rb.html +0 -124
- data/doc/rdoc/files/lib/xml_rb.html +0 -134
- data/doc/rdoc/fr_class_index.html +0 -62
- data/doc/rdoc/fr_file_index.html +0 -66
- data/doc/rdoc/fr_method_index.html +0 -392
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
- data/ext/libxml/ruby_xml_node_set.c +0 -172
- data/ext/libxml/ruby_xml_node_set.h +0 -20
- data/ext/libxml/ruby_xml_xpointer_context.c +0 -22
- data/ext/libxml/ruby_xml_xpointer_context.h +0 -18
- data/lib/libxml/node_set.rb +0 -27
- data/lib/libxml2-2.dll +0 -0
- data/lib/libxml_ruby.dll.a +0 -0
- data/lib/libxml_ruby.so +0 -0
- data/test/tc_node_set.rb +0 -24
- data/test/tc_node_set2.rb +0 -37
@@ -0,0 +1,17 @@
|
|
1
|
+
# $Id: libxml.rb 374 2008-07-11 04:51:41Z cfis $
|
2
|
+
|
3
|
+
module LibXML
|
4
|
+
module XML
|
5
|
+
class Parser
|
6
|
+
class Context
|
7
|
+
def options
|
8
|
+
warn("ParserContext#options has been removed from the bindings")
|
9
|
+
end
|
10
|
+
|
11
|
+
def options=(value)
|
12
|
+
warn("ParserContext#options has been removed from the bindings")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
data/lib/libxml/properties.rb
CHANGED
@@ -6,8 +6,21 @@
|
|
6
6
|
module LibXML
|
7
7
|
module XML
|
8
8
|
class Node
|
9
|
-
|
10
|
-
|
9
|
+
def property(name)
|
10
|
+
warn('Node#properties is deprecated. Use Node#[] instead.')
|
11
|
+
self[name]
|
12
|
+
end
|
13
|
+
|
14
|
+
def properties
|
15
|
+
warn('Node#properties is deprecated. Use Node#attributes instead.')
|
16
|
+
self.attributes
|
17
|
+
end
|
18
|
+
|
19
|
+
def properties?
|
20
|
+
warn('Node#properties? is deprecated. Use Node#attributes? instead.')
|
21
|
+
self.attributes?
|
22
|
+
end
|
11
23
|
end
|
24
|
+
|
12
25
|
end
|
13
26
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module LibXML
|
2
|
+
module XML
|
3
|
+
class Reader
|
4
|
+
def reset_error_handler
|
5
|
+
warn('reset_error_handler is deprecated. Use Error.reset_handler instead')
|
6
|
+
Error.reset_handler
|
7
|
+
end
|
8
|
+
|
9
|
+
def set_error_handler(&block)
|
10
|
+
warn('set_error_handler is deprecated. Use Error.set_handler instead')
|
11
|
+
Error.set_handler(&block)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,179 @@
|
|
1
|
+
module LibXML
|
2
|
+
module XML
|
3
|
+
class SaxParser
|
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
|
15
|
+
end
|
16
|
+
|
17
|
+
# Called for an external subset notification event.
|
18
|
+
def on_has_external_subset
|
19
|
+
end
|
20
|
+
|
21
|
+
# Called for a start document event.
|
22
|
+
def on_start_document
|
23
|
+
end
|
24
|
+
|
25
|
+
# Called for a end document event.
|
26
|
+
def on_end_document
|
27
|
+
end
|
28
|
+
|
29
|
+
# Called for a start element event.
|
30
|
+
def on_start_element(name, attributes_hash)
|
31
|
+
end
|
32
|
+
|
33
|
+
# Called for a end element event.
|
34
|
+
def on_end_element(name)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Called for a reference event.
|
38
|
+
def on_reference(name)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Called for a characters event.
|
42
|
+
def on_characters(chars)
|
43
|
+
end
|
44
|
+
|
45
|
+
# Called for an processing instruction event.
|
46
|
+
def on_processing_instruction(target, data)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Called for a comment event.
|
50
|
+
def on_comment(msg)
|
51
|
+
end
|
52
|
+
|
53
|
+
# Called for parser warnings.
|
54
|
+
def on_parser_warning(msg)
|
55
|
+
end
|
56
|
+
|
57
|
+
# Called for parser errors.
|
58
|
+
def on_parser_error(msg)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Called for fatal parser errors.
|
62
|
+
def on_parser_fatal_error(msg)
|
63
|
+
end
|
64
|
+
|
65
|
+
# Called for a CDATA block event.
|
66
|
+
def on_cdata_block(cdata)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Called for an external subset event.
|
70
|
+
def on_external_subset(name, external_id, system_id)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
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"
|
90
|
+
STDOUT.flush
|
91
|
+
end
|
92
|
+
|
93
|
+
# Called for an external subset notification event.
|
94
|
+
def on_has_external_subset
|
95
|
+
STDOUT << "on_has_internal_subset\n"
|
96
|
+
STDOUT.flush
|
97
|
+
end
|
98
|
+
|
99
|
+
# Called for a start document event.
|
100
|
+
def on_start_document
|
101
|
+
STDOUT << "on_start_document\n"
|
102
|
+
STDOUT.flush
|
103
|
+
end
|
104
|
+
|
105
|
+
# Called for a end document event.
|
106
|
+
def on_end_document
|
107
|
+
STDOUT << "on_end_document\n"
|
108
|
+
STDOUT.flush
|
109
|
+
end
|
110
|
+
|
111
|
+
# Called for a start element event.
|
112
|
+
def on_start_element(name, attributes_hash)
|
113
|
+
STDOUT << "on_start_element(" << name << ", " << attributes_hash << ")\n"
|
114
|
+
STDOUT.flush
|
115
|
+
end
|
116
|
+
|
117
|
+
# Called for a end element event.
|
118
|
+
def on_end_element(name)
|
119
|
+
STDOUT << "on_end_element(" << name << ")\n"
|
120
|
+
STDOUT.flush
|
121
|
+
end
|
122
|
+
|
123
|
+
# Called for a reference event.
|
124
|
+
def on_reference(name)
|
125
|
+
STDOUT << "on_reference(" << name << ")\n"
|
126
|
+
STDOUT.flush
|
127
|
+
end
|
128
|
+
|
129
|
+
# Called for a characters event.
|
130
|
+
def on_characters(chars)
|
131
|
+
STDOUT << "on_characters(" << chars << ")\n"
|
132
|
+
STDOUT.flush
|
133
|
+
end
|
134
|
+
|
135
|
+
# Called for an processing instruction event.
|
136
|
+
def on_processing_instruction(target, data)
|
137
|
+
STDOUT << "on_characters(" << target << ", " << data << ")\n"
|
138
|
+
STDOUT.flush
|
139
|
+
end
|
140
|
+
|
141
|
+
# Called for a comment event.
|
142
|
+
def on_comment(msg)
|
143
|
+
STDOUT << "on_comment(" << msg << ")\n"
|
144
|
+
STDOUT.flush
|
145
|
+
end
|
146
|
+
|
147
|
+
# Called for parser warnings.
|
148
|
+
def on_parser_warning(msg)
|
149
|
+
STDOUT << "on_parser_warning(" << msg << ")\n"
|
150
|
+
STDOUT.flush
|
151
|
+
end
|
152
|
+
|
153
|
+
# Called for parser errors.
|
154
|
+
def on_parser_error(msg)
|
155
|
+
STDOUT << "on_parser_error(" << msg << ")\n"
|
156
|
+
STDOUT.flush
|
157
|
+
end
|
158
|
+
|
159
|
+
# Called for fatal parser errors.
|
160
|
+
def on_parser_fatal_error(msg)
|
161
|
+
STDOUT << "on_parser_fatal_error(" << msg << ")\n"
|
162
|
+
STDOUT.flush
|
163
|
+
end
|
164
|
+
|
165
|
+
# Called for a CDATA block event.
|
166
|
+
def on_cdata_block(cdata)
|
167
|
+
STDOUT << "on_cdata_block(" << cdata << ")\n"
|
168
|
+
STDOUT.flush
|
169
|
+
end
|
170
|
+
|
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"
|
174
|
+
STDOUT.flush
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module LibXML
|
2
|
+
module XML
|
3
|
+
class SaxParser
|
4
|
+
def filename=(value)
|
5
|
+
warn("SaxParser.filename is deprecated. Use SaxParser#file instead.")
|
6
|
+
self.file = value
|
7
|
+
end
|
8
|
+
|
9
|
+
def file
|
10
|
+
input.file
|
11
|
+
end
|
12
|
+
|
13
|
+
def file=(value)
|
14
|
+
input.file = value
|
15
|
+
end
|
16
|
+
|
17
|
+
def string
|
18
|
+
input.string
|
19
|
+
end
|
20
|
+
|
21
|
+
def string=(value)
|
22
|
+
input.string = value
|
23
|
+
end
|
24
|
+
|
25
|
+
def document
|
26
|
+
input.document
|
27
|
+
end
|
28
|
+
|
29
|
+
def document=(value)
|
30
|
+
input.document = value
|
31
|
+
end
|
32
|
+
|
33
|
+
def io
|
34
|
+
input.io
|
35
|
+
end
|
36
|
+
|
37
|
+
def io=(value)
|
38
|
+
input.io = value
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/libxml/tree.rb
CHANGED
data/test/model/atom.xml
ADDED
data/test/tc_attributes.rb
CHANGED
@@ -2,7 +2,7 @@ require 'xml'
|
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
4
|
class AttributesTest < Test::Unit::TestCase
|
5
|
-
def setup
|
5
|
+
def setup
|
6
6
|
xp = XML::Parser.string(<<-EOS)
|
7
7
|
<CityModel
|
8
8
|
xmlns="http://www.opengis.net/examples"
|
@@ -22,7 +22,7 @@ class AttributesTest < Test::Unit::TestCase
|
|
22
22
|
@doc = xp.parse
|
23
23
|
end
|
24
24
|
|
25
|
-
def teardown
|
25
|
+
def teardown
|
26
26
|
@doc = nil
|
27
27
|
end
|
28
28
|
|
@@ -35,7 +35,7 @@ class AttributesTest < Test::Unit::TestCase
|
|
35
35
|
assert_instance_of(XML::Attributes, attributes)
|
36
36
|
assert_equal(5, attributes.length)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
def test_each
|
40
40
|
attributes = city_member.attributes
|
41
41
|
length = attributes.inject(0) do |result, attr|
|
@@ -47,60 +47,84 @@ class AttributesTest < Test::Unit::TestCase
|
|
47
47
|
|
48
48
|
def test_get_attribute
|
49
49
|
attributes = city_member.attributes
|
50
|
-
|
50
|
+
|
51
51
|
attr = attributes.get_attribute('name')
|
52
52
|
assert_instance_of(XML::Attr, attr)
|
53
|
-
|
53
|
+
|
54
54
|
attr = attributes.get_attribute('does_not_exist')
|
55
55
|
assert_nil(attr)
|
56
|
-
|
56
|
+
|
57
57
|
attr = attributes.get_attribute('name')
|
58
58
|
assert_instance_of(XML::Attr, attr)
|
59
|
-
|
59
|
+
|
60
60
|
attr = attributes.get_attribute('href')
|
61
61
|
assert_instance_of(XML::Attr, attr)
|
62
62
|
assert_instance_of(XML::NS, attr.ns)
|
63
63
|
assert_equal('xlink', attr.ns.prefix)
|
64
64
|
assert_equal('http://www.w3.org/1999/xlink', attr.ns.href)
|
65
|
-
|
65
|
+
|
66
66
|
attr = attributes.get_attribute_ns('http://www.w3.org/1999/xlink', 'href')
|
67
67
|
assert_instance_of(XML::Attr, attr)
|
68
|
-
|
68
|
+
|
69
69
|
attr = attributes.get_attribute_ns('http://www.opengis.net/gml', 'remoteSchema')
|
70
70
|
assert_instance_of(XML::Attr, attr)
|
71
|
-
|
71
|
+
|
72
72
|
attr = attributes.get_attribute_ns('http://i.dont.exist', 'nor do i')
|
73
73
|
assert_nil(attr)
|
74
74
|
end
|
75
|
-
|
75
|
+
|
76
|
+
def test_property
|
77
|
+
attr = city_member.property('name')
|
78
|
+
assert_instance_of(String, attr)
|
79
|
+
assert_equal('Cambridge', attr)
|
80
|
+
end
|
81
|
+
|
76
82
|
def test_get_values
|
77
83
|
assert_equal('Cambridge', city_member[:name])
|
78
84
|
assert_equal('http://www.foo.net/cgi-bin/wfs?FeatureID=C10239', city_member[:href])
|
79
|
-
|
85
|
+
|
80
86
|
attributes = city_member.attributes
|
81
87
|
assert_equal('Cambridge', attributes[:name])
|
82
88
|
assert_equal('http://www.foo.net/cgi-bin/wfs?FeatureID=C10239', attributes[:href])
|
83
89
|
end
|
84
|
-
|
90
|
+
|
85
91
|
def test_set_values
|
86
92
|
city_member[:name] = 'London'
|
87
93
|
assert_equal('London', city_member[:name])
|
88
|
-
|
94
|
+
|
89
95
|
city_member[:href] = 'foo'
|
90
96
|
assert_equal('foo', city_member[:href])
|
91
|
-
|
97
|
+
|
92
98
|
attributes = city_member.attributes
|
93
|
-
|
99
|
+
|
94
100
|
attributes[:name] = 'London'
|
95
101
|
assert_equal('London', attributes[:name])
|
96
|
-
|
102
|
+
|
97
103
|
attributes[:href] = 'foo'
|
98
104
|
assert_equal('foo', attributes[:href])
|
99
105
|
end
|
100
|
-
|
106
|
+
|
101
107
|
def test_str_sym()
|
102
108
|
attributes = city_member.attributes
|
103
109
|
assert_equal('Cambridge', attributes[:name])
|
104
110
|
assert_equal('Cambridge', attributes['name'])
|
105
111
|
end
|
106
|
-
|
112
|
+
|
113
|
+
def test_remove_first
|
114
|
+
attributes = @doc.find_first('/city:CityModel/city:cityMember').attributes
|
115
|
+
assert_equal(5, attributes.length)
|
116
|
+
attr = attributes.first
|
117
|
+
attr.remove!
|
118
|
+
assert_equal(4, attributes.length)
|
119
|
+
end
|
120
|
+
|
121
|
+
def test_remove_all
|
122
|
+
node = @doc.find_first('/city:CityModel/city:cityMember')
|
123
|
+
assert_equal(5, node.attributes.length)
|
124
|
+
|
125
|
+
node.attributes.entries.each do |attr|
|
126
|
+
attr.remove!
|
127
|
+
end
|
128
|
+
assert_equal(0, node.attributes.length)
|
129
|
+
end
|
130
|
+
end
|
data/test/tc_document.rb
CHANGED