0.0
No commit activity in last 3 years
No release in over 3 years
SRXML is a very (super, if you will!) lightweight xml generator for Ruby. No big magic here, it simply uses method_missing to create the tags. There is some plan to make it more useful. For Example being able to parse existing files etc. but there are probably better libraries to do that.If you simply want to create an xml file without the need for extra fancy formatting, SRXML could just be the deal for you!
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies
 Project Readme
=========================
SRXML - Simple Ruby XML
Created by Christopher Bertels (bakkdoor@flasht.de / http://github.com/bakkdoor/)
=========================
  
SRXML is a very (super, if you will!) lightweight xml generator for Ruby. No big magic here, it simply uses method_missing to create the tags. There is some plan to make it more useful. For Example being able to parse existing files etc. but there are probably better libraries to do that.
If you simply want to create an xml file without the need for extra fancy formatting, SRXML could just be the deal for you!

Oh, by the way. It also supports html-output now.

=========================
LICENSE:

SRXML is licensed under the terms of the GNU GPL v2.
Play with it as much as you like, fork it and put the changes here back on github or so :)
      
=========================
  

==================================
Short Example (from examble.rb):
==================================
  
  require "rubygems"
  require "srxml"

  xml = SRXML::XML.new

  xml.projects{
    xml.project(:name => "project #1", :description => "some text", :id => 1){
      xml.something_else "yo!"
    }
  }

  puts xml.to_s
    

Will output the following:
  
  <?xml version="1.0" encoding="UTF-8"?><projects><project name="project #1" description="some text" id="1"><something_else>yo!</something_else></project></projects>

You can also use some simple formatting:
  
  puts xml.to_s(:formatted)
    
Which will then give you something like this:
  
  <?xml version="1.0" encoding="UTF-8"?><projects>
  <project name="project #1" description="some text" id="1">
  <something_else>yo!</something_else>
  </project>
  </projects>

==================================
Simple HTML generation:
==================================

SRXML now also supports html-output:
  
  require "rubygems"
  require "srxml"
  
  html = SRXML::XML.new :xml => false, :html => true  # this will automatically set SRXML into 'html-mode',
                                                      # knowing for example, that certain tags are single (no end tag) 
  html.html{
    html.head{
      html.title "my title"
    }
    html.body{
      html.div(:style => "padding:10em; font-size: 140%"){
        "hello, world!"
      }
    }
  }
  
  puts html.to_s

Will output the expected html-output. 
  
For more examples take a look in the example-files.