summaryrefslogtreecommitdiff
path: root/lib/rexml/doctype.rb
diff options
context:
space:
mode:
authorser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-16 19:08:03 +0000
committerser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-05-16 19:08:03 +0000
commitabe1214b3dd57b3a24d722ba592146db8eaabd40 (patch)
tree5fbc86b061de7618c69e6469d18805f6b376cc1d /lib/rexml/doctype.rb
parentdb0fac02665cb9e1e638959733e9572c845b4710 (diff)
Cross-ported the REXML changes (3.0.8) from the development branch to the
stable branch. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/doctype.rb')
-rw-r--r--lib/rexml/doctype.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/rexml/doctype.rb b/lib/rexml/doctype.rb
index b523155f8f..652a04fce2 100644
--- a/lib/rexml/doctype.rb
+++ b/lib/rexml/doctype.rb
@@ -32,11 +32,12 @@ module REXML
# # <!DOCTYPE foo '-//I/Hate/External/IDs'>
# dt = DocType.new( doctype_to_clone )
# # Incomplete. Shallow clone of doctype
- # source = Source.new( '<!DOCTYPE foo "bar">' )
- # dt = DocType.new( source )
- # # <!DOCTYPE foo "bar">
- # dt = DocType.new( source, some_document )
- # # Creates a doctype, and adds to the supplied document
+ #
+ # +Note+ that the constructor:
+ #
+ # Doctype.new( Source.new( "<!DOCTYPE foo 'bar'>" ) )
+ #
+ # is _deprecated_. Do not use it. It will probably disappear.
def initialize( first, parent=nil )
@entities = DEFAULT_ENTITIES
@long_name = @uri = nil
@@ -54,6 +55,15 @@ module REXML
@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