dialectics Posted July 8 Report Share Posted July 8 normally i don't beg for help but does anyone have a utility to compare two XML files? i'm tired and i can't get mine to work right. XML::SemanticDiff is utterly useless. thanks in advance....rob Quote Link to comment Share on other sites More sharing options...
dr0ne Posted July 8 Report Share Posted July 8 Originally posted by dialectics normally i don't beg for help but does anyone have a utility to compare two XML files? i'm tired and i can't get mine to work right. XML::SemanticDiff is utterly useless. thanks in advance....rob XML sucks. machine language is where its at. Quote Link to comment Share on other sites More sharing options...
dialectics Posted July 8 Author Report Share Posted July 8 fuck i can't get anything right tonight. i am going to lose my job.and just 2 months before i quit.... this sucks.yeah xml is so lame. i work with artificial intelligence dammit, i shouldn't have to demean myself doing this shitty work. this is such a stupid deliverable that the fact that its giving me problems is making it suck even more. dammit.peaz,rob Quote Link to comment Share on other sites More sharing options...
dialectics Posted July 8 Author Report Share Posted July 8 ok i got this puppy down. to bad i'm fucking tired now.(i like to swear when coding late at night) Quote Link to comment Share on other sites More sharing options...
hoke Posted July 8 Report Share Posted July 8 How did you do it? I was going to suggest using an XML parser to simultaneously parse through each node, comparing the contents as you go. Tedious and probably very slow, but if all else fails... Quote Link to comment Share on other sites More sharing options...
dialectics Posted July 8 Author Report Share Posted July 8 Originally posted by hoke How did you do it? I was going to suggest using an XML parser to simultaneously parse through each node, comparing the contents as you go. Tedious and probably very slow, but if all else fails... i did it recursively... used xml parser XML::Simple, which gives you a hash of arrays of hashes of arrays of hashes of...., and then compared each node like a postorder traversal of a tree (remember cs 102?)comparing nodes wasn't just comparing values, but potential multiple copies of the same tag, so within your traversal you have to exhaustively compare those options. other then that it is routine.the trouble is with when to actually output an error if its found - errors always propogate up the tree so once you do your forward stage of error detection, you have to do another forward stage of output. this was the part i was having trouble with because object oriented perl is such a pain in the ass, so i had to jerry-rig my data structure to support marking where the tags matched/didn't match. that part sucked.thanks for the advice!peaz,rob Quote Link to comment Share on other sites More sharing options...
tottallyoff Posted July 8 Report Share Posted July 8 use windiff.exe Quote Link to comment Share on other sites More sharing options...
dialectics Posted July 8 Author Report Share Posted July 8 Originally posted by tottallyoff use windiff.exe will that structurally compare xml files? or just check to see if the files are textually different? the problem is that tags can come in any order. i tried using a module that lexically sorts the tags and then performs a unix 'diff' on the two files, but the trouble is when you have a double occurance of the same tag, and they just so happen to not be sorted the same way in both files, then i'm fucked. and not in the good way peaz,rob Quote Link to comment Share on other sites More sharing options...
tottallyoff Posted July 9 Report Share Posted July 9 I think it does a text compare. 1. Why would you want to use xml to compare files? Thats not what it is intended for.2. Cant you write a C or a java proggie to do that. If you want, I can do that for you very fast. Quote Link to comment Share on other sites More sharing options...
nec Posted July 9 Report Share Posted July 9 www.4-blue.netgo to the forumsask there you get an answer real fast Quote Link to comment Share on other sites More sharing options...
dialectics Posted July 9 Author Report Share Posted July 9 Originally posted by tottallyoff 2. Cant you write a C or a java proggie to do that. If you want, I can do that for you very fast. hehe that's what i just did - only i wrote it in perl. i am just lazy and when i couldn't get it to work right i wanted to see if anyone did it already it produces a ton of output though (200 pages for 150 file comparisons), since it propogates errors up the parse tree, so i'm trying to reduce that so people can actually locate errors without sorting through all sorts of crap.thanks for the offer though, much appreciated.Rob Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.