Sha256: ef59da6997a005efd93586dfb011deec8fbaebc60a9c562ded84c31cd82bcb32
Contents?: true
Size: 734 Bytes
Versions: 1
Compression:
Stored size: 734 Bytes
Contents
# -*- encoding: utf-8 -*- require 'nokogiri' require 'bluecloth' module Genit # Open an xml file. class XmlDocument # Public: Open an xml document. # # file - Full path String filename. # # Returns a Nokogiri::XML document. def self.open file begin Nokogiri::XML(File.open(file)){|config| config.strict} rescue Nokogiri::XML::SyntaxError => e error "Malformed xhtml in file #{file} : #{e}" end end # Public: Open a fragment of xml document. # # file - Full path String filename. # # Returns a Nokogiri::XML document. def self.open_fragment file string = IO.read file Nokogiri::XML.fragment string end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
genit-2.0 | lib/genit/documents/xml_document.rb |