Class: XML::DOM::EntityReference

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

Overview

Class XML::DOM::EntityReference

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, #each, #firstChild, #getDigest, #getNodesByXPath, #getNodesByXPointer, #hasAttributes, #hasChildNodes, #insertBefore, #inspect, #isSupported, #lastChild, #localname, #makeXPath, #makeXPointer, #namespaceURI, #nextSibling, #nodeValue, #nodeValue=, #ownerDocument, #ownerDocument=, #parentNode, #parentNode=, #prefix, #prefix=, #previousSibling, #removeChild, #replaceChild, #trim

Constructor Details

#initialize(name, *children) ⇒ EntityReference

Class Methods

--- EntityReference.new(name, *children)

creates a new EntityReference.



3029
3030
3031
3032
3033
# File 'lib/xml/dom/core.rb', line 3029

def initialize(name, *children)
  super(*children)
  raise "parameter error" if !name
  @name = name.freeze
end

Instance Method Details

#_checkNode(node) ⇒ Object



3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
# File 'lib/xml/dom/core.rb', line 3095

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

#cloneNode(deep = true) ⇒ Object

DOM


3091
3092
3093
# File 'lib/xml/dom/core.rb', line 3091

def cloneNode(deep = true)
  super(deep, @name)
end

#dump(depth = 0) ⇒ Object

— EntityReference#dump(depth = 0)

dumps the EntityReference.



3074
3075
3076
3077
3078
3079
3080
3081
3082
# File 'lib/xml/dom/core.rb', line 3074

def dump(depth = 0)
  print ' ' * depth * 2
  print "&#{@name}{\n"
  @children.each do |child|
    child.dump(depth + 1)
  end if @children
  print ' ' * depth * 2
  print "}\n"
end

#nodeNameObject

DOM


3055
3056
3057
# File 'lib/xml/dom/core.rb', line 3055

def nodeName
  @name
end

#nodeTypeObject

DOM


3044
3045
3046
# File 'lib/xml/dom/core.rb', line 3044

def nodeType
  ENTITY_REFERENCE_NODE
end

#to_sObject

reference form or expanded form?



3065
3066
3067
# File 'lib/xml/dom/core.rb', line 3065

def to_s
  "&#{@name};"
end