value()
public
Returns the value of this entity.
At the moment, only internal entities are processed. If the value contains internal references (IE,
%blah;), those are replaced with their values. IE, if the doctype
contains:
<!ENTITY % foo "bar">
<!ENTITY yada "nanoo %foo; nanoo>
then:
doctype.entity('yada').value
Show source
def value
if @value
matches = @value.scan(PEREFERENCE_RE)
rv = @value.clone
if @parent
sum = 0
matches.each do |entity_reference|
entity_value = @parent.entity( entity_reference[0] )
if sum + entity_value.bytesize > Security.entity_expansion_text_limit
raise "entity expansion has grown too large"
else
sum += entity_value.bytesize
end
rv.gsub!( /%#{entity_reference.join};/m, entity_value )
end
end
return rv
end
nil
end