Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/delano/saxony
Parse gigantic XML files with pleasure and without running out of memory. (NOT MAINTAINED)
https://github.com/delano/saxony
Last synced: 2 months ago
JSON representation
Parse gigantic XML files with pleasure and without running out of memory. (NOT MAINTAINED)
- Host: GitHub
- URL: https://github.com/delano/saxony
- Owner: delano
- License: mit
- Created: 2010-01-31T20:04:00.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2010-02-20T17:55:41.000Z (almost 15 years ago)
- Last Synced: 2024-05-01T23:13:27.997Z (8 months ago)
- Language: Ruby
- Homepage:
- Size: 156 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
## Saxony - 0.3 ##
**Parse gigantic XML files with pleasure and without running out of memory.**
## Example ##
sax = Saxony.new :SomeObject, 1000
sax.parse 'path/2/huge.xml' do
xml # => The XML containing 1000 SomeObjects
doc # => Nokogiri object for 1000 SomeObjects
total_count # => Total number of SomeObjects processed
elapsed_time # => time processing current batch
path # => Current file being processed
fh # => Output file handle
end
# Process multiple files in parallel using Kernel.proc.
# By default
Saxony.fork ['path/2/huge.xml', 'path/2/huger.xml'] do
# Inside the block, everything is the
# same as calling sax.parse above.
doc.xpath('//Listing').each do |l
type = listing.xpath("Type").first.text
fh.puts listing if type == 'some_criteria'
end
end
## Credits* Delano Mandelbaum (http://solutious.com)
## Thanks
* [Nokogiri](http://nokogiri.org/)
## License
See LICENSE.txt