Method: XML::DOM::DOMImplementation#createDocument

Defined in:
lib/xml/dom2/domimplementation.rb

#createDocument(nsuri, qname, doctype) ⇒ Object

DOM2

Raises:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/xml/dom2/domimplementation.rb', line 41

def createDocument(nsuri, qname, doctype)
  raise DOMException.new(DOMException::WRONG_DOCUMENT_ERR) if
    doctype && doctype.ownerDocument
  doc = Document.new
  if doctype
    doc.appendChild(doctype)
    doctype.ownerDocument = doc
  end
  elem = doc.createElementNS(nsuri, qname)
  doc.appendChild(elem)
  doc.implementation = self
  doc
end