Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
roxml in non-rails?
Pito Salas
2/11/2009 9:02:00 PM
I have to generate some xml and have been doing a bit of a survey of
available libraries.
Roxml seems good to me. But I can't get it to work. Does it depend in
some subtle way on Rails?
For example, this simple code doesn't work for me:
require 'rubygems'
require 'roxml'
module Opml
attr_accessor :text, :type, :xmlUrl
class Outline
include ROXML
xml_reader :text
xml_reader :type
xml_reader :xmlUrl
end
end
include Opml
x = Outline.new
x.text = "abbc"
puts x.to_xml
... It throws: undefined method â??new_elementâ?? for
LibXML::XML::Node:Class
Anyone know?
--
Posted via
http://www.ruby-...
.
1 Answer
Ben Woosley
2/19/2009 2:28:00 AM
0
On Feb 11, 4:02=A0pm, Pito Salas <r...@salas.com> wrote:
> I have to generate some xml and have been doing a bit of a survey of
> available libraries.
>
> Roxmlseems good to me. But I can't get it to work. Does it depend in
> some subtle way on Rails?
>
> For example, this simple code doesn't work for me:
>
> require 'rubygems'
> require 'roxml'
>
> module Opml
> =A0 attr_accessor :text, :type, :xmlUrl
>
> =A0 class Outline
> =A0 =A0 includeROXML
> =A0 =A0 xml_reader :text
> =A0 =A0 xml_reader :type
> =A0 =A0 xml_reader :xmlUrl
> =A0 end
> end
>
> include Opml
>
> x =3D Outline.new
> x.text =3D "abbc"
> puts x.to_xml
>
> ... It throws: undefined method =91new_element=92 for
> LibXML::XML::Node:Class
>
> Anyone know?
> --
> Posted via
http://www.ruby-...
.
Hey Pito,
Unfortunately, I'd had an old copy of libxml installed outside of
rubygems which was conflicting and overriding my more recent rubygems
versions, so I was only testing against the old 0.8.3 version.
Once I corrected that, I was able to reproduce your problem, and I've
since fixed it on my development branch (
http://github.c...
roxml/). You can get it there, or wait a bit for the official 2.5 to
go up on rubyforge.
Thanks for the post!
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
roxml in non-rails?
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password