Sha256: 9266281fd91aae76e305a50d4a164fbecdf65a4748122434c64b8543e0be4b93
Contents?: true
Size: 1.46 KB
Versions: 4
Compression:
Stored size: 1.46 KB
Contents
require 'rexml/document' module ROXML module XML # :nodoc:all Document = REXML::Document Node = REXML::Element class Node class << self def new_cdata(content) REXML::CData.new(content) end def new_element(name) name = name.id2name if name.is_a? Symbol REXML::Element.new(name) end end alias_attribute :content, :text def search(xpath) begin REXML::XPath.match(self, xpath) rescue Exception => ex raise ex, xpath end end def child_add(element) if element.is_a?(REXML::CData) REXML::CData.new(element, true, self) else add_element(element) end end def ==(other) to_s == other.to_s end end class Parser class << self def parse(source) REXML::Document.new(source, :ignore_whitespace_nodes => :all) end def parse_file(path) #:nodoc: path = path.sub('file:', '') if path.starts_with?('file:') parse(open(path)) end def parse_io(path) #:nodoc: parse(path) end def register_error_handler(&block) end end ParseError = REXML::ParseException end class Document delegate :search, :to => :root def root=(node) raise ArgumentError, "Root is already defined" if root add(node) end end end end
Version data entries
4 entries across 4 versions & 2 rubygems
Version | Path |
---|---|
Empact-roxml-2.4.2 | lib/roxml/xml/parsers/rexml.rb |
Empact-roxml-2.4.3 | lib/roxml/xml/parsers/rexml.rb |
roxml-2.4.2 | lib/roxml/xml/parsers/rexml.rb |
roxml-2.4.3 | lib/roxml/xml/parsers/rexml.rb |