Class: XML::DOM::DocumentFragment

Inherits:
Node
  • Object
show all
Defined in:
lib/xml/dom/core.rb,
lib/xml/dom2/documentfragment.rb

Overview

Class XML::DOM::DocumentFragment

superclass

Node

Constant Summary

Constants inherited from Node

Node::ATTRIBUTE_NODE, Node::CDATA_SECTION_NODE, Node::COMMENT_NODE, Node::DOCUMENT_FRAGMENT_NODE, Node::DOCUMENT_NODE, Node::DOCUMENT_TYPE_NODE, Node::ELEMENT_NODE, Node::ENTITY_NODE, Node::ENTITY_REFERENCE_NODE, Node::NODE_NODE, Node::NOTATION_NODE, Node::PROCESSING_INSTRUCTION_NODE, Node::TEXT_NODE

Instance Method Summary collapse

Methods inherited from Node

#+, #<=>, #==, #[], #[]=, #__collectAncestorNS, #__collectDescendatNS, #__sibling, #_ancestor, #_child, #_descendant, #_following, #_fsibling, #_getChildIndex, #_getMyLocation, #_getMyLocationInXPath, #_getNodeByAbsoluteLocationTerm, #_insertNodes, #_matchAttribute?, #_matchNode?, #_matchNodeAttributes?, #_matchNodeType?, #_nodesByLocationTerms, #_nodesByRelativeLocationTerm, #_preceding, #_psibling, #_removeFromTree, #_removeNode, #_searchID, #accept, #accept_name, #appendChild, #attributes, #childNodes, #childNodes=, #children_accept, #children_accept_name, #cloneNode, #dump, #each, #firstChild, #getDigest, #getNodesByXPath, #getNodesByXPointer, #hasAttributes, #hasChildNodes, #insertBefore, #inspect, #isSupported, #lastChild, #localname, #makeXPath, #makeXPointer, #namespaceURI, #nextSibling, #nodeValue, #nodeValue=, #ownerDocument, #ownerDocument=, #parentNode, #prefix, #prefix=, #previousSibling, #removeChild, #replaceChild, #to_s, #trim

Constructor Details

#initialize(*children) ⇒ DocumentFragment

Class Methods

--- DocumentFragment.new(*children)

creates a new DocumentFragment.



1447
1448
1449
# File 'lib/xml/dom/core.rb', line 1447

def initialize(*children)
  super(*children)
end

Instance Method Details

#_checkNode(node) ⇒ Object

def parentNode=(p)

  @children.each do |child|
    child.parentNode = p
  end if @children
end


69
70
71
72
73
74
75
76
77
78
# File 'lib/xml/dom2/documentfragment.rb', line 69

def _checkNode(node)
  unless node.nodeType == ELEMENT_NODE ||
      node.nodeType == PROCESSING_INSTRUCTION_NODE ||
      node.nodeType == COMMENT_NODE ||
      node.nodeType == TEXT_NODE ||
      node.nodeType == CDATA_SECTION_NODE ||
      node.nodeType == ENTITY_REFERENCE_NODE
    raise DOMException.new(DOMException::HIERARCHY_REQUEST_ERR)
  end
end

#nodeNameObject

DOM


1471
1472
1473
# File 'lib/xml/dom/core.rb', line 1471

def nodeName
  "#document-fragment"
end

#nodeTypeObject

DOM


1460
1461
1462
# File 'lib/xml/dom/core.rb', line 1460

def nodeType
  DOCUMENT_FRAGMENT_NODE
end

#parentNode=(p) ⇒ Object

DocumentFragment should not have the parent node.



1481
1482
1483
1484
1485
# File 'lib/xml/dom/core.rb', line 1481

def parentNode=(p)
  @children.each do |child|
    child.parentNode = p
  end if @children
end