new(stream, value=nil, parent=nil, reference=false)public
Create a new entity. Simple entities can be constructed by passing a name, value to the constructor; this creates a generic, plain entity reference. For anything more complicated, you have to pass a Source to the constructor with the entity definition, or use the accessor methods. WARNING: There is no validation of entity state except when the entity is read from a stream. If you start poking around with the accessors, you can easily create a non-conformant Entity. The best thing to do is dump the stupid DTDs and use XMLSchema instead.
# File lib/rexml/entity.rb, line 35 def initialize stream, value=nil, parent=nil, reference=false super(parent) @ndata = @pubid = @value = @external = nil if stream.kind_of? Array @name = stream if stream[-1] == '%' @reference = true stream.pop else @reference = false end if stream =~ /SYSTEM|PUBLIC/ @external = stream if @external == 'SYSTEM' @ref = stream @ndata = stream if stream.size == 5 else @pubid = stream @ref = stream end else @value = stream end else @reference = reference @external = nil @name = stream @value = value end end