Changeset 219:68433480f3f5
- Timestamp:
- 04/25/03 00:39:07 (6 years ago)
- Author:
- ser
- Branch:
- 3.0
- convert_revision:
- svn:877f57f0-f5bd-0310-8c13-bb9e5bdefd87/rexml/branches/3.0@781
- Message:
-
* Lightparser needed a rewind method.
* Fixes to base parser, and improved error reporting.
* Fixes to require_with_version, to allow it to grab the highest version of
a package even when not specifically asked for.
* Minor doc fixes -- not the ones we really need.
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r206
|
r219
|
|
| 1 | | Run bin/install.rb |
| | 1 | Run "bin/install.rb --help" |
| | 2 | |
| | 3 | If you want to upgrade REXML (or install it as the default version of REXML) |
| | 4 | run install.rb with no arguments. If you want to have multiple versions of |
| | 5 | REXML installed at the same time, run install.rb with the "-c" argument. If |
| | 6 | you do this, you will need to require REXML differently, since you will need |
| | 7 | a "require" command that supports versioning. This is installed with REXML; |
| | 8 | all you need to do is: |
| | 9 | |
| | 10 | require "require_with_version" |
| | 11 | require "rexml" |
| | 12 | |
| | 13 | or |
| | 14 | |
| | 15 | require( "rexml" ) { |v| v >= "2.7" } |
| | 16 | |
| | 17 | to place restrictions on the version of REXML that you are loading. |
-
|
r202
|
r219
|
|
| 31 | 31 | http://www.germane-software.com/software/rexml_doc_ja. |
| 32 | 32 | |
| | 33 | This is the third major iteration of REXML. |
| | 34 | |
| 33 | 35 | --- SER |
-
|
r218
|
r219
|
|
| 91 | 91 | base = File.basename( file ) |
| 92 | 92 | files = [] |
| | 93 | $:.each {|dir| |
| | 94 | files += Dir.new(dir).entries.delete_if {|f| |
| | 95 | fpath = File.join( dir, f ) |
| | 96 | f !~ /^#{package}/ or !File.directory?(fpath) or |
| | 97 | Dir.new(fpath).entries.include?( file+".rb" ) |
| | 98 | } if File.exists? dir |
| | 99 | } |
| | 100 | files.uniq! |
| 93 | 101 | if b #block_given? |
| 94 | | $:.each {|dir| |
| 95 | | files += Dir.new(dir).entries.delete_if {|f| |
| 96 | | f !~ /^#{package}/ |
| 97 | | } if File.exists? dir |
| 98 | | } |
| 99 | | files.uniq! |
| 100 | 102 | files = files.delete_if { |f| |
| 101 | 103 | (f.include?('-') and yield( Version.new( f.split('-')[1] ) )) ? false : true |
| 102 | 104 | } |
| 103 | 105 | end |
| | 106 | p files |
| 104 | 107 | if files.size > 0 |
| 105 | 108 | files = files.sort |
| 106 | 109 | files.reverse! |
| 107 | | #puts <<-EOL |
| | 110 | #puts <<-EOL |
| 108 | 111 | old_require "#{files[0]}/#{base}" |
| 109 | | #EOL |
| | 112 | #EOL |
| 110 | 113 | else |
| 111 | | #puts <<-EOL |
| | 114 | #puts <<-EOL |
| 112 | 115 | old_require "#{file}" |
| 113 | | #EOL |
| | 116 | #EOL |
| 114 | 117 | end |
| 115 | 118 | end |
-
|
r217
|
r219
|
|
| 1 | 1 | require 'rexml/parseexception' |
| | 2 | require 'rexml/source' |
| 2 | 3 | |
| 3 | 4 | module REXML |
| … |
… |
|
| 274 | 275 | last_tag = @tags.pop |
| 275 | 276 | md = @source.match( CLOSE_MATCH, true ) |
| 276 | | raise REXML::ParseException.new( "Missing end tag for #{last_tag} "+ |
| | 277 | raise REXML::ParseException.new( "Missing end tag for '#{last_tag}' "+ |
| 277 | 278 | "(got \"#{md[1]}\")", @source) unless last_tag == md[1] |
| 278 | 279 | return [ :end_element, last_tag ] |
| … |
… |
|
| 319 | 320 | return [ :text, md[1] ] |
| 320 | 321 | end |
| | 322 | rescue REXML::ParseException |
| | 323 | raise $! |
| 321 | 324 | rescue Exception, NameError => error |
| 322 | | raise REXML::ParseException.new( "Exception parsing", |
| | 325 | raise REXML::ParseException.new( "Exception parsing", |
| 323 | 326 | @source, self, error ) |
| 324 | 327 | end |
-
|
r217
|
r219
|
|
| 10 | 10 | end |
| 11 | 11 | |
| | 12 | def rewind |
| | 13 | @stream.rewind |
| | 14 | @parser.stream = @stream |
| | 15 | end |
| | 16 | |
| 12 | 17 | def parse |
| 13 | | @parser.stream = @stream |
| 14 | 18 | root = context = [] |
| 15 | 19 | while true |