Skip to content

Instantly share code, notes, and snippets.

@vangberg
Created August 25, 2008 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vangberg/7057 to your computer and use it in GitHub Desktop.
Save vangberg/7057 to your computer and use it in GitHub Desktop.
<?xml version="1.0" encoding="iso-8859-1"?>
<guides>
<guide>
<id>1</id>
<name>woo</name>
</guide>
<guide>
<id>2</id>
<name>foobar</name>
</guide>
<guide>
<id>3</id>
<name>Lolcat</name>
</guide>
</guides>
require 'hpricot'
x = '<?xml version="1.0" encoding="iso-8859-1"?>
<guides>
<guide>
<id>1</id>
<name>woo</name>
</guide>
<guide>
<id>2</id>
<name>foobar</name>
</guide>
<guide>
<id>3</id>
<name>Lolcat</name>
</guide>
</guides>'
doc = Hpricot.XML(x)
>> doc.at("/")
=> {xmldecl "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>"}
>> doc.at("/").next
=> "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment