1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/rss/test_xml-stylesheet.rb: added tests for xml-stylesheet.

* lib/rss/xml-stylesheet.rb: added xml-stylesheet parsing
  function.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5989 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kou 2004-03-21 09:20:47 +00:00
parent 2639d6dc80
commit 7ead69e5b3
15 changed files with 385 additions and 85 deletions

View file

@ -1,3 +1,9 @@
begin
require "xml/parser"
rescue LoadError
require "xmlparser"
end
begin
require "xml/encoding-ja"
rescue LoadError
@ -15,7 +21,7 @@ module RSS
class REXMLLikeXMLParser < ::XML::Parser
include XML::Encoding_ja
include ::XML::Encoding_ja
def listener=(listener)
@listener = listener
@ -37,6 +43,10 @@ module RSS
@listener.xmldecl(version, encoding, standalone == 1)
end
def processingInstruction(target, content)
@listener.instruction(target, content)
end
end
class XMLParserParser < BaseParser
@ -51,7 +61,7 @@ module RSS
parser = REXMLLikeXMLParser.new
parser.listener = @listener
parser.parse(@rss)
rescue XMLParserError => e
rescue ::XML::Parser::Error => e
raise NotWellFormedError.new(parser.line){e.message}
end
end