diff options
author | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 09:20:47 +0000 |
---|---|---|
committer | kou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-03-21 09:20:47 +0000 |
commit | 7ead69e5b3a2b09878037f11a7dda59ae402ccbf (patch) | |
tree | f7a422e5983f2c475c831e5d70987437eb77fa69 /lib/rss/xmlparser.rb | |
parent | 2639d6dc809a3f78c96543c839d72d05e6e90ca7 (diff) |
* 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
Diffstat (limited to 'lib/rss/xmlparser.rb')
-rw-r--r-- | lib/rss/xmlparser.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/rss/xmlparser.rb b/lib/rss/xmlparser.rb index 5a62ce00a1..355a428d2d 100644 --- a/lib/rss/xmlparser.rb +++ b/lib/rss/xmlparser.rb @@ -1,4 +1,10 @@ begin + require "xml/parser" +rescue LoadError + require "xmlparser" +end + +begin require "xml/encoding-ja" rescue LoadError require "xmlencoding-ja" @@ -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 |