Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danini-the-panini/tag_monster
EAT ALL THE TAGS!
https://github.com/danini-the-panini/tag_monster
Last synced: 15 days ago
JSON representation
EAT ALL THE TAGS!
- Host: GitHub
- URL: https://github.com/danini-the-panini/tag_monster
- Owner: danini-the-panini
- License: mit
- Created: 2014-10-28T17:42:23.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-01-22T19:29:06.000Z (almost 10 years ago)
- Last Synced: 2023-06-11T05:35:18.130Z (over 1 year ago)
- Language: Ruby
- Size: 145 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Tag Monster!
Tag monster helps you extract information from enormous XML files without eating up all your memory and knocking your server over. It does this by going through the file one tag at a time without loading the whole thing in memory, so you can data mine the crap out of those massive XML files you got from who-knows-where.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'tag_monster'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install tag_monster
## Usage
Given this XML:
```xml
Foo
100
Bob
Larry
Bar
250
Sally
...```
And this ruby:
```ruby
doc = TagMonster::Document.new input_streamdoc.each_element '/root/entity' do |element|
id = element.attributes['id']
data = element.extract name: '/name', price: '/product/price', units: '/product/units/unit'
name = data[:name][0]
price = data[:price][0]
units = data[:units]end
```You'll get the following values:
```ruby
id = "1"
name = "Foo"
price = "100"
units = ["Bob","Larry"]id = "2"
name = "Bar"
price = "250"
units = ["Sally"]...
```## Limitations
Currently can only be used for simple XML processing.
## Contributing
1. Fork it ( https://github.com/[my-github-username]/tag_remover/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request