Programmatic way to find the bad spot in a YAML file?

I have a very large YAML file (approx 5000 entries) that I am loading.
Somewhere along the way, it doesn't like something in the file so I
get a :

/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/
lib/ruby/1.8/yaml.rb:133:in `utc': time out of range (ArgumentError)
        from /Applications/Locomotive2/Bundles/
standardRailsMar2007.locobundle/i386/lib/ruby/1.8/yaml.rb:133:in
`node_import'
        from /Applications/Locomotive2/Bundles/
standardRailsMar2007.locobundle/i386/lib/ruby/1.8/yaml.rb:133:in
`load'
        from /Applications/Locomotive2/Bundles/
standardRailsMar2007.locobundle/i386/lib/ruby/1.8/yaml.rb:133:in
`load'

Which is all well and good but it doesn't give me the offending line
in the YAML file. Anyone write anything out there that helps pinpoint
where in your YAML file things went south?

Thanks,

Scott

[CC'd to the YAML-core list]

Scott wrote:

I have a very large YAML file (approx 5000 entries) that I am loading.
Somewhere along the way, it doesn't like something in the file so I
get a :

/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/
lib/ruby/1.8/yaml.rb:133:in `utc': time out of range (ArgumentError)

Which is all well and good but it doesn't give me the offending line
in the YAML file. Anyone write anything out there that helps pinpoint
where in your YAML file things went south?

I asked this before and got nothing. Syck simply needs a new feature. YAML is not useful until its parsing becomes fault-tolerance and introspective.

Workaround: Can you cut your file up into 5000 files of 1 entry each? Seriously - to make one file out of them, I would host each segment in >cough< XML.

Also, you could try a JSON parser...

There is another "C" version of YAML which is quite fast and gives very
good exception reporting, at http://pyyaml.org/wiki/LibYAML, perhaps it
needs a ruby binding? For a pure ruby solution, see http://rbyaml.rubyforge.org/
it should also have better error reporting than syck.