Class: ROXML::XML::Document
- Inherits:
-
Object
- Object
- ROXML::XML::Document
- Includes:
- NamespacedSearch
- Defined in:
- lib/roxml/xml/parsers/rexml.rb,
lib/roxml/xml/parsers/libxml.rb
Instance Method Summary collapse
- #root=(node) ⇒ Object
- #save(destination, opts = {:formatter => REXML::Formatters::Default.new}) ⇒ Object
Methods included from NamespacedSearch
Instance Method Details
#root=(node) ⇒ Object
71 72 73 74 |
# File 'lib/roxml/xml/parsers/rexml.rb', line 71 def root=(node) raise ArgumentError, "Root is already defined" if root add(node) end |
#save(destination, opts = {:formatter => REXML::Formatters::Default.new}) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/roxml/xml/parsers/rexml.rb', line 76 def save(destination, opts = {:formatter => REXML::Formatters::Default.new}) self << REXML::XMLDecl.new unless xml_decl != REXML::XMLDecl.default # always output xml declaration File.open(destination, "w") do |f| opts[:formatter].write(self, f) end end |