new( first, parent=nil )
public
Constructor
dt = DocType.new( 'foo', '-//I/Hate/External/IDs' )
dt = DocType.new( doctype_to_clone )
Note that the constructor:
Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
is deprecated. Do not use it. It will probably disappear.
Show source
def initialize( first, parent=nil )
@entities = DEFAULT_ENTITIES
@long_name = @uri = nil
if first.kind_of? String
super()
@name = first
@external_id = parent
elsif first.kind_of? DocType
super( parent )
@name = first.name
@external_id = first.external_id
elsif first.kind_of? Array
super( parent )
@name = first[0]
@external_id = first[1]
@long_name = first[2]
@uri = first[3]
elsif first.kind_of? Source
super( parent )
parser = Parsers::BaseParser.new( first )
event = parser.pull
if event[0] == :start_doctype
@name, @external_id, @long_name, @uri, = event[1..-1]
end
else
super()
end
end