From: Xeno Campanoli / Eskimo North and Gmail Date: 2010-07-17T09:03:21+09:00 Subject: Re: Hpricot test for equivalence of two xml segments? >> The only thing I am concerned about is permutations of attributes inside >> the tags. Everything else I'm seeing is regular. Is there something where >> I can parse all the tags in a segment and tell if they are equivalent and >> just have the attributes in different orders? I'm not even concerned about >> different tag forms. We don't see that. A typical example is: >> >> <
  • alt textMy Text
  • >>>
  • alt textMy Text
  • >> >> I need to have something that can help me judge such things as equivalent. >> Again, I NEVER see tag permutations, but just attribute permutations. >> I believe you. Nokogirl wouldn't install though...yes, and nor did Lorax... Looks like there's an install site, but I hesitate to use something this outside the mainstream on a project like this. I don't want to impose needless maintenance problems on my environment. > > You should take a look at Lorax: > > http://github.com/flavorjones/lorax > > which is Nokogiri-based. > > Your definition of equivalence (the semantically correct one, imho) can be > tested with: > > Lorax::Signature.new(Nokogiri::XML(string1).root).signature == > Lorax::Signature.new(Nokogiri::XML(string2).root).signature > > And note that Nokogiri will also alllow you to parse XML fragments. > > HTH, > -m > > > >> >>> >> Thank you for you response. >> >> Sincerely, Xeno >> >> >> -- >> "It's the preponderance, stupid!" - Professor Stephen Schneider, IPCC >> member >> >> > -- "It's the preponderance, stupid!" - Professor Stephen Schneider, IPCC member