Xmlrpc question

(J-Van) #1

Hi,

Using ruby's xmlrpc, how can I view the XML that's being generated by
XMLRPC::Client.call and the XML that's being returned from XMLRPC
server?

Thanks,
Joe

(J-Van) #2

Aha, XMLRPC::Marshal.dump_response does the trick...

Now I'm looking for a way to nicely display XML (with linebreaks and whatnot)

···

On 8/16/05, Joe Van Dyk <joevandyk@gmail.com> wrote:

Hi,

Using ruby's xmlrpc, how can I view the XML that's being generated by
XMLRPC::Client.call and the XML that's being returned from XMLRPC
server?

Thanks,
Joe

(Christian Neukirchen) #3

Joe Van Dyk <joevandyk@gmail.com> writes:

Aha, XMLRPC::Marshal.dump_response does the trick...

Now I'm looking for a way to nicely display XML (with linebreaks and whatnot)

ruby myxmloutput | xmllint --format -

···

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

(Adam Keys) #4

Or, with XML Starlet[1]:

ruby myxmloutput | xml fo

And, one of my favorite IRB recipes:

irb(main):001:0> require 'net/http'
irb(main):002:0> url = 'http://example.com/some.xml'
irb(main):003:0> xml = Net::HTTP.get(URI.parse(url))
irb(main):004:0> IO.popen('pbcopy', 'w') { |io| io.write(xml) }

pbcopy puts text in the clipboard on OS X. Cygwin has a similar command called getclip. Not sure what's available for Linux. Its pretty durn handy though!

[1] http://xmlstar.sourceforge.net/

···

On Aug 17, 2005, at 7:04 AM, Christian Neukirchen wrote:

ruby myxmloutput | xmllint --format -

--
~akk