Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > xml parsing in ruby

Thread Tools

xml parsing in ruby

Saleem Vighio
Posts: n/a

I am very new to ruby language and have problem in xml parsing in ruby.
Please help. The problem is to parse an xml file(xmlfile.xml) in ruby
that should generate a code which should look like as under:

<declaration>typedef int[0,2] StateTC;
const StateTC TC_ACTIVE = 0;
const StateTC TC_COMPLETING = 1;
const StateTC TC_ENDED = 2;


typedef int[0,2] StateP;
const StateP P_ACTIVE = 0;
const StateP P_COMPLETING = 1;
const StateP P_ENDED = 2;

StateP stP = P_ACTIVE;

typedef int[0,1] MsgsTC;
const MsgsTC PREPARE_TC = 0;
bool msgsTc[MsgsTC];

typedef int[0,1] MsgsP;
const MsgsP COMPLETE_P = 0;
bool msgsP[MsgsP];


I attach 2 files: xmlfile(source file), and rubyfile(my try) . Can you
please help me in writing ruby code that generates output as shown above
from xmlfile.

Thanks in advance.



Posted via

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
What libraries should I use for MIME parsing, XML parsing, and MySQL ? John Levine Ruby 0 02-02-2012 11:15 PM
Different results parsing a XML file with XML::Simple (XML::Sax vs. XML::Parser) Erik Wasser Perl Misc 5 03-05-2006 10:09 PM
Sequential XML parsing with xml.sax Python 2 08-24-2005 01:29 AM
Clarification on XML parsing & namespaces (xml.dom.minidom) Greg Wogan-Browne Python 1 01-28-2005 03:19 AM
Print XML parsing to JspWriter (out) Class org.xml.sax.helpers.NewInstance can not access a member of class javax.xml.parsers.SAXParser with modifiers "protected" Per Magnus L?vold Java 0 11-15-2004 02:27 PM