libxml-ruby 0.5.1.0 → 0.5.2.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/ext/xml/libxml.c +2 -1
- data/ext/xml/libxml.h +5 -3
- data/ext/xml/libxml.rb +1 -1
- data/ext/xml/ruby_xml_attr.c +13 -33
- data/ext/xml/ruby_xml_document.c +11 -22
- data/ext/xml/ruby_xml_document.h +2 -1
- data/ext/xml/ruby_xml_html_parser.c +3 -6
- data/ext/xml/ruby_xml_html_parser.h +1 -1
- data/ext/xml/ruby_xml_node.c +87 -70
- data/ext/xml/ruby_xml_node.h +2 -1
- data/ext/xml/ruby_xml_node_set.c +32 -111
- data/ext/xml/ruby_xml_node_set.h +5 -11
- 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 +11 -11
- data/ext/xml/ruby_xml_parser.h +1 -1
- data/ext/xml/ruby_xml_parser_context.c +11 -9
- data/ext/xml/ruby_xml_parser_context.h +1 -1
- data/ext/xml/ruby_xml_sax_parser.c +1 -1
- data/ext/xml/ruby_xml_sax_parser.h +1 -1
- data/ext/xml/ruby_xml_state.c +114 -0
- data/ext/xml/ruby_xml_state.h +11 -0
- 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 +117 -231
- data/ext/xml/ruby_xml_xpath.h +4 -5
- data/ext/xml/ruby_xml_xpath_context.c +43 -50
- data/ext/xml/ruby_xml_xpath_context.h +3 -7
- data/ext/xml/ruby_xml_xpath_object.c +246 -0
- data/ext/xml/ruby_xml_xpath_object.h +29 -0
- data/ext/xml/ruby_xml_xpointer.c +8 -14
- 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 +1 -1
- data/tests/tc_xml_document.rb +5 -4
- data/tests/tc_xml_html_parser.rb +7 -4
- data/tests/tc_xml_node.rb +6 -5
- data/tests/tc_xml_node_set.rb +2 -2
- data/tests/tc_xml_node_set2.rb +3 -3
- data/tests/tc_xml_xpath.rb +3 -3
- data/tests/tc_xml_xpointer.rb +2 -2
- metadata +16 -10
data/ext/xml/ruby_xml_xpointer.c
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* $Id: ruby_xml_xpointer.c
|
1
|
+
/* $Id: ruby_xml_xpointer.c 188 2007-09-24 01:43:21Z danj $ */
|
2
2
|
|
3
3
|
/* Please see the LICENSE file for copyright and distribution information */
|
4
4
|
|
@@ -12,7 +12,7 @@ VALUE
|
|
12
12
|
ruby_xml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
13
13
|
#ifdef LIBXML_XPTR_ENABLED
|
14
14
|
ruby_xml_node *node;
|
15
|
-
|
15
|
+
xmlXPathContextPtr ctxt;
|
16
16
|
VALUE rxptr_xpth_ctxt, rxxp;
|
17
17
|
xmlXPathObjectPtr xpath;
|
18
18
|
|
@@ -22,21 +22,17 @@ ruby_xml_xpointer_point(VALUE class, VALUE rnode, VALUE xptr_str) {
|
|
22
22
|
|
23
23
|
Data_Get_Struct(rnode, ruby_xml_node, node);
|
24
24
|
|
25
|
-
rxptr_xpth_ctxt =
|
26
|
-
|
27
|
-
|
25
|
+
rxptr_xpth_ctxt =
|
26
|
+
ruby_xml_xpath_context_wrap(ctxt=xmlXPtrNewContext(node->node->doc, node->node, NULL));
|
27
|
+
|
28
28
|
if (NIL_P(rxptr_xpth_ctxt))
|
29
29
|
return(Qnil);
|
30
|
-
Data_Get_Struct(rxptr_xpth_ctxt, ruby_xml_xpath_context, xxpc);
|
31
30
|
|
32
|
-
xpath = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str),
|
31
|
+
xpath = xmlXPtrEval((xmlChar*)StringValuePtr(xptr_str), ctxt);
|
33
32
|
if (xpath == NULL)
|
34
33
|
rb_raise(eXMLXPointerInvalidExpression, "invalid xpointer expression");
|
35
34
|
|
36
|
-
rxxp =
|
37
|
-
ruby_xml_document_wrap(cXMLDocument,node->node->doc),
|
38
|
-
rxptr_xpth_ctxt
|
39
|
-
, xpath);
|
35
|
+
rxxp = ruby_xml_xpath_object_wrap(xpath);
|
40
36
|
return(rxxp);
|
41
37
|
#else
|
42
38
|
rb_warn("libxml was compiled without XPointer support");
|
@@ -82,9 +78,7 @@ ruby_xml_xpointer_range(VALUE class, VALUE rstart, VALUE rend) {
|
|
82
78
|
if (xpath == NULL)
|
83
79
|
rb_fatal("You shouldn't be able to have this happen");
|
84
80
|
|
85
|
-
rxxp =
|
86
|
-
ruby_xml_document_wrap(cXMLDocument,start->node->doc),
|
87
|
-
Qnil, xpath);
|
81
|
+
rxxp = ruby_xml_xpath_object_wrap(xpath);
|
88
82
|
return(rxxp);
|
89
83
|
#else
|
90
84
|
rb_warn("libxml was compiled without XPointer support");
|
data/ext/xml/ruby_xml_xpointer.h
CHANGED
data/tests/tc_xml_document.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_document.rb
|
1
|
+
# $Id: tc_xml_document.rb 183 2007-09-21 14:09:52Z danj $
|
2
2
|
require 'test/unit'
|
3
3
|
require "libxml_test"
|
4
4
|
|
@@ -18,9 +18,10 @@ class TC_XML_Document < Test::Unit::TestCase
|
|
18
18
|
|
19
19
|
def test_libxml_document_find()
|
20
20
|
set = @doc.find('/ruby_array/fixnum')
|
21
|
-
assert_instance_of(XML::
|
22
|
-
|
23
|
-
|
21
|
+
assert_instance_of(XML::XPath::Object, set)
|
22
|
+
assert_raise(NoMethodError) {
|
23
|
+
xpt = set.xpath
|
24
|
+
}
|
24
25
|
end
|
25
26
|
|
26
27
|
def test_ruby_xml_document_compression()
|
data/tests/tc_xml_html_parser.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_html_parser.rb
|
1
|
+
# $Id: tc_xml_html_parser.rb 182 2007-09-12 14:47:09Z danj $
|
2
2
|
require "libxml_test"
|
3
3
|
require 'test/unit'
|
4
4
|
|
@@ -33,13 +33,16 @@ class TC_XML_HTMLParser < Test::Unit::TestCase
|
|
33
33
|
assert_equal 'meta', meta.name
|
34
34
|
assert_equal 'keywords', meta[:name]
|
35
35
|
assert_equal 'nasty', meta[:content]
|
36
|
-
|
36
|
+
|
37
37
|
body = head.next
|
38
38
|
assert_instance_of XML::Node, body
|
39
39
|
assert_equal 'body', body.name
|
40
40
|
|
41
|
-
hello = body.child
|
42
|
-
|
41
|
+
hello = body.child
|
42
|
+
# It appears that some versions of libxml2 add a layer of <p>
|
43
|
+
# cant figure our why or how, so this skips it if there
|
44
|
+
hello = hello.child if hello.name == "p"
|
45
|
+
|
43
46
|
assert_instance_of XML::Node, hello
|
44
47
|
assert_equal 'Hello', hello.content
|
45
48
|
|
data/tests/tc_xml_node.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_node.rb
|
1
|
+
# $Id: tc_xml_node.rb 191 2007-10-05 14:56:49Z danj $
|
2
2
|
require "libxml_test"
|
3
3
|
require 'test/unit'
|
4
4
|
|
@@ -12,9 +12,10 @@ class TC_XML_Node < Test::Unit::TestCase
|
|
12
12
|
@root = doc.root
|
13
13
|
assert_instance_of(XML::Node, @root)
|
14
14
|
set = doc.find('/ruby_array/fixnum')
|
15
|
-
assert_instance_of(XML::
|
16
|
-
|
17
|
-
|
15
|
+
assert_instance_of(XML::XPath::Object, set)
|
16
|
+
assert_raise(NoMethodError) {
|
17
|
+
xpt = set.xpath
|
18
|
+
}
|
18
19
|
@nodes = []
|
19
20
|
set.each do |n|
|
20
21
|
@nodes.push(n)
|
@@ -50,7 +51,7 @@ class TC_XML_Node < Test::Unit::TestCase
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def test_libxml_node_find()
|
53
|
-
set = @root.find('./fixnum')
|
54
|
+
set = @root.find('./fixnum').set
|
54
55
|
assert_instance_of(XML::Node::Set, set)
|
55
56
|
for node in set
|
56
57
|
assert_instance_of(XML::Node, node)
|
data/tests/tc_xml_node_set.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_node_set.rb
|
1
|
+
# $Id: tc_xml_node_set.rb 183 2007-09-21 14:09:52Z danj $
|
2
2
|
require "libxml_test"
|
3
3
|
require 'test/unit'
|
4
4
|
|
@@ -9,7 +9,7 @@ class TC_XML_Node_Set < Test::Unit::TestCase
|
|
9
9
|
assert_equal(str, xp.string = str)
|
10
10
|
doc = xp.parse
|
11
11
|
assert_instance_of(XML::Document, doc)
|
12
|
-
@set = doc.find('/ruby_array/fixnum')
|
12
|
+
@set = doc.find('/ruby_array/fixnum').set
|
13
13
|
assert_instance_of(XML::Node::Set, @set)
|
14
14
|
end
|
15
15
|
|
data/tests/tc_xml_node_set2.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_node_set2.rb
|
1
|
+
# $Id: tc_xml_node_set2.rb 183 2007-09-21 14:09:52Z danj $
|
2
2
|
require "libxml_test"
|
3
3
|
require 'test/unit'
|
4
4
|
|
@@ -11,8 +11,8 @@ class TC_XML_Node_Set2 < Test::Unit::TestCase
|
|
11
11
|
assert_instance_of(XML::Document, doc)
|
12
12
|
@one = doc.root.child
|
13
13
|
@two = @one.next
|
14
|
-
@set = doc.find('/ruby_array/fixnum')
|
15
|
-
@emptyset = doc.find('/fixnum')
|
14
|
+
@set = doc.find('/ruby_array/fixnum').set
|
15
|
+
@emptyset = doc.find('/fixnum').set
|
16
16
|
assert_instance_of(XML::Node::Set, @set)
|
17
17
|
end
|
18
18
|
|
data/tests/tc_xml_xpath.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_xpath.rb
|
1
|
+
# $Id: tc_xml_xpath.rb 183 2007-09-21 14:09:52Z danj $
|
2
2
|
require "libxml_test"
|
3
3
|
require "test/unit"
|
4
4
|
|
@@ -9,8 +9,8 @@ class TC_XML_XPath < Test::Unit::TestCase
|
|
9
9
|
assert_equal(str, xp.string = str)
|
10
10
|
doc = xp.parse
|
11
11
|
assert_instance_of(XML::Document, doc)
|
12
|
-
@xpt = doc.find('/ruby_array/fixnum')
|
13
|
-
assert_instance_of(XML::XPath, @xpt)
|
12
|
+
@xpt = doc.find('/ruby_array/fixnum')
|
13
|
+
assert_instance_of(XML::XPath::Object, @xpt)
|
14
14
|
end
|
15
15
|
|
16
16
|
def teardown()
|
data/tests/tc_xml_xpointer.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# $Id: tc_xml_xpointer.rb
|
1
|
+
# $Id: tc_xml_xpointer.rb 183 2007-09-21 14:09:52Z danj $
|
2
2
|
require "libxml_test"
|
3
3
|
require "test/unit"
|
4
4
|
|
@@ -21,7 +21,7 @@ class TC_XML_XPointer < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
def test_libxml_xpointer_id()
|
23
23
|
@xptr = @root.pointer('xpointer(id("two"))')
|
24
|
-
assert_instance_of(XML::XPath, @xptr)
|
24
|
+
assert_instance_of(XML::XPath::Object, @xptr)
|
25
25
|
set = @xptr.set
|
26
26
|
assert_instance_of(XML::Node::Set, set)
|
27
27
|
for n in set
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.4
|
3
3
|
specification_version: 1
|
4
4
|
name: libxml-ruby
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2007-
|
6
|
+
version: 0.5.2.0
|
7
|
+
date: 2007-10-10 00:00:00 -04:00
|
8
8
|
summary: LibXML2 bindings for Ruby
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -52,10 +52,12 @@ files:
|
|
52
52
|
- ext/xml/ruby_xml_reader.c
|
53
53
|
- ext/xml/ruby_xml_sax_parser.c
|
54
54
|
- ext/xml/ruby_xml_schema.c
|
55
|
+
- ext/xml/ruby_xml_state.c
|
55
56
|
- ext/xml/ruby_xml_tree.c
|
56
57
|
- ext/xml/ruby_xml_xinclude.c
|
57
58
|
- ext/xml/ruby_xml_xpath.c
|
58
59
|
- ext/xml/ruby_xml_xpath_context.c
|
60
|
+
- ext/xml/ruby_xml_xpath_object.c
|
59
61
|
- ext/xml/ruby_xml_xpointer.c
|
60
62
|
- ext/xml/ruby_xml_xpointer_context.c
|
61
63
|
- ext/xml/sax_parser_callbacks.inc
|
@@ -72,10 +74,12 @@ files:
|
|
72
74
|
- ext/xml/ruby_xml_reader.h
|
73
75
|
- ext/xml/ruby_xml_sax_parser.h
|
74
76
|
- ext/xml/ruby_xml_schema.h
|
77
|
+
- ext/xml/ruby_xml_state.h
|
75
78
|
- ext/xml/ruby_xml_tree.h
|
76
79
|
- ext/xml/ruby_xml_xinclude.h
|
77
80
|
- ext/xml/ruby_xml_xpath.h
|
78
81
|
- ext/xml/ruby_xml_xpath_context.h
|
82
|
+
- ext/xml/ruby_xml_xpath_object.h
|
79
83
|
- ext/xml/ruby_xml_xpointer.h
|
80
84
|
- ext/xml/ruby_xml_xpointer_context.h
|
81
85
|
- ext/xml/libxml.h
|
@@ -83,6 +87,13 @@ files:
|
|
83
87
|
- tests/libxml_test.rb
|
84
88
|
- tests/merge_bug.rb
|
85
89
|
- tests/model
|
90
|
+
- tests/model/default_validation_bug.rb
|
91
|
+
- tests/model/merge_bug_data.xml
|
92
|
+
- tests/model/rubynet.xml
|
93
|
+
- tests/model/rubynet_project
|
94
|
+
- tests/model/saxtest.xml
|
95
|
+
- tests/model/simple.xml
|
96
|
+
- tests/model/xinclude.xml
|
86
97
|
- tests/runner.rb
|
87
98
|
- tests/schema-test.rb
|
88
99
|
- tests/tc_xml_document.rb
|
@@ -116,13 +127,6 @@ files:
|
|
116
127
|
- tests/tc_xml_xinclude.rb
|
117
128
|
- tests/tc_xml_xpath.rb
|
118
129
|
- tests/tc_xml_xpointer.rb
|
119
|
-
- tests/model/default_validation_bug.rb
|
120
|
-
- tests/model/merge_bug_data.xml
|
121
|
-
- tests/model/rubynet.xml
|
122
|
-
- tests/model/rubynet_project
|
123
|
-
- tests/model/saxtest.xml
|
124
|
-
- tests/model/simple.xml
|
125
|
-
- tests/model/xinclude.xml
|
126
130
|
test_files:
|
127
131
|
- tests/runner.rb
|
128
132
|
rdoc_options:
|
@@ -147,10 +151,12 @@ extra_rdoc_files:
|
|
147
151
|
- ext/xml/ruby_xml_reader.c
|
148
152
|
- ext/xml/ruby_xml_sax_parser.c
|
149
153
|
- ext/xml/ruby_xml_schema.c
|
154
|
+
- ext/xml/ruby_xml_state.c
|
150
155
|
- ext/xml/ruby_xml_tree.c
|
151
156
|
- ext/xml/ruby_xml_xinclude.c
|
152
157
|
- ext/xml/ruby_xml_xpath.c
|
153
158
|
- ext/xml/ruby_xml_xpath_context.c
|
159
|
+
- ext/xml/ruby_xml_xpath_object.c
|
154
160
|
- ext/xml/ruby_xml_xpointer.c
|
155
161
|
- ext/xml/ruby_xml_xpointer_context.c
|
156
162
|
- ext/xml/libxml.rb
|