Resident Demigod

Veezus Kreist

Divine missives

Writing a Builder::XmlMarkup to file

March 18, 2010 20:56

Matt Yoho and I have been working on interfacing with a SOAP-based external service with no documentation and hosted on Windows. During the course of feeding this service XML to try to get it to react as we’d like, we realized we didn’t know how to write out a Builder::XmlMarkup object to file without adding a new to_s element.

The solution? Calling target! on your object will return the string that Builder is building.

tempfile.write xml.target!

blog comments powered by Disqus