README example on using Enumerator for input.

This commit is contained in:
Yorick Peterse 2014-11-17 23:59:30 +01:00
parent b8f9d04b17
commit f88df486ba
1 changed files with 10 additions and 0 deletions

View File

@ -44,6 +44,16 @@ Parsing an IO handle using the pull parser:
end
end
Using an Enumerator to download and parse an XML document on the fly:
enum = Enumerator.new do |yielder|
HTTPClient.get('http://some-website.com/some-big-file.xml') do |chunk|
yielder << chunk
end
end
document = Oga.parse_xml(enum)
Parse a string of XML using the SAX parser:
class ElementNames