hi,
I think I've found a problem with the Validator generated for some
classes, where by if you have a container element C, and a subchild D
which you repeat in the form
<C>
<D/>
<D/>
</C>
then the validator keeps track of objects (identity-wise) that it has
already seen, so when it comes to the 2nd occurrence (but same object
instance) of D it thinks it has found a cycle and complains..
ie the XML object tree would be created by code like
ObjectFactory factory = new ObjectFactory();
C c = factory.createC();
D d = factory.createD();
.. setup d ..
c.getD().add(d);
c.getD().add(d);
Validator v = ...
v.validate(c); // throws a validation error complaining about a
cycle
does this sound reasonable/the correct behaviour?
I've worked-around this (or fixed my code..) by cloning "d", ie
ObjectFactory factory = new ObjectFactory();
C c = factory.createC();
D d1 = factory.createD();
D d2 = factory.createD();
.. setup d1 ..
.. setup d2 ..
c.getD().add(d1);
c.getD().add(d2);
Validator v = ...
v.validate(c);
thanks,
Andrew