class XML::DOM::Document
begin¶ ↑
Class XML::DOM::Document¶ ↑
superclass¶ ↑
end¶ ↑
begin¶ ↑
Class XML::DOM::Document¶ ↑
superclass¶ ↑
end¶ ↑
Constants
- XMLNSNS
Public Class Methods
new(*children)
click to toggle source
new([child1, child2, …]) or new(child1, child2, …)
child?: String or Node
Calls superclass method
XML::DOM::Node.new
# File lib/xml/dom/core.rb, line 1517 def initialize(*children) super(*children) end
Public Instance Methods
_checkNode(node)
click to toggle source
# File lib/xml/dom/core.rb, line 1727 def _checkNode(node) unless node.nodeType == ELEMENT_NODE || node.nodeType == PROCESSING_INSTRUCTION_NODE || node.nodeType == COMMENT_NODE || node.nodeType == DOCUMENT_TYPE_NODE raise DOMException.new(DOMException::HIERARCHY_REQUEST_ERR) end if node.nodeType == ELEMENT_NODE @children.each do |n| if n.nodeType == ELEMENT_NODE raise DOMException.new(DOMException::HIERARCHY_REQUEST_ERR) end end end if node.nodeType == DOCUMENT_TYPE_NODE @children.each do |n| if n.nodeType == DOCUMENT_TYPE_NODE raise DOMException.new(DOMException::HIERARCHY_REQUEST_ERR) end end end end
_getIDAttrs()
click to toggle source
get the ID list
- experimental implement
# File lib/xml/dom/core.rb, line 1711 def _getIDAttrs return {'*'=>'id'} if @idattrs.nil? @idattrs end
_getNamespaces(parentNamespaces = {}, all = false)
click to toggle source
# File lib/xml/dom2/document.rb, line 310 def _getNamespaces(parentNamespaces = {}, all = false) { nil => nil } end
_setIDAttr(attrname, elemname = '*')
click to toggle source
set the ID list by the attribute name with the element name (or wildcard)
- experimental implement
# File lib/xml/dom/core.rb, line 1704 def _setIDAttr(attrname, elemname = '*') @idattrs = {} if @idattrs.nil? @idattrs[elemname] = attrname end
createAttribute(name)
click to toggle source
createAttributeNS(nsuri, qname)
click to toggle source
- DOM2
# File lib/xml/dom2/document.rb, line 257 def createAttributeNS(nsuri, qname) nsuri = XMLNSNS if qname == 'xmlns' or qname =~ /^xmlns:/u ret = Attr.new([nsuri, qname]) ret.ownerDocument = self ret end
createCDATASection(data)
click to toggle source
createComment(data)
click to toggle source
createDocumentFragment()
click to toggle source
createElement(tagName)
click to toggle source
createElementNS(nsuri, qname)
click to toggle source
createEntityReference(name)
click to toggle source
createProcessingInstruction(target, data)
click to toggle source
createTextNode(data)
click to toggle source
doctype()
click to toggle source
documentElement()
click to toggle source
getElementById(elementId)
click to toggle source
- DOM2
# File lib/xml/dom2/document.rb, line 280 def getElementById(elementId) ## [NOT IMPLEMENTED] raise "not implemented" end
getElementsByTagName(tagname)
click to toggle source
getElementsByTagNameNS(nsuri, localname)
click to toggle source
- DOM2
# File lib/xml/dom2/document.rb, line 265 def getElementsByTagNameNS(nsuri, localname) ret = NodeList.new @children.each do |node| if node.nodeType == ELEMENT_NODE if (localname == '*' || node.localname == localname) and (nsuri == '*' || node.namespaceURI == nsuri) ret << node end ret << node.getElementsByTagNameNS(nsuri, localname) end end if @children ret end
implementation()
click to toggle source
# File lib/xml/dom/core.rb, line 1717 def implementation return @implemantation if @implemantation ## singleton @implemantation = DOMImplementation.instance end
implementation=(impl)
click to toggle source
# File lib/xml/dom/core.rb, line 1723 def implementation=(impl) @implemantation = impl end
importNode(impnode, deep)
click to toggle source
- DOM2
# File lib/xml/dom2/document.rb, line 237 def importNode(impnode, deep) ## [NOT IMPLEMENTED] raise "not implemented" end
nodeName()
click to toggle source