Class: HTML5::TreeBuilders::REXML::DocumentType

Inherits:
Node show all
Defined in:
lib/html5/treebuilders/rexml.rb

Instance Attribute Summary

Attributes inherited from Node

#rxobj

Attributes inherited from Base::Node

#childNodes, #flags, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#appendChild, #hasContent, #insertBefore, #insertText, #removeChild

Methods inherited from Base::Node

#appendChild, #cloneNode, #hasContent, #insertBefore, #insertText, #removeChild, #reparentChildren

Constructor Details

#initialize(name, public_id, system_id) ⇒ DocumentType

Returns a new instance of DocumentType.



130
131
132
133
134
135
136
137
138
139
# File 'lib/html5/treebuilders/rexml.rb', line 130

def initialize name, public_id, system_id
  super(name)
  if public_id
    @rxobj = ::REXML::DocType.new [name, ::REXML::DocType::PUBLIC, public_id, system_id]
  elsif system_id
    @rxobj = ::REXML::DocType.new [name, ::REXML::DocType::SYSTEM, nil, system_id]
  else
    @rxobj = ::REXML::DocType.new name
  end
end

Class Method Details

.rxclassObject



126
127
128
# File 'lib/html5/treebuilders/rexml.rb', line 126

def self.rxclass
  ::REXML::DocType
end

Instance Method Details

#printTree(indent = 0) ⇒ Object



141
142
143
# File 'lib/html5/treebuilders/rexml.rb', line 141

def printTree indent=0
  "\n|#{' ' * indent}<!DOCTYPE #{name}" + ([public_id, system_id].any? ? " \"#{public_id}\" \"#{system_id}\"" : "") + ">"
end