I'm trying to use org.apache.poi.xwpf.usermodel.XWPFNumbering.getIdOfAbstractNum(XWPFAbstractNum abstractNum)
to test if the given abstractNum exists or not. This call ends up in:
CTAbstractNumImpl(XmlComplexContentImpl).equal_to(XmlObject) line: 79
CTAbstractNumImpl(XmlObjectBase).valueEqualsImpl(XmlObject) line: 2393
CTAbstractNumImpl(XmlObjectBase).valueEquals(XmlObject) line: 2434
XWPFNumbering.getIdOfAbstractNum(XWPFAbstractNum) line: 222
...
Unfortunately, org.apache.xmlbeans.impl.values.XmlComplexContentImpl.equal_to(XmlObject)
isn't implemented properly and returns always true:
public boolean equal_to(XmlObject complexObject)
{
if (!_schemaType.equals(complexObject.schemaType()))
return false;
// BUGBUG: by-value structure comparison undone
return true;
}
Is there an alternative to deeply compare such xml objects, or to find out if the abstract numbering exists?
Luckily there was an old post over here, which has a solution attached: http://mail-archives.apache.org/mod_mbox/xml-xmlbeans-user/200310.mbox/%[email protected]%3e
This is slightly modified content, which allows to compare two xml objects by calling the method
lenientlyCompareTwoXmlStrings(XmlObject, XmlObject)
: