libxml-ruby 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +9 -0
- data/README +61 -128
- data/doc/css/normal.css +182 -0
- data/doc/img/raze-tiny.png +0 -0
- data/doc/img/red-cube.jpg +0 -0
- data/doc/img/xml-ruby.png +0 -0
- data/doc/index.xml +43 -0
- data/doc/install.xml +77 -0
- data/doc/layout.rhtml +38 -0
- data/doc/layout.xsl +67 -0
- data/doc/license.xml +32 -0
- data/doc/log/changelog.xml +1324 -0
- data/doc/log/changelog.xsl +42 -0
- data/ext/libxml/ruby_xml_document.c +1084 -1057
- data/ext/libxml/ruby_xml_html_parser.c +37 -40
- data/ext/libxml/ruby_xml_input.c +17 -40
- data/ext/libxml/ruby_xml_input.h +2 -2
- data/ext/libxml/ruby_xml_parser.c +151 -151
- data/ext/libxml/ruby_xml_reader.c +910 -893
- data/ext/libxml/ruby_xml_sax_parser.c +174 -174
- data/ext/libxml/ruby_xml_sax_parser.h +12 -12
- data/ext/libxml/ruby_xml_xpointer.h +13 -25
- data/ext/libxml/version.h +2 -2
- data/ext/vc/libxml_ruby.vcproj +1 -1
- data/test/model/ruby-lang.html +238 -0
- data/test/tc_html_parser.rb +2 -12
- data/test/tc_reader.rb +87 -87
- metadata +17 -3
- data/test/test.rb +0 -8
data/test/tc_html_parser.rb
CHANGED
@@ -15,7 +15,7 @@ class HtmlParserTest < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def html_file
|
18
|
-
File.expand_path(File.join(File.dirname(__FILE__), 'model/
|
18
|
+
File.expand_path(File.join(File.dirname(__FILE__), 'model/ruby-lang.html'))
|
19
19
|
end
|
20
20
|
|
21
21
|
# ----- Sources ------
|
@@ -37,7 +37,6 @@ class HtmlParserTest < Test::Unit::TestCase
|
|
37
37
|
|
38
38
|
doc = xp.parse
|
39
39
|
assert_instance_of(XML::Document, doc)
|
40
|
-
assert_instance_of(XML::Parser::Context, xp.context)
|
41
40
|
end
|
42
41
|
|
43
42
|
def test_io
|
@@ -49,7 +48,6 @@ class HtmlParserTest < Test::Unit::TestCase
|
|
49
48
|
|
50
49
|
doc = xp.parse
|
51
50
|
assert_instance_of(XML::Document, doc)
|
52
|
-
assert_instance_of(XML::Parser::Context, xp.context)
|
53
51
|
end
|
54
52
|
end
|
55
53
|
|
@@ -63,7 +61,6 @@ class HtmlParserTest < Test::Unit::TestCase
|
|
63
61
|
|
64
62
|
doc = xp.parse
|
65
63
|
assert_instance_of(XML::Document, doc)
|
66
|
-
assert_instance_of(XML::Parser::Context, xp.context)
|
67
64
|
end
|
68
65
|
|
69
66
|
def test_libxml_html_parser_parse
|
@@ -105,11 +102,4 @@ class HtmlParserTest < Test::Unit::TestCase
|
|
105
102
|
assert_instance_of XML::Node, world
|
106
103
|
assert_equal 'World', world.content
|
107
104
|
end
|
108
|
-
|
109
|
-
def test_libxml_html_parser_context
|
110
|
-
doc = @xp.parse
|
111
|
-
assert_instance_of(XML::Document, doc)
|
112
|
-
assert_instance_of(XML::Parser::Context, @xp.context)
|
113
|
-
assert @xp.context.html?
|
114
|
-
end
|
115
|
-
end
|
105
|
+
end
|
data/test/tc_reader.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'xml'
|
2
2
|
require 'test/unit'
|
3
3
|
|
4
|
-
class
|
4
|
+
class TestReader < Test::Unit::TestCase
|
5
5
|
|
6
6
|
SIMPLE_XML = File.join(File.dirname(__FILE__), 'model/simple.xml')
|
7
7
|
|
@@ -34,75 +34,75 @@ class TextReader < Test::Unit::TestCase
|
|
34
34
|
XML::Reader::TYPE_END_ELEMENT])
|
35
35
|
end
|
36
36
|
|
37
|
-
def test_file
|
38
|
-
reader = XML::Reader.file(SIMPLE_XML)
|
39
|
-
verify_simple(reader)
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_invalid_file
|
43
|
-
assert_raises(RuntimeError) do
|
44
|
-
XML::Reader.file('/does/not/exist')
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_string
|
49
|
-
reader = XML::Reader.string(File.read(SIMPLE_XML))
|
50
|
-
verify_simple(reader)
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_io
|
54
|
-
File.open(SIMPLE_XML, 'rb') do |io|
|
55
|
-
reader = XML::Reader.io(io)
|
56
|
-
verify_simple(reader)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_string_io
|
61
|
-
data = File.read(SIMPLE_XML)
|
62
|
-
string_io = StringIO.new(data)
|
63
|
-
reader = XML::Reader.io(string_io)
|
64
|
-
verify_simple(reader)
|
65
|
-
end
|
66
|
-
|
67
|
-
def test_new_walker
|
68
|
-
reader = XML::Reader.walker(XML::Document.file(SIMPLE_XML))
|
69
|
-
verify_simple(reader)
|
70
|
-
end
|
71
|
-
|
72
|
-
def test_deprecated_error_handler
|
73
|
-
called = false
|
74
|
-
reader = XML::Reader.new('<foo blah')
|
75
|
-
reader.set_error_handler do |error|
|
76
|
-
called = true
|
77
|
-
end
|
78
|
-
|
79
|
-
reader.read
|
80
|
-
assert(called)
|
81
|
-
end
|
82
|
-
|
83
|
-
def test_deprecated_reset_error_handler
|
84
|
-
called = false
|
85
|
-
reader = XML::Reader.new('<foo blah')
|
86
|
-
reader.set_error_handler do |error|
|
87
|
-
called = true
|
88
|
-
end
|
89
|
-
reader.reset_error_handler
|
90
|
-
|
91
|
-
reader.read
|
92
|
-
assert(!called)
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_attr
|
96
|
-
parser = XML::Reader.new("<foo x='1' y='2'/>")
|
97
|
-
assert_equal(1, parser.read)
|
98
|
-
assert_equal('foo', parser.name)
|
99
|
-
assert_equal('1', parser['x'])
|
100
|
-
assert_equal('1', parser[0])
|
101
|
-
assert_equal('2', parser['y'])
|
102
|
-
assert_equal('2', parser[1])
|
103
|
-
assert_equal(nil, parser['z'])
|
104
|
-
assert_equal(nil, parser[2])
|
105
|
-
end
|
37
|
+
# def test_file
|
38
|
+
# reader = XML::Reader.file(SIMPLE_XML)
|
39
|
+
# verify_simple(reader)
|
40
|
+
# end
|
41
|
+
#
|
42
|
+
# def test_invalid_file
|
43
|
+
# assert_raises(RuntimeError) do
|
44
|
+
# XML::Reader.file('/does/not/exist')
|
45
|
+
# end
|
46
|
+
# end
|
47
|
+
#
|
48
|
+
# def test_string
|
49
|
+
# reader = XML::Reader.string(File.read(SIMPLE_XML))
|
50
|
+
# verify_simple(reader)
|
51
|
+
# end
|
52
|
+
#
|
53
|
+
# def test_io
|
54
|
+
# File.open(SIMPLE_XML, 'rb') do |io|
|
55
|
+
# reader = XML::Reader.io(io)
|
56
|
+
# verify_simple(reader)
|
57
|
+
# end
|
58
|
+
# end
|
59
|
+
#
|
60
|
+
# def test_string_io
|
61
|
+
# data = File.read(SIMPLE_XML)
|
62
|
+
# string_io = StringIO.new(data)
|
63
|
+
# reader = XML::Reader.io(string_io)
|
64
|
+
# verify_simple(reader)
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# def test_new_walker
|
68
|
+
# reader = XML::Reader.walker(XML::Document.file(SIMPLE_XML))
|
69
|
+
# verify_simple(reader)
|
70
|
+
# end
|
71
|
+
#
|
72
|
+
# def test_deprecated_error_handler
|
73
|
+
# called = false
|
74
|
+
# reader = XML::Reader.new('<foo blah')
|
75
|
+
# reader.set_error_handler do |error|
|
76
|
+
# called = true
|
77
|
+
# end
|
78
|
+
#
|
79
|
+
# reader.read
|
80
|
+
# assert(called)
|
81
|
+
# end
|
82
|
+
#
|
83
|
+
# def test_deprecated_reset_error_handler
|
84
|
+
# called = false
|
85
|
+
# reader = XML::Reader.new('<foo blah')
|
86
|
+
# reader.set_error_handler do |error|
|
87
|
+
# called = true
|
88
|
+
# end
|
89
|
+
# reader.reset_error_handler
|
90
|
+
#
|
91
|
+
# reader.read
|
92
|
+
# assert(!called)
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# def test_attr
|
96
|
+
# parser = XML::Reader.new("<foo x='1' y='2'/>")
|
97
|
+
# assert_equal(1, parser.read)
|
98
|
+
# assert_equal('foo', parser.name)
|
99
|
+
# assert_equal('1', parser['x'])
|
100
|
+
# assert_equal('1', parser[0])
|
101
|
+
# assert_equal('2', parser['y'])
|
102
|
+
# assert_equal('2', parser[1])
|
103
|
+
# assert_equal(nil, parser['z'])
|
104
|
+
# assert_equal(nil, parser[2])
|
105
|
+
# end
|
106
106
|
|
107
107
|
def test_value
|
108
108
|
parser = XML::Reader.new("<foo><bar>1</bar><bar>2</bar><bar>3</bar></foo>")
|
@@ -121,21 +121,21 @@ class TextReader < Test::Unit::TestCase
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
def test_expand
|
125
|
-
reader = XML::Reader.file(SIMPLE_XML)
|
126
|
-
reader.read
|
127
|
-
node = reader.expand
|
128
|
-
doc = node.doc
|
129
|
-
reader.close
|
130
|
-
GC.start
|
131
|
-
|
132
|
-
doc.standalone?
|
133
|
-
end
|
134
|
-
|
135
|
-
def test_mode
|
136
|
-
reader = XML::Reader.string('<xml/>')
|
137
|
-
assert_equal(XML::Reader::MODE_INITIAL, reader.read_state)
|
138
|
-
reader.read
|
139
|
-
assert_equal(XML::Reader::MODE_EOF, reader.read_state)
|
140
|
-
end
|
124
|
+
# def test_expand
|
125
|
+
# reader = XML::Reader.file(SIMPLE_XML)
|
126
|
+
# reader.read
|
127
|
+
# node = reader.expand
|
128
|
+
# doc = node.doc
|
129
|
+
# reader.close
|
130
|
+
# GC.start
|
131
|
+
#
|
132
|
+
# doc.standalone?
|
133
|
+
# end
|
134
|
+
#
|
135
|
+
# def test_mode
|
136
|
+
# reader = XML::Reader.string('<xml/>')
|
137
|
+
# assert_equal(XML::Reader::MODE_INITIAL, reader.read_state)
|
138
|
+
# reader.read
|
139
|
+
# assert_equal(XML::Reader::MODE_EOF, reader.read_state)
|
140
|
+
# end
|
141
141
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libxml-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Savage
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-11-
|
12
|
+
date: 2008-11-24 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,6 +27,20 @@ files:
|
|
27
27
|
- LICENSE
|
28
28
|
- CHANGES
|
29
29
|
- setup.rb
|
30
|
+
- doc/css
|
31
|
+
- doc/css/normal.css
|
32
|
+
- doc/img
|
33
|
+
- doc/img/raze-tiny.png
|
34
|
+
- doc/img/red-cube.jpg
|
35
|
+
- doc/img/xml-ruby.png
|
36
|
+
- doc/index.xml
|
37
|
+
- doc/install.xml
|
38
|
+
- doc/layout.rhtml
|
39
|
+
- doc/layout.xsl
|
40
|
+
- doc/license.xml
|
41
|
+
- doc/log
|
42
|
+
- doc/log/changelog.xml
|
43
|
+
- doc/log/changelog.xsl
|
30
44
|
- ext/libxml/cbg.c
|
31
45
|
- ext/libxml/extconf.rb
|
32
46
|
- ext/libxml/libxml.c
|
@@ -119,6 +133,7 @@ files:
|
|
119
133
|
- test/model/books.xml
|
120
134
|
- test/model/default_validation_bug.rb
|
121
135
|
- test/model/merge_bug_data.xml
|
136
|
+
- test/model/ruby-lang.html
|
122
137
|
- test/model/rubynet.xml
|
123
138
|
- test/model/rubynet_project
|
124
139
|
- test/model/saxtest.xml
|
@@ -161,7 +176,6 @@ files:
|
|
161
176
|
- test/tc_xpath_context.rb
|
162
177
|
- test/tc_xpath_expression.rb
|
163
178
|
- test/tc_xpointer.rb
|
164
|
-
- test/test.rb
|
165
179
|
- test/test_suite.rb
|
166
180
|
has_rdoc: true
|
167
181
|
homepage: http://libxml.rubyforge.org/
|
data/test/test.rb
DELETED