libxml-ruby 0.9.7 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. data/CHANGES +53 -0
  2. data/Rakefile +1 -0
  3. data/ext/libxml/build.log +4 -0
  4. data/ext/libxml/cbg.c +86 -86
  5. data/ext/libxml/libxml.c +878 -876
  6. data/ext/libxml/ruby_libxml.h +8 -4
  7. data/ext/libxml/ruby_xml_attr.c +36 -168
  8. data/ext/libxml/ruby_xml_attr.h +2 -4
  9. data/ext/libxml/ruby_xml_attr_decl.c +177 -0
  10. data/ext/libxml/ruby_xml_attr_decl.h +13 -0
  11. data/ext/libxml/ruby_xml_attributes.c +29 -20
  12. data/ext/libxml/ruby_xml_document.c +895 -898
  13. data/ext/libxml/ruby_xml_dtd.c +18 -1
  14. data/ext/libxml/ruby_xml_dtd.h +1 -0
  15. data/ext/libxml/ruby_xml_encoding.c +116 -0
  16. data/ext/libxml/ruby_xml_encoding.h +12 -0
  17. data/ext/libxml/ruby_xml_error.c +8 -2
  18. data/ext/libxml/ruby_xml_html_parser.c +53 -74
  19. data/ext/libxml/ruby_xml_html_parser.h +2 -3
  20. data/ext/libxml/ruby_xml_html_parser_context.c +145 -0
  21. data/ext/libxml/ruby_xml_html_parser_context.h +12 -0
  22. data/ext/libxml/ruby_xml_html_parser_options.c +48 -0
  23. data/ext/libxml/ruby_xml_html_parser_options.h +12 -0
  24. data/ext/libxml/ruby_xml_input_cbg.c +1 -1
  25. data/ext/libxml/ruby_xml_io.c +30 -0
  26. data/ext/libxml/ruby_xml_io.h +9 -0
  27. data/ext/libxml/ruby_xml_namespace.c +34 -16
  28. data/ext/libxml/ruby_xml_namespace.h +2 -2
  29. data/ext/libxml/ruby_xml_namespaces.c +6 -6
  30. data/ext/libxml/ruby_xml_node.c +1367 -1324
  31. data/ext/libxml/ruby_xml_node.h +2 -2
  32. data/ext/libxml/ruby_xml_parser.c +26 -78
  33. data/ext/libxml/ruby_xml_parser.h +1 -1
  34. data/ext/libxml/ruby_xml_parser_context.c +284 -13
  35. data/ext/libxml/ruby_xml_parser_context.h +1 -2
  36. data/ext/libxml/ruby_xml_parser_options.c +75 -0
  37. data/ext/libxml/ruby_xml_parser_options.h +14 -0
  38. data/ext/libxml/ruby_xml_reader.c +277 -183
  39. data/ext/libxml/ruby_xml_sax_parser.c +60 -57
  40. data/ext/libxml/ruby_xml_xpath_context.c +43 -8
  41. data/ext/libxml/ruby_xml_xpath_expression.c +6 -0
  42. data/ext/libxml/ruby_xml_xpath_object.c +107 -95
  43. data/ext/libxml/ruby_xml_xpath_object.h +9 -1
  44. data/ext/libxml/ruby_xml_xpointer.c +107 -107
  45. data/ext/libxml/version.h +2 -2
  46. data/ext/vc/libxml_ruby.vcproj +43 -3
  47. data/lib/libxml.rb +2 -3
  48. data/lib/libxml/attr.rb +71 -2
  49. data/lib/libxml/attr_decl.rb +81 -0
  50. data/lib/libxml/document.rb +78 -14
  51. data/lib/libxml/html_parser.rb +75 -42
  52. data/lib/libxml/node.rb +11 -0
  53. data/lib/libxml/parser.rb +106 -62
  54. data/lib/libxml/reader.rb +12 -0
  55. data/lib/libxml/sax_parser.rb +42 -52
  56. data/lib/libxml/xpath_object.rb +15 -0
  57. data/test/model/atom.xml +12 -12
  58. data/test/model/bands.xml +4 -4
  59. data/test/model/books.xml +146 -147
  60. data/test/model/merge_bug_data.xml +1 -1
  61. data/test/model/rubynet.xml +1 -0
  62. data/test/model/shiporder.rng +1 -1
  63. data/test/model/shiporder.xml +22 -22
  64. data/test/model/shiporder.xsd +30 -30
  65. data/test/model/xinclude.xml +1 -1
  66. data/test/{tc_node_attr.rb → tc_attr.rb} +1 -1
  67. data/test/tc_attr_decl.rb +131 -0
  68. data/test/tc_deprecated_require.rb +1 -3
  69. data/test/tc_document.rb +13 -3
  70. data/test/tc_document_write.rb +5 -5
  71. data/test/tc_dtd.rb +13 -5
  72. data/test/tc_html_parser.rb +14 -26
  73. data/test/tc_node_cdata.rb +1 -3
  74. data/test/tc_node_comment.rb +2 -4
  75. data/test/tc_node_edit.rb +2 -3
  76. data/test/tc_node_text.rb +35 -1
  77. data/test/tc_node_write.rb +3 -3
  78. data/test/tc_node_xlink.rb +2 -4
  79. data/test/tc_parser.rb +163 -70
  80. data/test/tc_parser_context.rb +103 -42
  81. data/test/tc_reader.rb +173 -45
  82. data/test/tc_relaxng.rb +2 -2
  83. data/test/tc_sax_parser.rb +48 -52
  84. data/test/tc_schema.rb +2 -2
  85. data/test/tc_xpath.rb +37 -6
  86. data/test/tc_xpath_context.rb +7 -1
  87. data/test/tc_xpath_expression.rb +1 -3
  88. data/test/tc_xpointer.rb +1 -3
  89. data/test/test_suite.rb +2 -3
  90. metadata +20 -13
  91. data/ext/libxml/ruby_xml_input.c +0 -329
  92. data/ext/libxml/ruby_xml_input.h +0 -20
  93. data/lib/libxml/parser_context.rb +0 -17
  94. data/lib/libxml/parser_options.rb +0 -25
  95. data/test/model/simple.xml +0 -7
  96. data/test/tc_input.rb +0 -13
  97. data/test/tc_well_formed.rb +0 -11
@@ -10,6 +10,18 @@ module LibXML
10
10
  warn('set_error_handler is deprecated. Use Error.set_handler instead')
11
11
  Error.set_handler(&block)
12
12
  end
13
+
14
+ # :enddoc:
15
+
16
+ def self.walker(doc)
17
+ warn("XML::Reader.walker is deprecated. Use XML::Reader.document instead")
18
+ self.document(doc)
19
+ end
20
+
21
+ def self.data(string, options = nil)
22
+ warn("XML::Reader.data is deprecated. Use XML::Reader.string instead")
23
+ self.string(string, options)
24
+ end
13
25
  end
14
26
  end
15
27
  end
@@ -1,65 +1,55 @@
1
1
  module LibXML
2
2
  module XML
3
3
  class SaxParser
4
- def self.file(value)
5
- parser = self.new
6
- parser.input.file = value
7
- parser
8
- end
9
-
10
- def self.string(value)
11
- parser = self.new
12
- parser.input.string = value
13
- parser
14
- end
15
-
16
- def self.document(value)
17
- parser = self.new
18
- parser.input.document = value
19
- parser
20
- end
21
-
22
- def self.io(value)
23
- parser = self.new
24
- parser.input.io = value
25
- parser
26
- end
27
-
28
- def filename=(value)
29
- warn("SaxParser.filename is deprecated. Use SaxParser#file instead.")
30
- self.file = value
31
- end
32
-
33
- def file
34
- input.file
35
- end
4
+ # call-seq:
5
+ # XML::SaxParser.file(path) -> XML::SaxParser
6
+ #
7
+ # Creates a new parser by parsing the specified file or uri.
8
+ def self.file(path)
9
+ context = XML::Parser::Context.file(path)
10
+ self.new(context)
11
+ end
12
+
13
+ # call-seq:
14
+ # XML::SaxParser.io(io) -> XML::SaxParser
15
+ # XML::SaxParser.io(io, :encoding => XML::Encoding::UTF_8) -> XML::SaxParser
16
+ #
17
+ # Creates a new reader by parsing the specified io object.
18
+ #
19
+ # Parameters:
20
+ #
21
+ # encoding - The document encoding, defaults to nil. Valid values
22
+ # are the encoding constants defined on XML::Encoding.
23
+ def self.io(io, options = {})
24
+ context = XML::Parser::Context.io(io)
25
+ context.encoding = options[:encoding] if options[:encoding]
26
+ self.new(context)
27
+ end
28
+
29
+ # call-seq:
30
+ # XML::SaxParser.string(string)
31
+ #
32
+ # Creates a new parser by parsing the specified string.
33
+ def self.string(string)
34
+ context = XML::Parser::Context.string(string)
35
+ self.new(context)
36
+ end
37
+
38
+ # :enddoc:
36
39
 
37
40
  def file=(value)
38
- input.file = value
41
+ warn("XML::SaxParser#file is deprecated. Use XML::SaxParser.file instead")
42
+ @context = XML::Parser::Context.file(value)
39
43
  end
40
44
 
41
- def string
42
- input.string
45
+ def io=(value)
46
+ warn("XML::SaxParser#io is deprecated. Use XML::SaxParser.io instead")
47
+ @context = XML::Parser::Context.io(value)
43
48
  end
44
49
 
45
50
  def string=(value)
46
- input.string = value
47
- end
48
-
49
- def document
50
- input.document
51
- end
52
-
53
- def document=(value)
54
- input.document = value
55
- end
56
-
57
- def io
58
- input.io
59
- end
60
-
61
- def io=(value)
62
- input.io = value
51
+ warn("XML::SaxParser#string is deprecated. Use XML::SaxParser.string instead")
52
+ @context = XML::Parser::Context.string(value)
63
53
  end
64
54
  end
65
55
  end
@@ -2,6 +2,21 @@ module LibXML
2
2
  module XML
3
3
  module XPath
4
4
  class Object
5
+ alias :size :length
6
+
7
+ def first
8
+ self[0]
9
+ end
10
+
11
+ def empty?
12
+ self.length == 0
13
+ end
14
+
15
+ def debug
16
+ warn("XPath::Object#debug is no longer available.")
17
+ self
18
+ end
19
+
5
20
  def set
6
21
  warn("XPath::Object#set is deprecated. Simply use the XPath::Object API instead")
7
22
  self
@@ -1,13 +1,13 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <?xml-stylesheet type="text/xsl" href="my_stylesheet.xsl"?>
3
- <feed xmlns="http://www.w3.org/2005/Atom">
4
- <!-- Not a valid atom entry -->
5
- <entry>
6
- <title type="html"><![CDATA[<<strong>>]]></title>
7
- <content type="xhtml">
8
- <xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">
9
- <xhtml:p>hi there</xhtml:p>
10
- </xhtml:div>
11
- </content>
12
- </entry>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <?xml-stylesheet type="text/xsl" href="my_stylesheet.xsl"?>
3
+ <feed xmlns="http://www.w3.org/2005/Atom">
4
+ <!-- Not a valid atom entry -->
5
+ <entry>
6
+ <title type="html"><![CDATA[<<strong>>]]></title>
7
+ <content type="xhtml">
8
+ <xhtml:div xmlns:xhtml="http://www.w3.org/1999/xhtml">
9
+ <xhtml:p>hi there</xhtml:p>
10
+ </xhtml:div>
11
+ </content>
12
+ </entry>
13
13
  </feed>
@@ -1,5 +1,5 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <bands genre="metal">
3
- <mötley_crüe country="us">An American heavy metal band formed in Los Angeles, California in 1981.</mötley_crüe>
4
- <iron_maiden country="uk">British heavy metal band formed in 1975.</iron_maiden>
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <bands genre="metal">
3
+ <mötley_crüe country="us">An American heavy metal band formed in Los Angeles, California in 1981.</mötley_crüe>
4
+ <iron_maiden country="uk">British heavy metal band formed in 1975.</iron_maiden>
5
5
  </bands>
@@ -1,147 +1,146 @@
1
- <?xml version="1.0"?>
2
- <!-- Sample xml file from Microsoft.
3
- See http://msdn.microsoft.com/en-us/library/ms762271(VS.85).aspx -->
4
- <catalog>
5
- <book id="bk101">
6
- <author>Gambardella, Matthew</author>
7
- <title>XML Developer's Guide</title>
8
- <genre>Computer</genre>
9
- <price>44.95</price>
10
- <publish_date>2000-10-01</publish_date>
11
- <description>
12
- An in-depth look at creating applications
13
- with XML.
14
- </description>
15
- </book>
16
- <book id="bk102">
17
- <author>Ralls, Kim</author>
18
- <title>Midnight Rain</title>
19
- <genre>Fantasy</genre>
20
- <price>5.95</price>
21
- <publish_date>2000-12-16</publish_date>
22
- <description>
23
- A former architect battles corporate zombies,
24
- an evil sorceress, and her own childhood to become queen
25
- of the world.
26
- </description>
27
- </book>
28
- <book id="bk103">
29
- <author>Corets, Eva</author>
30
- <title>Maeve Ascendant</title>
31
- <genre>Fantasy</genre>
32
- <price>5.95</price>
33
- <publish_date>2000-11-17</publish_date>
34
- <description>
35
- After the collapse of a nanotechnology
36
- society in England, the young survivors lay the
37
- foundation for a new society.
38
- </description>
39
- </book>
40
- <book id="bk104">
41
- <author>Corets, Eva</author>
42
- <title>Oberon's Legacy</title>
43
- <genre>Fantasy</genre>
44
- <price>5.95</price>
45
- <publish_date>2001-03-10</publish_date>
46
- <description>
47
- In post-apocalypse England, the mysterious
48
- agent known only as Oberon helps to create a new life
49
- for the inhabitants of London. Sequel to Maeve
50
- Ascendant.
51
- </description>
52
- </book>
53
- <book id="bk105">
54
- <author>Corets, Eva</author>
55
- <title>The Sundered Grail</title>
56
- <genre>Fantasy</genre>
57
- <price>5.95</price>
58
- <publish_date>2001-09-10</publish_date>
59
- <description>
60
- The two daughters of Maeve, half-sisters,
61
- battle one another for control of England. Sequel to
62
- Oberon's Legacy.
63
- </description>
64
- </book>
65
- <book id="bk106">
66
- <author>Randall, Cynthia</author>
67
- <title>Lover Birds</title>
68
- <genre>Romance</genre>
69
- <price>4.95</price>
70
- <publish_date>2000-09-02</publish_date>
71
- <description>
72
- When Carla meets Paul at an ornithology
73
- conference, tempers fly as feathers get ruffled.
74
- </description>
75
- </book>
76
- <book id="bk107">
77
- <author>Thurman, Paula</author>
78
- <title>Splish Splash</title>
79
- <genre>Romance</genre>
80
- <price>4.95</price>
81
- <publish_date>2000-11-02</publish_date>
82
- <description>
83
- A deep sea diver finds true love twenty
84
- thousand leagues beneath the sea.
85
- </description>
86
- </book>
87
- <book id="bk108">
88
- <author>Knorr, Stefan</author>
89
- <title>Creepy Crawlies</title>
90
- <genre>Horror</genre>
91
- <price>4.95</price>
92
- <publish_date>2000-12-06</publish_date>
93
- <description>
94
- An anthology of horror stories about roaches,
95
- centipedes, scorpions and other insects.
96
- </description>
97
- </book>
98
- <book id="bk109">
99
- <author>Kress, Peter</author>
100
- <title>Paradox Lost</title>
101
- <genre>Science Fiction</genre>
102
- <price>6.95</price>
103
- <publish_date>2000-11-02</publish_date>
104
- <description>
105
- After an inadvertant trip through a Heisenberg
106
- Uncertainty Device, James Salway discovers the problems
107
- of being quantum.
108
- </description>
109
- </book>
110
- <book id="bk110">
111
- <author>O'Brien, Tim</author>
112
- <title>Microsoft .NET: The Programming Bible</title>
113
- <genre>Computer</genre>
114
- <price>36.95</price>
115
- <publish_date>2000-12-09</publish_date>
116
- <description>
117
- Microsoft's .NET initiative is explored in
118
- detail in this deep programmer's reference.
119
- </description>
120
- </book>
121
- <book id="bk111">
122
- <author>O'Brien, Tim</author>
123
- <title>MSXML3: A Comprehensive Guide</title>
124
- <genre>Computer</genre>
125
- <price>36.95</price>
126
- <publish_date>2000-12-01</publish_date>
127
- <description>
128
- The Microsoft MSXML3 parser is covered in
129
- detail, with attention to XML DOM interfaces, XSLT processing,
130
- SAX and more.
131
- </description>
132
- </book>
133
- <book id="bk112">
134
- <author>Galos, Mike</author>
135
- <title>Visual Studio 7: A Comprehensive Guide</title>
136
- <genre>Computer</genre>
137
- <price>49.95</price>
138
- <publish_date>2001-04-16</publish_date>
139
- <description>
140
- Microsoft Visual Studio 7 is explored in depth,
141
- looking at how Visual Basic, Visual C++, C#, and ASP+ are
142
- integrated into a comprehensive development
143
- environment.
144
- </description>
145
- </book>
146
- </catalog>
147
-
1
+ <?xml version="1.0"?>
2
+ <!-- Sample xml file from Microsoft.
3
+ See http://msdn.microsoft.com/en-us/library/ms762271(VS.85).aspx -->
4
+ <catalog>
5
+ <book id="bk101">
6
+ <author>Gambardella, Matthew</author>
7
+ <title>XML Developer's Guide</title>
8
+ <genre>Computer</genre>
9
+ <price>44.95</price>
10
+ <publish_date>2000-10-01</publish_date>
11
+ <description>
12
+ An in-depth look at creating applications
13
+ with XML.
14
+ </description>
15
+ </book>
16
+ <book id="bk102">
17
+ <author>Ralls, Kim</author>
18
+ <title>Midnight Rain</title>
19
+ <genre>Fantasy</genre>
20
+ <price>5.95</price>
21
+ <publish_date>2000-12-16</publish_date>
22
+ <description>
23
+ A former architect battles corporate zombies,
24
+ an evil sorceress, and her own childhood to become queen
25
+ of the world.
26
+ </description>
27
+ </book>
28
+ <book id="bk103">
29
+ <author>Corets, Eva</author>
30
+ <title>Maeve Ascendant</title>
31
+ <genre>Fantasy</genre>
32
+ <price>5.95</price>
33
+ <publish_date>2000-11-17</publish_date>
34
+ <description>
35
+ After the collapse of a nanotechnology
36
+ society in England, the young survivors lay the
37
+ foundation for a new society.
38
+ </description>
39
+ </book>
40
+ <book id="bk104">
41
+ <author>Corets, Eva</author>
42
+ <title>Oberon's Legacy</title>
43
+ <genre>Fantasy</genre>
44
+ <price>5.95</price>
45
+ <publish_date>2001-03-10</publish_date>
46
+ <description>
47
+ In post-apocalypse England, the mysterious
48
+ agent known only as Oberon helps to create a new life
49
+ for the inhabitants of London. Sequel to Maeve
50
+ Ascendant.
51
+ </description>
52
+ </book>
53
+ <book id="bk105">
54
+ <author>Corets, Eva</author>
55
+ <title>The Sundered Grail</title>
56
+ <genre>Fantasy</genre>
57
+ <price>5.95</price>
58
+ <publish_date>2001-09-10</publish_date>
59
+ <description>
60
+ The two daughters of Maeve, half-sisters,
61
+ battle one another for control of England. Sequel to
62
+ Oberon's Legacy.
63
+ </description>
64
+ </book>
65
+ <book id="bk106">
66
+ <author>Randall, Cynthia</author>
67
+ <title>Lover Birds</title>
68
+ <genre>Romance</genre>
69
+ <price>4.95</price>
70
+ <publish_date>2000-09-02</publish_date>
71
+ <description>
72
+ When Carla meets Paul at an ornithology
73
+ conference, tempers fly as feathers get ruffled.
74
+ </description>
75
+ </book>
76
+ <book id="bk107">
77
+ <author>Thurman, Paula</author>
78
+ <title>Splish Splash</title>
79
+ <genre>Romance</genre>
80
+ <price>4.95</price>
81
+ <publish_date>2000-11-02</publish_date>
82
+ <description>
83
+ A deep sea diver finds true love twenty
84
+ thousand leagues beneath the sea.
85
+ </description>
86
+ </book>
87
+ <book id="bk108">
88
+ <author>Knorr, Stefan</author>
89
+ <title>Creepy Crawlies</title>
90
+ <genre>Horror</genre>
91
+ <price>4.95</price>
92
+ <publish_date>2000-12-06</publish_date>
93
+ <description>
94
+ An anthology of horror stories about roaches,
95
+ centipedes, scorpions and other insects.
96
+ </description>
97
+ </book>
98
+ <book id="bk109">
99
+ <author>Kress, Peter</author>
100
+ <title>Paradox Lost</title>
101
+ <genre>Science Fiction</genre>
102
+ <price>6.95</price>
103
+ <publish_date>2000-11-02</publish_date>
104
+ <description>
105
+ After an inadvertant trip through a Heisenberg
106
+ Uncertainty Device, James Salway discovers the problems
107
+ of being quantum.
108
+ </description>
109
+ </book>
110
+ <book id="bk110">
111
+ <author>O'Brien, Tim</author>
112
+ <title>Microsoft .NET: The Programming Bible</title>
113
+ <genre>Computer</genre>
114
+ <price>36.95</price>
115
+ <publish_date>2000-12-09</publish_date>
116
+ <description>
117
+ Microsoft's .NET initiative is explored in
118
+ detail in this deep programmer's reference.
119
+ </description>
120
+ </book>
121
+ <book id="bk111">
122
+ <author>O'Brien, Tim</author>
123
+ <title>MSXML3: A Comprehensive Guide</title>
124
+ <genre>Computer</genre>
125
+ <price>36.95</price>
126
+ <publish_date>2000-12-01</publish_date>
127
+ <description>
128
+ The Microsoft MSXML3 parser is covered in
129
+ detail, with attention to XML DOM interfaces, XSLT processing,
130
+ SAX and more.
131
+ </description>
132
+ </book>
133
+ <book id="bk112">
134
+ <author>Galos, Mike</author>
135
+ <title>Visual Studio 7: A Comprehensive Guide</title>
136
+ <genre>Computer</genre>
137
+ <price>49.95</price>
138
+ <publish_date>2001-04-16</publish_date>
139
+ <description>
140
+ Microsoft Visual Studio 7 is explored in depth,
141
+ looking at how Visual Basic, Visual C++, C#, and ASP+ are
142
+ integrated into a comprehensive development
143
+ environment.
144
+ </description>
145
+ </book>
146
+ </catalog>