private static int lookupQualSelector(XMPNode arrayNode,String qualName,String qualValue,int aliasForm) throws XMPException {
  if (XML_LANG.equals(qualName)) {
    qualValue=Utils.normalizeLangValue(qualValue);
    int index=XMPNodeUtils.lookupLanguageItem(arrayNode,qualValue);
    if (index < 0 && (aliasForm & AliasOptions.PROP_ARRAY_ALT_TEXT) > 0) {
      XMPNode langNode=new XMPNode(ARRAY_ITEM_NAME,null);
      XMPNode xdefault=new XMPNode(XML_LANG,X_DEFAULT,null);
      langNode.addQualifier(xdefault);
      arrayNode.addChild(1,langNode);
      return 1;
    }
 else {
      return index;
    }
  }
 else {
    for (int index=1; index < arrayNode.getChildrenLength(); index++) {
      XMPNode currItem=arrayNode.getChild(index);
      for (Iterator it=currItem.iterateQualifier(); it.hasNext(); ) {
        XMPNode qualifier=(XMPNode)it.next();
        if (qualName.equals(qualifier.getName()) && qualValue.equals(qualifier.getValue())) {
          return index;
        }
      }
    }
    return -1;
  }
}

private static int lookupQualSelector ( XMPNode arrayNode , String qualName , String qualValue , int aliasForm ) throws XMPException { if ( XML_LANG . equals ( qualName ) ) { qualValue = Utils . normalizeLangValue ( qualValue ) ; int index = XMPNodeUtils . lookupLanguageItem ( arrayNode , qualValue ) ; if ( index < 0 && ( aliasForm & AliasOptions . PROP_ARRAY_ALT_TEXT ) > 0 ) { XMPNode langNode = new XMPNode ( ARRAY_ITEM_NAME , null ) ; XMPNode xdefault = new XMPNode ( XML_LANG , X_DEFAULT , null ) ; langNode . addQualifier ( xdefault ) ; arrayNode . addChild ( 1 , langNode ) ; return 1 ; } else { return index ; } } else { for ( int index = 1 ; index < arrayNode . getChildrenLength ( ) ; index ++ ) { XMPNode currItem = arrayNode . getChild ( index ) ; for ( Iterator it = currItem . iterateQualifier ( ) ; it . hasNext ( ) ; ) { XMPNode qualifier = ( XMPNode ) it . next ( ) ; if ( qualName . equals ( qualifier . getName ( ) ) && qualValue . equals ( qualifier . getValue ( ) ) ) { return index ; } } } return - 1 ; } }
searches for a qualifier selector in a node : [ ? qualname = " value " ] - an element in an array , chosen by a qualifier value . no implicit nodes are created for qualifier selectors , except for an alias to an x - default item .
