Class: AXML::LibXML
Overview
if using AXML::LibXML, LibXML::XML::Node behavior is slightly modified from the default LibXML behavior:
1. there are no 'text' nodes. Some nodes have text, some do not
2. :text? returns true if the node has text (in LibXML this returns true
if the node *is* a text node)
3. text
Constant Summary
Constants included from AXML
CLASS_MAPPINGS, DEFAULTS, PREFERRED, WARN
Class Method Summary collapse
-
.parse_io(io, opts = {}) ⇒ Object
beware that threading with different :keep_blanks values could cause problems since this is a global Libxml setting.
-
.parse_string(string, opts = {}) ⇒ Object
beware that threading with different :keep_blanks values could cause problems since this is a global Libxml setting.
Methods included from AXML
Class Method Details
.parse_io(io, opts = {}) ⇒ Object
beware that threading with different :keep_blanks values could cause problems since this is a global Libxml setting
19 20 21 22 23 |
# File 'lib/axml/libxml.rb', line 19 def parse_io(io, opts={}) opts = AXML::DEFAULTS.merge opts XML::Parser.default_keep_blanks = opts[:keep_blanks] if opts.key?(:keep_blanks) XML::Parser.io(io).parse.root end |
.parse_string(string, opts = {}) ⇒ Object
beware that threading with different :keep_blanks values could cause problems since this is a global Libxml setting
27 28 29 30 31 |
# File 'lib/axml/libxml.rb', line 27 def parse_string(string, opts={}) opts = AXML::DEFAULTS.merge opts XML::Parser.default_keep_blanks = opts[:keep_blanks] if opts.key?(:keep_blanks) XML::Parser.string(string).parse.root end |