LinuxMCE Forums

General => Developers => Topic started by: ddamron on November 21, 2007, 06:37:38 pm

Title: Request XML Data #869
Post by: ddamron on November 21, 2007, 06:37:38 pm
I am trying to write an interface for the EZBridge (IP/Insteon) using GSD/Ruby.

all of the commands to/from the EZBridge are in XML format.

I noticed, in the Datagrid Commands, seems like XML parsing is already supported.

I searched the wiki for XML with no hits.

Does anyone know how to use these commands and, if possible, give a 'sample'?

attempting simple commands first.. I'd like to send an XML msg and receive an XML msg back (most of the time, multiple XML msgs back)

Here's a sample xml msg I send to IP:port
<?xml version="1.0"?>
<command>SndIns
<parameter1>0x0B</parameter1>
<parameter2>0x71</parameter2>
<parameter3>0xAB</parameter3>
<parameter4>0x0F</parameter4>
<parameter5>0x11</parameter5>
<parameter6>0xFF</parameter6>
</command>

and the message(s) I get back:

<?xml version="1.0"?>
<Response> SndIns
<Parameter1>0X2</Parameter1>
<Parameter2>0X62</Parameter2>
<Parameter3>0XB</Parameter3>
<Parameter4>0X71</Parameter4>
<Parameter5>0XAB</Parameter5>
<Parameter6>0XF</Parameter6>
<Parameter7>0X11</Parameter7>
<Parameter8>0XFF</Parameter8>
<Parameter9>0X6</Parameter9>
</Response>

then...

<?xml version="1.0"?>
<Response> InsStdMsg
<Parameter1>0X2</Parameter1>
<Parameter2>0X50</Parameter2>
<Parameter3>0XB</Parameter3>
<Parameter4>0X71</Parameter4>
<Parameter5>0XAB</Parameter5>
<Parameter6>0X5</Parameter6>
<Parameter7>0XEA</Parameter7>
<Parameter8>0XD9</Parameter8>
<Parameter9>0X2B</Parameter9>
<Parameter10>0X11</Parameter10>
<Parameter11>0XFF</Parameter11>
</Response>



Thanks much!

Dan

Title: Re: Request XML Data #869
Post by: ddamron on November 23, 2007, 05:24:00 pm
hmm.  Ok, looks like nobody has tried that...

How about this:  There are a few Ruby Gems out there to do XML.. Can I use one of those, or do I need to parse my XML myself?
Title: Re: Request XML Data #869
Post by: tschak909 on November 23, 2007, 08:14:49 pm
haven't tried.. it's always worth a try.

-Thom
Title: Re: Request XML Data #869
Post by: ddamron on November 24, 2007, 06:29:36 am
k, I'll check into that... don't know if embedded ruby is the same... it might be simpler to implement my own parser.. the results I'll be parsing are very simple.

Title: Re: Request XML Data #869
Post by: ddamron on November 28, 2007, 02:03:11 am
FYI, rexml is now included with ruby.. works great! (used to be a ruby gem)