Skip to content

Instantly share code, notes, and snippets.

Created August 18, 2012 13:22
Show Gist options
  • Save anonymous/668a087f1e2cccd938d6 to your computer and use it in GitHub Desktop.
Save anonymous/668a087f1e2cccd938d6 to your computer and use it in GitHub Desktop.
Error during parsing long XML attribute
#<REXML::ParseException: Missing end tag for '' (got "script")
Line:
Position:
Last 80 unconsumed characters:
<script src="/ScriptResource.axd?d=7U-Er19kh_JjK1ubeNNVTSx9__awLZxWmG0GmOECsKCy77>
/usr/lib/ruby/1.8/rexml/parsers/baseparser.rb:330:in `pull'
/usr/lib/ruby/1.8/rexml/parsers/treeparser.rb:22:in `parse'
/usr/lib/ruby/1.8/rexml/document.rb:228:in `build'
/usr/lib/ruby/1.8/rexml/document.rb:43:in `initialize'
pizdets.rb:421:in `new'
pizdets.rb:421:in `parse_script_tag'
pizdets.rb:456:in `get_ciphertext_sample'
pizdets.rb:440:in `each'
pizdets.rb:440:in `get_ciphertext_sample'
pizdets.rb:605:in `run'
pizdets.rb:637
...
Missing end tag for '' (got "script")
Line:
Position:
Last 80 unconsumed characters:
<script src="/ScriptResource.axd?d=7U-Er19kh_JjK1ubeNNVTSx9__awLZxWmG0GmOECsKCy77
Line:
Position:
Last 80 unconsumed characters:
<script src="/ScriptResource.axd?d=7U-Er19kh_JjK1ubeNNVTSx9__awLZxWmG0GmOECsKCy77
# line 421 is doc = REXML::Document.new xml
def parse_script_tag xml, re
d = nil
doc = REXML::Document.new xml
doc.elements.each 'script' do |e|
src_attribute = e.attributes['src']
md = re.match src_attribute
d = md[1]
break
end
raise RuntimeError, "could not parse script_tag" unless d
d
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment