Skip to content

Magically navigate through xml as if it were a ruby object

License

Notifications You must be signed in to change notification settings

concept47/xml_magic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xml-magic makes accessing xml objects more like any other ruby object

example

require 'xml_magic'

xml = <<XML
<project title="XML Magic">
  <description>Test description.</description>
  <contact type="Project Manager">Anthony</contact>
  <contact type="Worker Bee">Ben</contact>
  <contact type="Designer Bee">Jason</contact>
</project>
XML

project_info = CommonThread::XML::XmlMagic.new(xml)

puts project_info[:title]
puts project_info.description
for contact in project_info.contact
  puts "#{contact} the #{contact[:type]}"
end

example output

XML Magic
Test description.
Anthony the Project Manager
Ben the Worker Bee
Jason the Designer Bee

About

Magically navigate through xml as if it were a ruby object

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published