diff options
author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-23 15:44:30 +0000 |
---|---|---|
committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-23 15:44:30 +0000 |
commit | 73fca1e1868fd8e7b3874cf644d88a8d1134eb04 (patch) | |
tree | b2ee8d4e0c6f78c96cfa26c1d2a754e12fc82151 /lib/rexml/source.rb | |
parent | dc5a8c07f65ac4a8a8542ac59b13cd8a130d8061 (diff) | |
download | ruby-73fca1e1868fd8e7b3874cf644d88a8d1134eb04.tar.gz ruby-73fca1e1868fd8e7b3874cf644d88a8d1134eb04.tar.xz ruby-73fca1e1868fd8e7b3874cf644d88a8d1134eb04.zip |
* Non-String attributes are now converted to Strings; this means code such as
elem.attributes["a"] = 1
will not cause an error when dumping the XML. It also means that:
elem.attributes["a"] # => "1", not 1
* Transitive indenting has been cleaned up.
* Fixed a potential bug in parsing non-ASCII encoded streams
* Fixed a bug where trying to fill in ParseException data was causing an
IO error (stream closed)
* Changes to Text mean that Element (and Text) can be used outside of a
Document context.
* In some rare cases, the base parser wasn't reading enough bytes from the
stream for the parsing algorithm to work properly. This has been fixed
(this was Ruby bug #48426)
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6209 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rexml/source.rb')
-rw-r--r-- | lib/rexml/source.rb | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/lib/rexml/source.rb b/lib/rexml/source.rb index a524e483e..ce10d03a6 100644 --- a/lib/rexml/source.rb +++ b/lib/rexml/source.rb @@ -150,7 +150,7 @@ module REXML def read begin - str = @source.readline('>') + str = @source.readline(@line_break) str = decode(str) if @to_utf and str @buffer << str rescue Exception, NameError @@ -167,7 +167,7 @@ module REXML @buffer = $' if cons and rv while !rv and @source begin - str = @source.readline('>') + str = @source.readline(@line_break) str = decode(str) if @to_utf and str @buffer << str rv = pattern.match(@buffer) @@ -186,17 +186,22 @@ module REXML # @return the current line in the source def current_line - pos = @er_source.pos # The byte position in the source - lineno = @er_source.lineno # The XML < position in the source - @er_source.rewind - line = 0 # The \r\n position in the source - begin - while @er_source.pos < pos - @er_source.readline - line += 1 - end - rescue - end + begin + pos = @er_source.pos # The byte position in the source + lineno = @er_source.lineno # The XML < position in the source + @er_source.rewind + line = 0 # The \r\n position in the source + begin + while @er_source.pos < pos + @er_source.readline + line += 1 + end + rescue + end + rescue IOError + pos = -1 + line = -1 + end [pos, lineno, line] end end |