module Splitter

Public Instance Methods

item(xmlnode, filename) click to toggle source
# File lib/abelard/load.rb, line 15
def item(xmlnode, filename)
  filedoc = LibXML::XML::Document.new()
  filedoc.root = xmlnode.copy(true)
  item = Item.new(filedoc, filename)
end
write_doc_clean(doc, file) click to toggle source

stream the document to a string and reparse it to clean up redundant namespaces

# File lib/abelard/load.rb, line 30
def write_doc_clean(doc, file)
  cleandoc = LibXML::XML::Parser.string(doc.to_s, :options => LibXML::XML::Parser::Options::NSCLEAN).parse
  cleandoc.save(file)
end
write_item(xmlnode, file) click to toggle source

deprecated

# File lib/abelard/load.rb, line 22
def write_item(xmlnode, file)
  filedoc = LibXML::XML::Document.new()
  filedoc.root = xmlnode.copy(true)
  puts("writing #{file}")
  filedoc.save(file, :indent => true, :encoding => LibXML::XML::Encoding::UTF_8)
end