XML to Ruby Converter
Convert XML to Ruby classes development
XML Input
Ruby Output
What Is XML to Ruby?
Ruby uses REXML or Nokogiri for XML. This tool generates Ruby classes from your XML. The W3C XML spec defines the format; conversion runs in your browser. Nothing is sent to a server.
How to Use This Tool
Paste or Upload XML
Paste XML or upload a file. Set class name and package (module) in the config.
Review Ruby Output
The right panel shows generated classes. Use REXML or Nokogiri to parse and populate.
Copy or Download
Use Copy or Download. For JSON to Ruby, use JSON to Ruby. For XML formatting, use XML Formatter.
When XML to Ruby Helps
When building Rails apps that consume SOAP, RSS, or XML APIs, generate typed classes here. Use REXML (standard library) or Nokogiri for parsing.
Frequently Asked Questions
REXML vs Nokogiri?
REXML is in the standard library. Nokogiri is faster and has XPath. Both parse XML into a tree.
Is my data sent anywhere?
No. Generation runs in your browser.
XML to Ruby Examples
Here is an example of generating Ruby classes from XML.
Example: Subscriber record
XML input:
Generated Ruby output: