Skip to content

Instantly share code, notes, and snippets.

@headius
Created December 15, 2008 06:11
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 headius/35895 to your computer and use it in GitHub Desktop.
Save headius/35895 to your computer and use it in GitHub Desktop.
◆ jruby -I ext:lib -rnokogiri -e "xml = %{<bar a='1'><\!--foo-->baz<\![CDATA[yum]]></bar>}; parser = Nokogiri::XML::SAX::Parser.new; def parser.method_missing(name, *args); p name, args; end; parser.parse_memory(xml)"
:start_document
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>]
:start_element
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "bar", ["a", "1"]]
:comment
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "foo"]
:characters
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "baz"]
:cdata_block
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "yum"]
:end_element
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>, "bar"]
:start_document
[#<Nokogiri::XML::SAX::Document:0x452c0b3f>]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment