Class: Nokogiri::XML::SAX::Parser
- Inherits:
-
Object
- Object
- Nokogiri::XML::SAX::Parser
- Defined in:
- lib/nokogiri/xml/sax/parser.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
Instance Method Summary collapse
-
#initialize(doc = XML::SAX::Document.new) ⇒ Parser
constructor
A new instance of Parser.
-
#parse(thing) ⇒ Object
Parse given
thing
which may be a string containing xml, or an IO object. -
#parse_file(filename) ⇒ Object
Parse a file with
filename
. -
#parse_io(io) ⇒ Object
Parse given
io
.
Constructor Details
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
5 6 7 |
# File 'lib/nokogiri/xml/sax/parser.rb', line 5 def document @document end |
Instance Method Details
#parse(thing) ⇒ Object
Parse given thing
which may be a string containing xml, or an IO object.
13 14 15 |
# File 'lib/nokogiri/xml/sax/parser.rb', line 13 def parse thing parse_memory(thing.is_a?(IO) ? thing.read : thing) end |
#parse_file(filename) ⇒ Object
Parse a file with filename
25 26 27 28 29 |
# File 'lib/nokogiri/xml/sax/parser.rb', line 25 def parse_file filename raise Errno::ENOENT unless File.exists?(filename) raise Errno::EISDIR if File.directory?(filename) native_parse_file filename end |
#parse_io(io) ⇒ Object
Parse given io
19 20 21 |
# File 'lib/nokogiri/xml/sax/parser.rb', line 19 def parse_io io parse_memory io.read end |