XML file using Nokogiri gem

Hello friends,

Can you guys give me some idea about how to Create XML file using
Nokogiri gem.

Ghanshyam Rathod wrote:

Can you guys give me some idea about how to Create XML file using
Nokogiri gem.

I could be wrong, but isn’t Nokogiri used for parsing and searching XML?
I think you should be using Builder for creating XML documents:

http://www.railsbrain.com/api/rails-2.3.2/doc/index.html?a=C00000654&name=Builder#

On Thu, Oct 22, 2009 at 10:32 AM, Robert W.
[email protected] wrote:

Ghanshyam Rathod wrote:

Can you guys give me some idea about how to Create XML file using
Nokogiri gem.

I could be wrong, but isn’t Nokogiri used for parsing and searching XML?
I think you should be using Builder for creating XML documents:

Nokogiri includes a builder mechanism, too. Here’s some example code
Ghanshyam:

http://github.com/kete/kete/blob/master/lib/workers/excel_based_importer_worker.rb

starting at line 56

Cheers,
Walter
Kete Project Lead

Walter McGinnis wrote:

On Thu, Oct 22, 2009 at 10:32 AM, Robert W.
[email protected] wrote:

Ghanshyam Rathod wrote:

Can you guys give me some idea about how to Create XML file using
Nokogiri gem.

I could be wrong, but isn’t Nokogiri used for parsing and searching XML?
I think you should be using Builder for creating XML documents:

Nokogiri includes a builder mechanism, too. Here’s some example code
Ghanshyam:

http://github.com/kete/kete/blob/master/lib/workers/excel_based_importer_worker.rb

starting at line 56

Cheers,
Walter
Kete Project Lead

Hi cheers,

I m using Builder for Nokogiri (Nokogiri::XML::Builder.new).
But i m facing problem with displaying XML file in view.

see the code i have used http://pastie.org/663424.
http://nokogiri.rubyforge.org/nokogiri/Nokogiri/XML/Builder.html

Please give me guide for displaying XML file.

Ghanshyam Rathod wrote:

I m using Builder for Nokogiri (Nokogiri::XML::Builder.new).
But i m facing problem with displaying XML file in view.

see the code i have used http://pastie.org/663424.

Are you already using Nokogiri in other parts of your application? If
not then why force the dependency on it just to render that tiny bit of
XML? The built-in XML Builder would work just fine for that.

http://nokogiri.rubyforge.org/nokogiri/Nokogiri/XML/Builder.html

Please give me guide for displaying XML file.

Can you clarify? Do you mean that you’re having trouble rendering the
XML response? Displaying XML doesn’t make a lot of sense. Browsers
render HTML/XHTML not XML (well okay some browsers do as a convenience
for development, but that’s not intended for “normal” web use).

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs