class XML::DOM::DocumentType

Class XML::DOM::DocumentType

superclass

Node

Class XML::DOM::DocumentType

superclass

Node

Public Class Methods

new(name, value = nil, *children) click to toggle source

Class Methods

Calls superclass method XML::DOM::Node::new
# File lib/xml/dom/core.rb, line 2747
def initialize(name, value = nil, *children)
  super(*children)
  raise "parameter error" if !name
  @name = name.freeze
  @value = value.freeze
end

Public Instance Methods

cloneNode(deep = true) click to toggle source
Calls superclass method XML::DOM::Node#cloneNode
# File lib/xml/dom/core.rb, line 2831
def cloneNode(deep = true)
  super(deep, @name, @value)
end
dump(depth = 0) click to toggle source
# File lib/xml/dom/core.rb, line 2808
def dump(depth = 0)
  print ' ' * depth * 2
  print "<!DOCTYPE #{@name} #{@value} [\n"
  @children.each do |child|
    print ' ' * (depth + 1) * 2
    if child.nodeType == PROCESSING_INSTRUCTION_NODE ||
        child.nodeType == COMMENT_NODE
      child.dump
    else
      print child.nodeValue, "\n"
    end
  end if @children
  print ' ' * depth * 2
  print "]>\n"
end
internalSubset() click to toggle source
DOM2
# File lib/xml/dom2/documenttype.rb, line 98
def internalSubset; end
nodeName() click to toggle source
# File lib/xml/dom/core.rb, line 2774
def nodeName
  @name
end
nodeType() click to toggle source

Methods

# File lib/xml/dom/core.rb, line 2763
def nodeType
  DOCUMENT_TYPE_NODE
end
publicId() click to toggle source
DOM2
# File lib/xml/dom2/documenttype.rb, line 92
def publicId; @pubid; end
systemId() click to toggle source
DOM2
# File lib/xml/dom2/documenttype.rb, line 95
def systemId; @sysid; end
to_s() click to toggle source
# File lib/xml/dom/core.rb, line 2783
def to_s
  ret = "<!DOCTYPE " + @name
  if !@value.nil?
    ret <<= " " + @value
  end
  if !@children.nil? && @children.length > 0
    ret <<= " [\n"
    @children.each do |child|
      if child.nodeType == PROCESSING_INSTRUCTION_NODE ||
          child.nodeType == COMMENT_NODE
        ret <<= child.to_s + "\n"
      else
        ret <<= child.nodeValue + "\n"
      end
    end
    ret <<= "]"
  end
  ret <<= ">"
end