Class: XML::DOM::DOMImplementation
- Inherits:
-
Object
- Object
- XML::DOM::DOMImplementation
- Includes:
- Singleton
- Defined in:
- lib/xml/dom/core.rb,
lib/xml/dom2/domimplementation.rb
Overview
Class XML::DOM::DOMImplementation
Instance Method Summary collapse
-
#createDocument(nsuri, qname, doctype) ⇒ Object
[DOM2].
-
#createDocumentType(qname, pubid, sysid) ⇒ Object
[DOM2].
-
#createDOMBuilder ⇒ Object
[DOM3?].
-
#hasFeature(feature, version) ⇒ Object
— DOMImplementation#hasFeature(feature, version).
Instance Method Details
#createDocument(nsuri, qname, doctype) ⇒ Object
- DOM2
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 |
#createDocumentType(qname, pubid, sysid) ⇒ Object
- DOM2
36 37 38 |
# File 'lib/xml/dom2/domimplementation.rb', line 36 def createDocumentType(qname, pubid, sysid) DocumentType.new(qname, pubid, sysid) end |
#createDOMBuilder ⇒ Object
- DOM3?
56 57 58 |
# File 'lib/xml/dom2/domimplementation.rb', line 56 def createDOMBuilder XML::DOM::DOMBuilder.new(Document.new) end |
#hasFeature(feature, version) ⇒ Object
— DOMImplementation#hasFeature(feature, version)
test if DOM implementation has correct feature and version.
167 168 169 170 171 172 |
# File 'lib/xml/dom/core.rb', line 167 def hasFeature(feature, version) if feature =~ /^XML$/i && (version.nil? || version == "1.0") return true end false end |