mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Cross-ported the REXML changes from HEAD to the 1.8 branch.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8486 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d4d497dd86
commit
ed512acb2f
23 changed files with 1332 additions and 1036 deletions
|
@ -12,6 +12,7 @@ module REXML
|
|||
@namespace_stack = []
|
||||
@has_listeners = false
|
||||
@tag_stack = []
|
||||
@entities = {}
|
||||
end
|
||||
|
||||
def add_listener( listener )
|
||||
|
@ -143,10 +144,21 @@ module REXML
|
|||
end
|
||||
end
|
||||
when :text
|
||||
normalized = @parser.normalize( event[1] )
|
||||
handle( :characters, normalized )
|
||||
#normalized = @parser.normalize( event[1] )
|
||||
#handle( :characters, normalized )
|
||||
copy = event[1].clone
|
||||
@entities.each { |key, value| copy = copy.gsub("&#{key};", value) }
|
||||
copy.gsub!( Text::NUMERICENTITY ) {|m|
|
||||
m=$1
|
||||
m = "0#{m}" if m[0] == ?x
|
||||
[Integer(m)].pack('U*')
|
||||
}
|
||||
handle( :characters, copy )
|
||||
when :entitydecl
|
||||
@entities[ event[1] ] = event[2] if event.size == 3
|
||||
handle( *event )
|
||||
when :processing_instruction, :comment, :doctype, :attlistdecl,
|
||||
:elementdecl, :entitydecl, :cdata, :notationdecl, :xmldecl
|
||||
:elementdecl, :cdata, :notationdecl, :xmldecl
|
||||
handle( *event )
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue