Skip to content

useful class for matching xml documents based on a subset of nodes

License

Notifications You must be signed in to change notification settings

mightyverse/xml_subset_matcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Contributors:
Sarah Allen, http://github.com/ultrasaurus
Wolfram Arnold, http://github.com/wolframarnold 
Nikolay, http://github.com/jastix

Build and install the gem:
  gem build xml_subset_matcher.gemspec
  sudo gem install xml_subset_matcher

run the specs (all pass)
  spec spec/lib/xml_subset_matcher_spec.rb

using the library
$ irb
>> require 'xml_subset_matcher'
=> true
>> subset = "<root><thing>text</thing></root>"
=> "<root><thing>text</thing></root>"
>> superset = "<root extra='stuff'><ignorethis/><thing>text</thing></root>"
=> "<root extra='stuff'><ignorethis/><thing>text</thing></root>"
>> x = XmlSubsetMatcher::XmlSubsetMatcher.new(superset)
=> #<XmlSubsetMatcher::XmlSubsetMatcher:0x55a514 @error="", @superset=<?xml version="1.0" encoding="UTF-8"?>
<root extra="stuff">
  <ignorethis/>
  <thing>text</thing>
</root>
>
>> x.matches?(subset)
=> true
>> subset = "<something>else</something>"
=> "<something>else</something>"
>> x.matches?(subset)
=> false

About

useful class for matching xml documents based on a subset of nodes

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages