Sha256: 2ce97f1942dec4f8c78cb353ca503ccacf757b4fb23d66b313f70a9aaabc6a40
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 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) REXML::XPath.match(self, xpath) 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(string) REXML::Document.new(string) end def parse_file(path) REXML::Document.new(open(path), :ignore_whitespace_nodes => :all) 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
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
Empact-roxml-2.3.0 | lib/roxml/xml/rexml.rb |
Empact-roxml-2.3.1 | lib/roxml/xml/rexml.rb |
roxml-2.3.2 | lib/roxml/xml/rexml.rb |