class XML::DOM::Comment

Class XML::DOM::Comment

superclass

CharacterData

Class XML::DOM::Comment

superclass

CharacterData

Public Class Methods

new(text = nil) click to toggle source

Class Methods

Calls superclass method XML::DOM::CharacterData::new
# File lib/xml/dom/core.rb, line 2588
def initialize(text = nil)
  super(text)
  raise "parameter error" if !text
end

Public Instance Methods

_getMyLocation(parent) click to toggle source
# File lib/xml/dom/core.rb, line 2638
def _getMyLocation(parent)
  index = 1
  parent.childNodes do |child|
    if child == self
      return "child(#{index},#comment)"
    end
    if child.nodeType == COMMENT_NODE
      index += 1
    end
  end
  nil
end
_getMyLocationInXPath(parent) click to toggle source
# File lib/xml/dom2/xpath.rb, line 364
def _getMyLocationInXPath(parent)
  n = parent.childNodes.to_a.select { |i|
    i.nodeType == COMMENT_NODE
  }.index(self)
  "comment()[#{n + 1}]"
end
dump(depth = 0) click to toggle source
# File lib/xml/dom/core.rb, line 2633
def dump(depth = 0)
  print ' ' * depth * 2
  print "<!--#{@value.inspect}-->\n"
end
nodeName() click to toggle source
# File lib/xml/dom/core.rb, line 2613
def nodeName
  "#comment"
end
nodeType() click to toggle source

Methods

# File lib/xml/dom/core.rb, line 2602
def nodeType
  COMMENT_NODE
end
to_s() click to toggle source
# File lib/xml/dom/core.rb, line 2622
def to_s
  ret = "<!--#{@value}-->"
  ret << "\n" if parentNode.nodeType == DOCUMENT_NODE
  ret
end