Sha256: 0ddba3be2e1dd59d3eb034c105fe67349bcde1bd54743e3d0136a897c9d8d714
Contents?: true
Size: 1.04 KB
Versions: 12
Compression:
Stored size: 1.04 KB
Contents
module Nokogiri module XML class DocumentFragment < Nokogiri::XML::Node def initialize document, tags=nil if tags parser = if self.kind_of?(Nokogiri::HTML::DocumentFragment) HTML::SAX::Parser.new(FragmentHandler.new(self, tags)) else XML::SAX::Parser.new(FragmentHandler.new(self, tags)) end parser.parse(tags) end end ### # return the name for DocumentFragment def name '#document-fragment' end def to_s children.to_s end def to_html *args children.to_html(*args) end def to_xhtml *args children.to_xhtml(*args) end def to_xml *args children.to_xml(*args) end alias :serialize :to_s class << self #### # Create a Nokogiri::XML::DocumentFragment from +tags+ def parse tags XML::DocumentFragment.new(XML::Document.new, tags) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems