Sha256: df3c5b12d770bee659a2012cbdec6b4ad7e1984f274a0768360ba581ea268f91
Contents?: true
Size: 921 Bytes
Versions: 5
Compression:
Stored size: 921 Bytes
Contents
description 'XML support' require 'nokogiri' # Nokogiri uses dump_html instead of serialize for broken libxml versions # Unfortunately this breaks some things here. # FIXME: Remove this check as soon as nokogiri works correctly. raise 'The libxml version used by nokogiri is broken, upgrade to 2.7' if Nokogiri.uses_libxml? && %w[2 6] === Nokogiri::LIBXML_VERSION.split('.')[0..1] module XML extend self # Parse xml document string and return DOM object (Nokogiri) # # @param [String] xml document string # @return [Nokogiri::HTML::Document] Nokogiri Document def Document(xml) Nokogiri::HTML(xml, nil, 'UTF-8') end # Parse xml fragment and return DOM object (Nokogiri) # # @param [String] xml fragment string # @return [Nokogiri::HTML::DocumentFragment] Nokogiri Document Fragment def Fragment(xml) Nokogiri::HTML::DocumentFragment.new(Document(nil), xml) end end Olelo::XML = XML
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
olelo-0.9.4 | plugins/utils/xml.rb |
olelo-0.9.3 | plugins/utils/xml.rb |
olelo-0.9.2 | plugins/utils/xml.rb |
olelo-0.9.1 | plugins/utils/xml.rb |
olelo-0.9.0 | plugins/utils/xml.rb |