14 May '12, 1am


Nokogiri builder can be used for building XML and HTML documents. Synopsis: builder = Nokogiri::XML::Builder.new do |xml| xml.root { xml.products { xml.widget { xml.id_ "10" xml.name "Awesome widget" } } } end puts builder.to_xml Will output: <?xml version="1.0"?> <root> <products> <widget> <id>10</id> <name>Awesome widget</name> </widget> </products> </root> Builder scope The builder allows two forms. When the builder is supplied with a block that has a parameter, the outside scope is maintained. This means you can access variables that are outside your builder. If you don’t need outside scope, you can use the builder without the “xml” prefix like this: builder = Nokogiri::XML::Builder.new do root { products { widget { id_ "10" name "Awesome widget" } } } end Special Tags The builder works by taking advantage of method_missing. Unfortunately some methods are defined in ru...

Full article: http://nokogiri.org/Nokogiri/XML/Builder.html


nokogiri | | your community gem host:

rubygems.org 14 May '12, 8pm

Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser. Among Nokogiri's many features is the ability to search documents vi...

Nokogiriにcanonicalizeいつから載ってたんだ? #matsuerb

nokogiri.org 19 May '12, 6am

static VALUE add_namespace_definition(VALUE self, VALUE prefix, VALUE href) { xmlNodePtr node, namespacee; xmlNsPtr ns; Da...


nokogiri.org 03 May '12, 5am

Nokogiri::CSS::Tokenizer::ScanError Nokogiri::Decorators Nokogiri::Decorators::Slop Nokogiri::EncodingHandler Nokogiri::HT...