summaryrefslogtreecommitdiff
path: root/lib/rexml
diff options
context:
space:
mode:
authorkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-11 09:42:37 +0000
committerkou <kou@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-11 09:42:37 +0000
commit8328d8a2b72bc37778a2ca9d8a82c205d08dfa4c (patch)
treec32ae13e480ccb435538debbe6da4a8384ba0506 /lib/rexml
parent7e0022bc8e89cd125f5fe97bc81a169d72d912e9 (diff)
* lib/rexml/parsers/sax2parser.rb
(REXML::Parsers::SAX2Parser#handle_entitydecl): Extract. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml')
-rw-r--r--lib/rexml/parsers/sax2parser.rb52
1 files changed, 28 insertions, 24 deletions
diff --git a/lib/rexml/parsers/sax2parser.rb b/lib/rexml/parsers/sax2parser.rb
index 5e0f0fb..46ea8fa 100644
--- a/lib/rexml/parsers/sax2parser.rb
+++ b/lib/rexml/parsers/sax2parser.rb
@@ -176,30 +176,7 @@ module REXML
}
handle( :characters, copy )
when :entitydecl
- @entities[ event[1] ] = event[2] if event.size == 3
- parameter_reference_p = false
- case event[2]
- when "SYSTEM"
- if event.size == 5
- if event.last == "%"
- parameter_reference_p = true
- else
- event[4, 0] = "NDATA"
- end
- end
- when "PUBLIC"
- if event.size == 6
- if event.last == "%"
- parameter_reference_p = true
- else
- event[5, 0] = "NDATA"
- end
- end
- else
- parameter_reference_p = (event.size == 4)
- end
- event[1, 0] = event.pop if parameter_reference_p
- handle( event[0], event[1..-1] )
+ handle_entitydecl( event )
when :processing_instruction, :comment, :attlistdecl,
:elementdecl, :cdata, :notationdecl, :xmldecl
handle( *event )
@@ -220,6 +197,33 @@ module REXML
} if listeners
end
+ def handle_entitydecl( event )
+ @entities[ event[1] ] = event[2] if event.size == 3
+ parameter_reference_p = false
+ case event[2]
+ when "SYSTEM"
+ if event.size == 5
+ if event.last == "%"
+ parameter_reference_p = true
+ else
+ event[4, 0] = "NDATA"
+ end
+ end
+ when "PUBLIC"
+ if event.size == 6
+ if event.last == "%"
+ parameter_reference_p = true
+ else
+ event[5, 0] = "NDATA"
+ end
+ end
+ else
+ parameter_reference_p = (event.size == 4)
+ end
+ event[1, 0] = event.pop if parameter_reference_p
+ handle( event[0], event[1..-1] )
+ end
+
# The following methods are duplicates, but it is faster than using
# a helper
def get_procs( symbol, name )