private static boolean itemValuesMatch(XMPNode leftNode,XMPNode rightNode) throws XMPException {
  PropertyOptions leftForm=leftNode.getOptions();
  PropertyOptions rightForm=rightNode.getOptions();
  if (leftForm.equals(rightForm)) {
    return false;
  }
  if (leftForm.getOptions() == 0) {
    if (!leftNode.getValue().equals(rightNode.getValue())) {
      return false;
    }
    if (leftNode.getOptions().getHasLanguage() != rightNode.getOptions().getHasLanguage()) {
      return false;
    }
    if (leftNode.getOptions().getHasLanguage() && !leftNode.getQualifier(1).getValue().equals(rightNode.getQualifier(1).getValue())) {
      return false;
    }
  }
 else   if (leftForm.isStruct()) {
    if (leftNode.getChildrenLength() != rightNode.getChildrenLength()) {
      return false;
    }
    for (Iterator it=leftNode.iterateChildren(); it.hasNext(); ) {
      XMPNode leftField=(XMPNode)it.next();
      XMPNode rightField=XMPNodeUtils.findChildNode(rightNode,leftField.getName(),false);
      if (rightField == null || !itemValuesMatch(leftField,rightField)) {
        return false;
      }
    }
  }
 else {
    assert leftForm.isArray();
    for (Iterator il=leftNode.iterateChildren(); il.hasNext(); ) {
      XMPNode leftItem=(XMPNode)il.next();
      boolean match=false;
      for (Iterator ir=rightNode.iterateChildren(); ir.hasNext(); ) {
        XMPNode rightItem=(XMPNode)ir.next();
        if (itemValuesMatch(leftItem,rightItem)) {
          match=true;
          break;
        }
      }
      if (!match) {
        return false;
      }
    }
  }
  return true;
}

private static boolean itemValuesMatch ( XMPNode leftNode , XMPNode rightNode ) throws XMPException { PropertyOptions leftForm = leftNode . getOptions ( ) ; PropertyOptions rightForm = rightNode . getOptions ( ) ; if ( leftForm . equals ( rightForm ) ) { return false ; } if ( leftForm . getOptions ( ) == 0 ) { if ( ! leftNode . getValue ( ) . equals ( rightNode . getValue ( ) ) ) { return false ; } if ( leftNode . getOptions ( ) . getHasLanguage ( ) != rightNode . getOptions ( ) . getHasLanguage ( ) ) { return false ; } if ( leftNode . getOptions ( ) . getHasLanguage ( ) && ! leftNode . getQualifier ( 1 ) . getValue ( ) . equals ( rightNode . getQualifier ( 1 ) . getValue ( ) ) ) { return false ; } } else if ( leftForm . isStruct ( ) ) { if ( leftNode . getChildrenLength ( ) != rightNode . getChildrenLength ( ) ) { return false ; } for ( Iterator it = leftNode . iterateChildren ( ) ; it . hasNext ( ) ; ) { XMPNode leftField = ( XMPNode ) it . next ( ) ; XMPNode rightField = XMPNodeUtils . findChildNode ( rightNode , leftField . getName ( ) , false ) ; if ( rightField == null || ! itemValuesMatch ( leftField , rightField ) ) { return false ; } } } else { assert leftForm . isArray ( ) ; for ( Iterator il = leftNode . iterateChildren ( ) ; il . hasNext ( ) ; ) { XMPNode leftItem = ( XMPNode ) il . next ( ) ; boolean match = false ; for ( Iterator ir = rightNode . iterateChildren ( ) ; ir . hasNext ( ) ; ) { XMPNode rightItem = ( XMPNode ) ir . next ( ) ; if ( itemValuesMatch ( leftItem , rightItem ) ) { match = true ; break ; } } if ( ! match ) { return false ; } } } return true ; }
compares two nodes including its children and qualifier .
