From: Stefan B. <bo...@ap...> - 2007-05-11 04:12:22
|
On Wed, 9 May 2007, Michael Schumacher <MSc...@ca...> wrote: > I'm using the DetailedDiff to compare XML's to find out what the > differences are. I was wondering if there is some XML's Test cases > out there that would hit all the cases in the DifferenceConstants? I don't think there is. Some of them are tricky to create. For example the parser must be in validating mode in order to ever receive a ATTR_VALUE_EXPLICITLY_SPECIFIED_ID difference. Note that XMLUnit 1.1 adds a type of Difference and will - under certain circumstances create another set of differences than 1.0 did. > For example, if I have the following XML's, it will produce a > difference of "presence of child nodes to be" > > XML Document 1 > > <?xml version="1.0" encoding="UTF-8"?> > <Root> > <OneElementDeep> > <BLAH/> > </OneElementDeep> > </Root> > > > > XML Document 2 > > <?xml version="1.0" encoding="UTF-8"?> > <Root> > <OneElementDeep> > <BLAH> > <Presence>Child</Presence> > </BLAH> > </OneElementDeep> > </Root> What else would you expect? I think in XMLUnit 1.1 you should get HAS_CHILD_NODES_ID, CHILD_NODELIST_LENGTH_ID and CHILD_NODE_NOT_FOUND_ID. > This would help me handle all the cases there are produced from the > DetailedDiff and handle them accordingly. Right now I'm building up > a java class that will generate a Delta between the two XML's. Seems to be the easiest thing to do for your tests. Stefan |