class Nokogiri::XML::DocumentFragment

def self.new(document, *rest) # :nodoc:

:nodoc:
def self.new(document, *rest) # :nodoc:
  node_ptr = LibXML.xmlNewDocFragment(document.cstruct)
  node_cstruct = LibXML::XmlNode.new(node_ptr)
  node_cstruct.keep_reference_from_document!
  node = Node.wrap(node_cstruct, self)
  if node.document.child && node.document.child.node_type == ELEMENT_NODE
    # TODO: node_type check should be ported into master, because of e.g. DTD nodes
    node.cstruct[:ns] = node.document.children.first.cstruct[:ns] 
  end
  node.send :initialize, document, *rest
  yield node if block_given?
  node
end

def initialize document, tags=nil

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

def name

return the name for DocumentFragment
##
def name
  '#document-fragment'
end

def parse tags

Create a Nokogiri::XML::DocumentFragment from +tags+
###
def parse tags
  XML::DocumentFragment.new(XML::Document.new, tags)
end

def to_html *args

def to_html *args
  children.to_html(*args)
end

def to_s

def to_s
  children.to_s
end

def to_xhtml *args

def to_xhtml *args
  children.to_xhtml(*args)
end

def to_xml *args

def to_xml *args
  children.to_xml(*args)
end