roxml in non-rails?

Discussion in 'Ruby' started by Pito Salas, Feb 11, 2009.

  1. Pito Salas

    Pito Salas Guest

    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-forum.com/.
     
    Pito Salas, Feb 11, 2009
    #1
    1. Advertising

  2. Pito Salas

    Ben Woosley Guest

    On Feb 11, 4:02=A0pm, Pito Salas <> 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 viahttp://www.ruby-forum.com/.


    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.com/Empact/
    roxml/). You can get it there, or wait a bit for the official 2.5 to
    go up on rubyforge.

    Thanks for the post!
     
    Ben Woosley, Feb 19, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J. D.
    Replies:
    9
    Views:
    187
    Jamis Buck
    Nov 4, 2004
  2. Replies:
    6
    Views:
    197
    Michael Campbell
    Mar 17, 2005
  3. Xeno Campanoli
    Replies:
    1
    Views:
    152
    Xeno Campanoli
    May 29, 2008
  4. inriz

    roxml undefined method <<

    inriz, Feb 27, 2009, in forum: Ruby
    Replies:
    2
    Views:
    127
    Ben Woosley
    Mar 3, 2009
  5. Pavel Strnad

    ROXML encoding

    Pavel Strnad, Nov 16, 2009, in forum: Ruby
    Replies:
    2
    Views:
    128
    Pavel Strnad
    Nov 18, 2009
Loading...

Share This Page