xmlrpc question

J

Joe Van Dyk

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

Joe Van Dyk

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

Now I'm looking for a way to nicely display XML (with linebreaks and whatno=
t)
 
A

Adam Keys

ruby myxmloutput | xmllint --format -

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/
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,020
Latest member
GenesisGai

Latest Threads

Top