Project

free_dom

0.0
No commit activity in last 3 years
No release in over 3 years
Dynamically builds a DOM from XML.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.4, >= 0.4.1
~> 0.9, >= 0.9.1
~> 0.1, >= 0.1.2
 Project Readme

Introducing the Free_dom gem

require 'free_dom'

xml = "<home>
  <kitchen>
    <light switch='off'/>
  </kitchen>

  <porch>
    <doorentry>
      <button name='btn'></button>
    </doorentry>
    <door lock='locked'>
  </porch>

  <livingroom>
  </livingroom>
</home>
"

doc = FreeDom.new(xml)

e = doc.root.element('kitchen/light')
e.switch = 'off'
puts doc.to_sliml
home
  kitchen
    light {switch: "off"}
  porch
    doorentry
      btn {name: "btn"}
    door {lock: "locked"}
  livingroom

Note: A document in Sliml format can also be passed into this gem instead of XML.

Resources

free_dom dom xml