libxml-ruby 0.3.8.4 → 0.5.0
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/CHANGELOG +6 -0
- data/LICENSE +1 -1
- data/README +1 -1
- data/Rakefile +8 -5
- data/TODO +1 -1
- data/ext/xml/extconf.rb +4 -5
- data/ext/xml/libxml.c +5 -2
- data/ext/xml/libxml.h +16 -7
- data/ext/xml/libxml.rb +3 -3
- data/ext/xml/ruby_xml_attr.c +118 -99
- data/ext/xml/ruby_xml_attr.h +4 -7
- data/ext/xml/ruby_xml_document.c +131 -170
- data/ext/xml/ruby_xml_document.h +5 -9
- data/ext/xml/ruby_xml_html_parser.c +453 -0
- data/ext/xml/ruby_xml_html_parser.h +29 -0
- data/ext/xml/ruby_xml_node.c +219 -253
- data/ext/xml/ruby_xml_node.h +4 -7
- data/ext/xml/ruby_xml_node_set.c +6 -6
- data/ext/xml/ruby_xml_node_set.h +1 -1
- data/ext/xml/ruby_xml_ns.c +1 -1
- data/ext/xml/ruby_xml_ns.h +1 -1
- data/ext/xml/ruby_xml_parser.c +5 -8
- data/ext/xml/ruby_xml_parser.h +1 -1
- data/ext/xml/ruby_xml_parser_context.c +3 -4
- data/ext/xml/ruby_xml_parser_context.h +1 -1
- data/ext/xml/ruby_xml_reader.c +893 -0
- data/ext/xml/ruby_xml_reader.h +14 -0
- data/ext/xml/ruby_xml_sax_parser.c +255 -204
- data/ext/xml/ruby_xml_sax_parser.h +6 -2
- data/ext/xml/ruby_xml_tree.c +1 -1
- data/ext/xml/ruby_xml_tree.h +1 -1
- data/ext/xml/ruby_xml_xinclude.c +1 -1
- data/ext/xml/ruby_xml_xinclude.h +1 -1
- data/ext/xml/ruby_xml_xpath.c +3 -2
- data/ext/xml/ruby_xml_xpath.h +1 -1
- data/ext/xml/ruby_xml_xpath_context.c +4 -4
- data/ext/xml/ruby_xml_xpath_context.h +1 -1
- data/ext/xml/ruby_xml_xpointer.c +10 -4
- data/ext/xml/ruby_xml_xpointer.h +1 -1
- data/ext/xml/ruby_xml_xpointer_context.c +1 -1
- data/ext/xml/ruby_xml_xpointer_context.h +1 -1
- data/ext/xml/sax_parser_callbacks.inc +55 -54
- data/tests/model/rubynet_project +1 -1
- data/tests/model/simple.xml +7 -0
- data/tests/tc_xml_document.rb +1 -1
- data/tests/tc_xml_document_write.rb +1 -1
- data/tests/tc_xml_document_write2.rb +1 -1
- data/tests/tc_xml_document_write3.rb +1 -1
- data/tests/tc_xml_html_parser.rb +60 -0
- data/tests/tc_xml_node.rb +1 -1
- data/tests/tc_xml_node2.rb +1 -1
- data/tests/tc_xml_node3.rb +1 -1
- data/tests/tc_xml_node4.rb +8 -5
- data/tests/tc_xml_node5.rb +1 -1
- data/tests/tc_xml_node6.rb +1 -1
- data/tests/tc_xml_node7.rb +1 -1
- data/tests/tc_xml_node_set.rb +1 -1
- data/tests/tc_xml_node_set2.rb +1 -1
- data/tests/tc_xml_node_xlink.rb +1 -1
- data/tests/tc_xml_parser.rb +5 -1
- data/tests/tc_xml_parser2.rb +1 -1
- data/tests/tc_xml_parser3.rb +1 -1
- data/tests/tc_xml_parser4.rb +1 -1
- data/tests/tc_xml_parser5.rb +1 -1
- data/tests/tc_xml_parser6.rb +1 -1
- data/tests/tc_xml_parser7.rb +1 -1
- data/tests/tc_xml_parser8.rb +1 -1
- data/tests/tc_xml_parser_context.rb +1 -1
- data/tests/tc_xml_reader.rb +101 -0
- data/tests/tc_xml_sax_parser.rb +95 -0
- data/tests/tc_xml_xinclude.rb +1 -1
- data/tests/tc_xml_xpath.rb +1 -1
- data/tests/tc_xml_xpointer.rb +1 -1
- metadata +79 -73
- data/ext/xml/ruby_xml_attribute.c +0 -224
- data/ext/xml/ruby_xml_attribute.h +0 -21
- data/tests/test_xml_sax_parser.rb +0 -64
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/* $Id: ruby_xml_attribute.h,v 1.1 2006/02/21 20:40:16 roscopeco Exp $ */
|
|
2
|
-
|
|
3
|
-
/* Please see the LICENSE file for copyright and distribution information */
|
|
4
|
-
|
|
5
|
-
#ifndef __RUBY_XML_ATTRIBUTE__
|
|
6
|
-
#define __RUBY_XML_ATTRIBUTE__
|
|
7
|
-
|
|
8
|
-
extern VALUE cXMLAttribute;
|
|
9
|
-
|
|
10
|
-
typedef struct ruby_xml_attribute {
|
|
11
|
-
xmlAttributePtr attribute;
|
|
12
|
-
VALUE xd;
|
|
13
|
-
int is_ptr;
|
|
14
|
-
} ruby_xml_attribute;
|
|
15
|
-
|
|
16
|
-
void ruby_xml_attribute_free(ruby_xml_attribute *rxa);
|
|
17
|
-
void ruby_init_xml_attribute(void);
|
|
18
|
-
VALUE ruby_xml_attribute_new(VALUE class, VALUE xd, xmlAttributePtr attribute);
|
|
19
|
-
VALUE ruby_xml_attribute_new2(VALUE class, VALUE xd, xmlAttributePtr attribute);
|
|
20
|
-
VALUE ruby_xml_attribute_name_get(VALUE self);
|
|
21
|
-
#endif
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
# $Id: test_xml_sax_parser.rb,v 1.3 2006/04/17 13:30:17 roscopeco Exp $
|
|
2
|
-
require "libxml_test"
|
|
3
|
-
require 'test/unit'
|
|
4
|
-
|
|
5
|
-
# TODO this is woefully inadequate
|
|
6
|
-
|
|
7
|
-
class TC_XML_Parser < Test::Unit::TestCase
|
|
8
|
-
def setup()
|
|
9
|
-
@xp = XML::SaxParser.new
|
|
10
|
-
@test = Hash.new { |h,k| h[k] = [] }
|
|
11
|
-
|
|
12
|
-
i = 0
|
|
13
|
-
|
|
14
|
-
@xp.on_start_document { @test[:startdoc] << i+=1 }
|
|
15
|
-
@xp.on_start_element { |name, attr_hash| @test[:startel] << [i+=1,name,attr_hash] }
|
|
16
|
-
@xp.on_characters { |chars| @test[:chars] << [i+=1,chars] }
|
|
17
|
-
@xp.on_comment { |msg| @test[:comment] << [i+=1,msg] }
|
|
18
|
-
@xp.on_processing_instruction { |target, data| @test[:pinstr] << [i+=1, target, data] }
|
|
19
|
-
@xp.on_cdata_block { |cdata| @test[:cdata] << [i+=1,cdata] }
|
|
20
|
-
@xp.on_end_element { |name| @test[:endel] << [i+=1,name] }
|
|
21
|
-
@xp.on_end_document { @test[:enddoc] << i+=1 }
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
def teardown()
|
|
25
|
-
@xp = nil
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
def test_string_without_callbacks
|
|
29
|
-
xp = XML::SaxParser.new
|
|
30
|
-
xp.string = File.read(File.join(File.dirname(__FILE__), 'model/saxtest.xml'))
|
|
31
|
-
assert_equal true, xp.parse
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def test_file_without_callbacks
|
|
35
|
-
xp = XML::SaxParser.new
|
|
36
|
-
xp.filename = File.join(File.dirname(__FILE__), 'model/saxtest.xml')
|
|
37
|
-
assert_equal true, xp.parse
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
def test_callbacks_with_string
|
|
41
|
-
@xp.string = File.read(File.join(File.dirname(__FILE__), 'model/saxtest.xml'))
|
|
42
|
-
do_test
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def test_callbacks_with_file
|
|
46
|
-
@xp.filename = File.join(File.dirname(__FILE__), 'model/saxtest.xml')
|
|
47
|
-
do_test
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def do_test
|
|
51
|
-
@xp.parse
|
|
52
|
-
|
|
53
|
-
assert_equal [1], @test[:startdoc]
|
|
54
|
-
assert_equal [[2,'test',{'uga'=>'booga','foo'=>'bar'}],[3,'fixnum',{}],[6,'fixnum',{}]],
|
|
55
|
-
@test[:startel]
|
|
56
|
-
assert_equal [[4,'one'],[7,'two'],[9,"\n "],[11,"\n "],[13,"\n "],[15,"\n"]],
|
|
57
|
-
@test[:chars]
|
|
58
|
-
assert_equal [[10, ' msg ']], @test[:comment]
|
|
59
|
-
assert_equal [[12, 'custom', 'foo="bar"']], @test[:pinstr]
|
|
60
|
-
assert_equal [[14, 'here it goes']], @test[:cdata]
|
|
61
|
-
assert_equal [[5,'fixnum'],[8,'fixnum'],[16,'test']], @test[:endel]
|
|
62
|
-
assert_equal [17], @test[:enddoc]
|
|
63
|
-
end
|
|
64
|
-
end # TC_XML_Sax_Parser
|