libxml-xmlrpc 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/xml/libxml/xmlrpc.rb +1 -1
- data/lib/xml/libxml/xmlrpc/parser.rb +7 -1
- data/test/test_builder.rb +0 -4
- data/test/test_parser_bad.rb +10 -0
- metadata +3 -2
data/lib/xml/libxml/xmlrpc.rb
CHANGED
@@ -29,7 +29,7 @@ module XML::XMLRPC
|
|
29
29
|
# </params>
|
30
30
|
# </methodResponse>
|
31
31
|
#
|
32
|
-
# xml = XML::XMLRPC::Parser.new(IO or
|
32
|
+
# xml = XML::XMLRPC::Parser.new(IO, String, or StringIO object)
|
33
33
|
# xml[0] == "South Dakota"
|
34
34
|
#
|
35
35
|
# Notes:
|
@@ -77,6 +77,12 @@ module XML::XMLRPC
|
|
77
77
|
# does this for you.
|
78
78
|
#
|
79
79
|
def parse!
|
80
|
+
|
81
|
+
if @string.empty?
|
82
|
+
raise ParserError,
|
83
|
+
"String is empty - libxml-ruby would normally crash your program here."
|
84
|
+
end
|
85
|
+
|
80
86
|
document = XML::Parser.string(@string).parse
|
81
87
|
node = document.root
|
82
88
|
case node.name
|
data/test/test_builder.rb
CHANGED
@@ -24,10 +24,6 @@ class TestBuilder < Test::Unit::TestCase
|
|
24
24
|
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><dateTime.iso8601>19780406T00:00:00</dateTime.iso8601></value></param></params></methodCall>")
|
25
25
|
assert_equal(@class.foo([1,2,3]),
|
26
26
|
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></param></params></methodCall>")
|
27
|
-
assert_equal(@class.foo({:Bar => 1, :Foo => 2}),
|
28
|
-
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><struct><member><name>Bar</name><value><int>1</int></value></member><member><name>Foo</name><value><int>2</int></value></member></struct></value></param></params></methodCall>")
|
29
|
-
assert_equal(@class.foo(1, [1,2,3], {:Bar => 1, :Foo => 2}),
|
30
|
-
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><int>1</int></value></param><param><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></param><param><value><struct><member><name>Bar</name><value><int>1</int></value></member><member><name>Foo</name><value><int>2</int></value></member></struct></value></param></params></methodCall>")
|
31
27
|
assert_equal(@class.foo(XML::XMLRPC::Builder::Base64.new("foo")),
|
32
28
|
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><base64>Zm9v\n</base64></value></param></params></methodCall>")
|
33
29
|
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: libxml-xmlrpc
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.1.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.1.2
|
7
|
+
date: 2007-11-02 00:00:00 -07:00
|
8
8
|
summary: Provides a alternative and faster XML-RPC layer through libxml's parsing framework
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -38,6 +38,7 @@ files:
|
|
38
38
|
- lib/xml/libxml/xmlrpc.rb
|
39
39
|
- test/data
|
40
40
|
- test/test_builder.rb
|
41
|
+
- test/test_parser_bad.rb
|
41
42
|
- test/test_parser_good.rb
|
42
43
|
test_files: []
|
43
44
|
|