In my application code, I've attempted to implement a somewhat generic content aware comparison. Would anyone care to review this and let me know if it seems correct? If it is a sound approach, should I look to make a patch adding this to xmlbeans proper?
Thanks, Wesley ---------- private boolean objectEquals(final XmlObject a, final XmlObject b) { if (a == null) { if (b == null) return true; else return false; } if (b == null) return false; if (a instanceof SimpleValue) { if (b instanceof SimpleValue) return a.valueEquals(b); else return false; } final SchemaType sa = a.schemaType(); final SchemaType sb = b.schemaType(); if (!sa.equals(sb)) return false; // compare attributes for (final SchemaProperty property : sa.getAttributeProperties()) { final XmlObject pa = a.selectAttribute(property.getName()); final XmlObject pb = b.selectAttribute(property.getName()); if (!objectEquals(pa, pb)) return false; } // compare elements for (final SchemaProperty property : sa.getElementProperties()) { final XmlObject[] ea = a.selectChildren(property.getName()); final XmlObject[] eb = b.selectChildren(property.getName()); if (ea.length != eb.length) return false; for (int i = 0; i < ea.length; i++) objectEquals(ea[i], eb[i]); } return a.valueEquals(b); } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org