0

I'm using the glowfoto api and I'm trying to parse the xml data. It extremely simple, but I can't get it to work.

This is the XML data:

<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<getserver>\n <uploadform>http://img5.glowfoto.com/uploadxml.php</uploadform>\n</getserver>

How can I get that URL into a string using rexml.

1 Answer 1

4

Using REXML you can do it like this. REXML is included in the standard library

require 'rexml/document'

xml = <<-XML
<?xml version="1.0" encoding="utf-8"?>
<getserver><uploadform>http://img5.glowfoto.com/uploadxml.php</uploadform></getserver>
XML

r = REXML::Document.new(xml)
puts r.elements["getserver/uploadform"].first
=> "http://img5.glowfoto.com/uploadxml.php"
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much. I knew it was something extremely easy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.