libxml-ruby 5.0.4 → 5.0.6

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.
Files changed (97) hide show
  1. checksums.yaml +4 -4
  2. data/HISTORY +17 -6
  3. data/README.rdoc +1 -1
  4. data/Rakefile +98 -98
  5. data/ext/libxml/extconf.h +1 -0
  6. data/ext/libxml/extconf.rb +5 -0
  7. data/ext/libxml/libxml.c +79 -79
  8. data/ext/libxml/ruby_xml.c +556 -556
  9. data/ext/libxml/ruby_xml_attr.c +333 -333
  10. data/ext/libxml/ruby_xml_attr.h +12 -12
  11. data/ext/libxml/ruby_xml_attr_decl.h +11 -11
  12. data/ext/libxml/ruby_xml_attributes.h +17 -17
  13. data/ext/libxml/ruby_xml_cbg.c +85 -85
  14. data/ext/libxml/ruby_xml_document.c +1129 -1129
  15. data/ext/libxml/ruby_xml_dtd.c +257 -257
  16. data/ext/libxml/ruby_xml_dtd.h +9 -9
  17. data/ext/libxml/ruby_xml_encoding.c +250 -250
  18. data/ext/libxml/ruby_xml_error.c +1003 -1003
  19. data/ext/libxml/ruby_xml_error.h +14 -14
  20. data/ext/libxml/ruby_xml_html_parser.c +91 -91
  21. data/ext/libxml/ruby_xml_html_parser.h +10 -10
  22. data/ext/libxml/ruby_xml_html_parser_context.c +351 -351
  23. data/ext/libxml/ruby_xml_html_parser_context.h +10 -10
  24. data/ext/libxml/ruby_xml_html_parser_options.c +48 -48
  25. data/ext/libxml/ruby_xml_html_parser_options.h +10 -10
  26. data/ext/libxml/ruby_xml_input_cbg.c +188 -188
  27. data/ext/libxml/ruby_xml_input_cbg.h +20 -20
  28. data/ext/libxml/ruby_xml_io.c +47 -47
  29. data/ext/libxml/ruby_xml_io.h +10 -10
  30. data/ext/libxml/ruby_xml_namespace.c +151 -151
  31. data/ext/libxml/ruby_xml_namespace.h +10 -10
  32. data/ext/libxml/ruby_xml_namespaces.c +293 -293
  33. data/ext/libxml/ruby_xml_namespaces.h +9 -9
  34. data/ext/libxml/ruby_xml_node.h +13 -13
  35. data/ext/libxml/ruby_xml_parser.c +91 -91
  36. data/ext/libxml/ruby_xml_parser.h +10 -10
  37. data/ext/libxml/ruby_xml_parser_context.c +1009 -1009
  38. data/ext/libxml/ruby_xml_parser_context.h +10 -10
  39. data/ext/libxml/ruby_xml_parser_options.c +74 -74
  40. data/ext/libxml/ruby_xml_parser_options.h +10 -10
  41. data/ext/libxml/ruby_xml_reader.h +14 -14
  42. data/ext/libxml/ruby_xml_relaxng.h +8 -8
  43. data/ext/libxml/ruby_xml_sax2_handler.c +326 -326
  44. data/ext/libxml/ruby_xml_sax2_handler.h +10 -10
  45. data/ext/libxml/ruby_xml_sax_parser.c +108 -108
  46. data/ext/libxml/ruby_xml_sax_parser.h +10 -10
  47. data/ext/libxml/ruby_xml_schema.h +25 -25
  48. data/ext/libxml/ruby_xml_schema_attribute.h +37 -37
  49. data/ext/libxml/ruby_xml_schema_element.h +11 -11
  50. data/ext/libxml/ruby_xml_schema_facet.c +50 -50
  51. data/ext/libxml/ruby_xml_schema_facet.h +9 -9
  52. data/ext/libxml/ruby_xml_schema_type.h +9 -9
  53. data/ext/libxml/ruby_xml_version.h +9 -9
  54. data/ext/libxml/ruby_xml_writer.c +1124 -1124
  55. data/ext/libxml/ruby_xml_writer.h +6 -6
  56. data/ext/libxml/ruby_xml_xinclude.c +20 -20
  57. data/ext/libxml/ruby_xml_xinclude.h +11 -11
  58. data/ext/libxml/ruby_xml_xpath.c +195 -195
  59. data/ext/libxml/ruby_xml_xpath.h +15 -15
  60. data/ext/libxml/ruby_xml_xpath_context.c +362 -362
  61. data/ext/libxml/ruby_xml_xpath_context.h +9 -9
  62. data/ext/libxml/ruby_xml_xpath_expression.h +10 -10
  63. data/ext/libxml/ruby_xml_xpath_object.h +17 -17
  64. data/lib/libxml/attr.rb +122 -122
  65. data/lib/libxml/attr_decl.rb +80 -80
  66. data/lib/libxml/attributes.rb +13 -13
  67. data/lib/libxml/document.rb +194 -194
  68. data/lib/libxml/error.rb +95 -95
  69. data/lib/libxml/hpricot.rb +77 -77
  70. data/lib/libxml/html_parser.rb +96 -96
  71. data/lib/libxml/namespace.rb +61 -61
  72. data/lib/libxml/namespaces.rb +37 -37
  73. data/lib/libxml/node.rb +323 -323
  74. data/lib/libxml/parser.rb +102 -102
  75. data/lib/libxml/sax_callbacks.rb +179 -179
  76. data/lib/libxml/sax_parser.rb +40 -40
  77. data/lib/libxml/tree.rb +28 -28
  78. data/lib/libxml-ruby.rb +2 -2
  79. data/lib/libxml.rb +4 -4
  80. data/lib/xml/libxml.rb +10 -10
  81. data/lib/xml.rb +13 -13
  82. data/libxml-ruby.gemspec +50 -49
  83. data/test/test_document.rb +140 -140
  84. data/test/test_document_write.rb +142 -142
  85. data/test/test_dtd.rb +126 -126
  86. data/test/test_encoding.rb +126 -126
  87. data/test/test_error.rb +197 -194
  88. data/test/test_helper.rb +21 -20
  89. data/test/test_namespace.rb +58 -58
  90. data/test/test_node.rb +235 -235
  91. data/test/test_node_write.rb +93 -93
  92. data/test/test_parser.rb +333 -333
  93. data/test/test_reader.rb +364 -364
  94. data/test/test_writer.rb +500 -468
  95. data/test/test_xml.rb +168 -168
  96. metadata +5 -5
  97. data/test/test.rb +0 -5
@@ -1,9 +1,9 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XPATH_CONTEXT__
4
- #define __RXML_XPATH_CONTEXT__
5
-
6
- extern VALUE cXMLXPathContext;
7
- void rxml_init_xpath_context(void);
8
-
9
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_XPATH_CONTEXT__
4
+ #define __RXML_XPATH_CONTEXT__
5
+
6
+ extern VALUE cXMLXPathContext;
7
+ void rxml_init_xpath_context(void);
8
+
9
+ #endif
@@ -1,10 +1,10 @@
1
- /* Please see the LICENSE file for copyright and distribution information */
2
-
3
- #ifndef __RXML_XPATH_EXPRESSION__
4
- #define __RXML_XPATH_EXPRESSION__
5
-
6
- extern VALUE cXMLXPathExpression;
7
-
8
- void rxml_init_xpath_expression(void);
9
-
10
- #endif
1
+ /* Please see the LICENSE file for copyright and distribution information */
2
+
3
+ #ifndef __RXML_XPATH_EXPRESSION__
4
+ #define __RXML_XPATH_EXPRESSION__
5
+
6
+ extern VALUE cXMLXPathExpression;
7
+
8
+ void rxml_init_xpath_expression(void);
9
+
10
+ #endif
@@ -1,17 +1,17 @@
1
- #ifndef __RXML_XPATH_OBJECT__
2
- #define __RXML_XPATH_OBJECT__
3
-
4
- extern VALUE cXMLXPathObject;
5
-
6
- typedef struct rxml_xpath_object
7
- {
8
- xmlDocPtr xdoc;
9
- xmlXPathObjectPtr xpop;
10
- VALUE nsnodes;
11
- } rxml_xpath_object;
12
-
13
-
14
- void rxml_init_xpath_object(void);
15
- VALUE rxml_xpath_object_wrap(xmlDocPtr xdoc, xmlXPathObjectPtr xpop);
16
-
17
- #endif
1
+ #ifndef __RXML_XPATH_OBJECT__
2
+ #define __RXML_XPATH_OBJECT__
3
+
4
+ extern VALUE cXMLXPathObject;
5
+
6
+ typedef struct rxml_xpath_object
7
+ {
8
+ xmlDocPtr xdoc;
9
+ xmlXPathObjectPtr xpop;
10
+ VALUE nsnodes;
11
+ } rxml_xpath_object;
12
+
13
+
14
+ void rxml_init_xpath_object(void);
15
+ VALUE rxml_xpath_object_wrap(xmlDocPtr xdoc, xmlXPathObjectPtr xpop);
16
+
17
+ #endif
data/lib/libxml/attr.rb CHANGED
@@ -1,123 +1,123 @@
1
- # encoding: UTF-8
2
-
3
- module LibXML
4
- module XML
5
- class Attr
6
- include Enumerable
7
-
8
- # call-seq:
9
- # attr.child? -> (true|false)
10
- #
11
- # Returns whether this attribute has child attributes.
12
- #
13
- def child?
14
- not self.children.nil?
15
- end
16
-
17
- # call-seq:
18
- # attr.doc? -> (true|false)
19
- #
20
- # Determine whether this attribute is associated with an
21
- # XML::Document.
22
- def doc?
23
- not self.doc.nil?
24
- end
25
-
26
- # call-seq:
27
- # attr.last? -> (true|false)
28
- #
29
- # Determine whether this is the last attribute.
30
- def last?
31
- self.last.nil?
32
- end
33
-
34
- # call-seq:
35
- # attr.next? -> (true|false)
36
- #
37
- # Determine whether there is a next attribute.
38
- def next?
39
- not self.next.nil?
40
- end
41
-
42
- # call-seq:
43
- # attr.ns? -> (true|false)
44
- #
45
- # Determine whether this attribute has an associated
46
- # namespace.
47
- def ns?
48
- not self.ns.nil?
49
- end
50
-
51
- # call-seq:
52
- # attr.namespacess -> XML::Namespaces
53
- #
54
- # Returns this node's XML::Namespaces object,
55
- # which is used to access the namespaces
56
- # associated with this node.
57
- def namespaces
58
- @namespaces ||= XML::Namespaces.new(self)
59
- end
60
-
61
- #
62
- # call-seq:
63
- # attr.parent? -> (true|false)
64
- #
65
- # Determine whether this attribute has a parent.
66
- def parent?
67
- not self.parent.nil?
68
- end
69
-
70
- # call-seq:
71
- # attr.prev? -> (true|false)
72
- #
73
- # Determine whether there is a previous attribute.
74
- def prev?
75
- not self.prev.nil?
76
- end
77
-
78
- # Returns this node's type name
79
- def node_type_name
80
- if node_type == Node::ATTRIBUTE_NODE
81
- 'attribute'
82
- else
83
- raise(UnknownType, "Unknown node type: %n", node.node_type);
84
- end
85
- end
86
-
87
- # Iterates nodes and attributes
88
- def siblings(node, &blk)
89
- if n = node
90
- loop do
91
- blk.call(n)
92
- break unless n = n.next
93
- end
94
- end
95
- end
96
-
97
- def each_sibling(&blk)
98
- siblings(self,&blk)
99
- end
100
-
101
- alias :each_attr :each_sibling
102
- alias :each :each_sibling
103
-
104
- def to_h
105
- inject({}) do |h,a|
106
- h[a.name] = a.value
107
- h
108
- end
109
- end
110
-
111
- def to_a
112
- inject([]) do |ary,a|
113
- ary << [a.name, a.value]
114
- ary
115
- end
116
- end
117
-
118
- def to_s
119
- "#{name} = #{value}"
120
- end
121
- end
122
- end
1
+ # encoding: UTF-8
2
+
3
+ module LibXML
4
+ module XML
5
+ class Attr
6
+ include Enumerable
7
+
8
+ # call-seq:
9
+ # attr.child? -> (true|false)
10
+ #
11
+ # Returns whether this attribute has child attributes.
12
+ #
13
+ def child?
14
+ not self.children.nil?
15
+ end
16
+
17
+ # call-seq:
18
+ # attr.doc? -> (true|false)
19
+ #
20
+ # Determine whether this attribute is associated with an
21
+ # XML::Document.
22
+ def doc?
23
+ not self.doc.nil?
24
+ end
25
+
26
+ # call-seq:
27
+ # attr.last? -> (true|false)
28
+ #
29
+ # Determine whether this is the last attribute.
30
+ def last?
31
+ self.last.nil?
32
+ end
33
+
34
+ # call-seq:
35
+ # attr.next? -> (true|false)
36
+ #
37
+ # Determine whether there is a next attribute.
38
+ def next?
39
+ not self.next.nil?
40
+ end
41
+
42
+ # call-seq:
43
+ # attr.ns? -> (true|false)
44
+ #
45
+ # Determine whether this attribute has an associated
46
+ # namespace.
47
+ def ns?
48
+ not self.ns.nil?
49
+ end
50
+
51
+ # call-seq:
52
+ # attr.namespacess -> XML::Namespaces
53
+ #
54
+ # Returns this node's XML::Namespaces object,
55
+ # which is used to access the namespaces
56
+ # associated with this node.
57
+ def namespaces
58
+ @namespaces ||= XML::Namespaces.new(self)
59
+ end
60
+
61
+ #
62
+ # call-seq:
63
+ # attr.parent? -> (true|false)
64
+ #
65
+ # Determine whether this attribute has a parent.
66
+ def parent?
67
+ not self.parent.nil?
68
+ end
69
+
70
+ # call-seq:
71
+ # attr.prev? -> (true|false)
72
+ #
73
+ # Determine whether there is a previous attribute.
74
+ def prev?
75
+ not self.prev.nil?
76
+ end
77
+
78
+ # Returns this node's type name
79
+ def node_type_name
80
+ if node_type == Node::ATTRIBUTE_NODE
81
+ 'attribute'
82
+ else
83
+ raise(UnknownType, "Unknown node type: %n", node.node_type);
84
+ end
85
+ end
86
+
87
+ # Iterates nodes and attributes
88
+ def siblings(node, &blk)
89
+ if n = node
90
+ loop do
91
+ blk.call(n)
92
+ break unless n = n.next
93
+ end
94
+ end
95
+ end
96
+
97
+ def each_sibling(&blk)
98
+ siblings(self,&blk)
99
+ end
100
+
101
+ alias :each_attr :each_sibling
102
+ alias :each :each_sibling
103
+
104
+ def to_h
105
+ inject({}) do |h,a|
106
+ h[a.name] = a.value
107
+ h
108
+ end
109
+ end
110
+
111
+ def to_a
112
+ inject([]) do |ary,a|
113
+ ary << [a.name, a.value]
114
+ ary
115
+ end
116
+ end
117
+
118
+ def to_s
119
+ "#{name} = #{value}"
120
+ end
121
+ end
122
+ end
123
123
  end
@@ -1,80 +1,80 @@
1
- # encoding: UTF-8
2
-
3
- module LibXML
4
- module XML
5
- class AttrDecl
6
- include Enumerable
7
-
8
- # call-seq:
9
- # attr_decl.child -> nil
10
- #
11
- # Obtain this attribute declaration's child attribute(s).
12
- # It will always be nil.
13
- def child
14
- nil
15
- end
16
-
17
- # call-seq:
18
- # attr_decl.child? -> (true|false)
19
- #
20
- # Returns whether this attribute declaration has child attributes.
21
- #
22
- def child?
23
- not self.children.nil?
24
- end
25
-
26
- # call-seq:
27
- # attr_decl.doc? -> (true|false)
28
- #
29
- # Determine whether this attribute declaration is associated with an
30
- # XML::Document.
31
- def doc?
32
- not self.doc.nil?
33
- end
34
-
35
- # call-seq:
36
- # attr_decl.next? -> (true|false)
37
- #
38
- # Determine whether there is a next attribute declaration.
39
- def next?
40
- not self.next.nil?
41
- end
42
-
43
- # call-seq:
44
- # attr_decl.parent? -> (true|false)
45
- #
46
- # Determine whether this attribute declaration has a parent .
47
- def parent?
48
- not self.parent.nil?
49
- end
50
-
51
- # call-seq:
52
- # attr_decl.prev? -> (true|false)
53
- #
54
- # Determine whether there is a previous attribute declaration.
55
- def prev?
56
- not self.prev.nil?
57
- end
58
-
59
- # call-seq:
60
- # attr_decl.node_type_name -> 'attribute declaration'
61
- #
62
- # Returns this attribute declaration's node type name.
63
- def node_type_name
64
- if node_type == Node::ATTRIBUTE_DECL
65
- 'attribute declaration'
66
- else
67
- raise(UnknownType, "Unknown node type: %n", node.node_type);
68
- end
69
- end
70
-
71
- # call-seq:
72
- # attr_decl.to_s -> string
73
- #
74
- # Returns a string representation of this attribute declaration.
75
- def to_s
76
- "#{name} = #{value}"
77
- end
78
- end
79
- end
80
- end
1
+ # encoding: UTF-8
2
+
3
+ module LibXML
4
+ module XML
5
+ class AttrDecl
6
+ include Enumerable
7
+
8
+ # call-seq:
9
+ # attr_decl.child -> nil
10
+ #
11
+ # Obtain this attribute declaration's child attribute(s).
12
+ # It will always be nil.
13
+ def child
14
+ nil
15
+ end
16
+
17
+ # call-seq:
18
+ # attr_decl.child? -> (true|false)
19
+ #
20
+ # Returns whether this attribute declaration has child attributes.
21
+ #
22
+ def child?
23
+ not self.children.nil?
24
+ end
25
+
26
+ # call-seq:
27
+ # attr_decl.doc? -> (true|false)
28
+ #
29
+ # Determine whether this attribute declaration is associated with an
30
+ # XML::Document.
31
+ def doc?
32
+ not self.doc.nil?
33
+ end
34
+
35
+ # call-seq:
36
+ # attr_decl.next? -> (true|false)
37
+ #
38
+ # Determine whether there is a next attribute declaration.
39
+ def next?
40
+ not self.next.nil?
41
+ end
42
+
43
+ # call-seq:
44
+ # attr_decl.parent? -> (true|false)
45
+ #
46
+ # Determine whether this attribute declaration has a parent .
47
+ def parent?
48
+ not self.parent.nil?
49
+ end
50
+
51
+ # call-seq:
52
+ # attr_decl.prev? -> (true|false)
53
+ #
54
+ # Determine whether there is a previous attribute declaration.
55
+ def prev?
56
+ not self.prev.nil?
57
+ end
58
+
59
+ # call-seq:
60
+ # attr_decl.node_type_name -> 'attribute declaration'
61
+ #
62
+ # Returns this attribute declaration's node type name.
63
+ def node_type_name
64
+ if node_type == Node::ATTRIBUTE_DECL
65
+ 'attribute declaration'
66
+ else
67
+ raise(UnknownType, "Unknown node type: %n", node.node_type);
68
+ end
69
+ end
70
+
71
+ # call-seq:
72
+ # attr_decl.to_s -> string
73
+ #
74
+ # Returns a string representation of this attribute declaration.
75
+ def to_s
76
+ "#{name} = #{value}"
77
+ end
78
+ end
79
+ end
80
+ end
@@ -1,14 +1,14 @@
1
- # encoding: UTF-8
2
-
3
- module LibXML
4
- module XML
5
- class Attributes
6
- def to_h
7
- inject({}) do |hash, attr|
8
- hash[attr.name] = attr.value
9
- hash
10
- end
11
- end
12
- end
13
- end
1
+ # encoding: UTF-8
2
+
3
+ module LibXML
4
+ module XML
5
+ class Attributes
6
+ def to_h
7
+ inject({}) do |hash, attr|
8
+ hash[attr.name] = attr.value
9
+ hash
10
+ end
11
+ end
12
+ end
13
+ end
14
14
  end