# File rexml/entity.rb, line 36
  def initialize stream, value=nil, parent=nil
			super(parent)
			@reference = false
			@external = nil
			if stream.kind_of? Source
				match = stream.match( ENTITYDECL, true ).to_a.compact
				# Now we have to sort out what kind of entity reference this is,
				# and dereference any internal entities
				if match.include? '%'
					# Reference entity
					@reference = true
					match.delete '%'
				end
				@value = nil
				if match.include? 'SYSTEM'
					# External reference
					@external = 'SYSTEM'
					match.delete @external
					@ref = match[2][1..-2]
					@pubid = @ndata = nil
					@ndata = match[-1] if match.size == 5
				elsif match.include? 'PUBLIC'
					# External reference
					@external = 'PUBLIC'
					match.delete @external
					@pubid = match[2][1..-2]
					@ref = match[3][1..-2]
					@ndata = nil
				else
					@value = match[2][1..-2]
				end
				@name = match[1]
			elsif stream.kind_of? String
				@name = stream
				@value = value
			end
		end