nsAutoString vcardName; vcardName.AssignWithConversion("VCARD_NAME");
nsAutoString vcardName; vcardName.Assign(NS_LITERAL_STRING("VCARD_NAME"));
wallet_CaptureSelectElement(nsIDOMNode* elementNode, nsIDocument* doc) {  nsresult result;  PRBool captured = PR_FALSE;  nsCOMPtr<nsIDOMHTMLSelectElement> selectElement = do_QueryInterface(elementNode);    if (selectElement) {    /* it's a dropdown list */    nsAutoString field;    result = selectElement->GetName(field);    if (NS_SUCCEEDED(result)) {      PRUint32 length;      selectElement->GetLength(&length);      nsCOMPtr<nsIDOMHTMLCollection> options;      selectElement->GetOptions(getter_AddRefs(options));      if (options) {        PRInt32 selectedIndex;        result = selectElement->GetSelectedIndex(&selectedIndex);        if (NS_SUCCEEDED(result)) {          nsCOMPtr<nsIDOMNode> optionNode;          options->Item(selectedIndex, getter_AddRefs(optionNode));          if (optionNode) {            nsCOMPtr<nsIDOMHTMLOptionElement> optionElement(do_QueryInterface(optionNode));            if (optionElement) {              nsAutoString optionValue;              nsAutoString optionText;              PRBool valueOK = NS_SUCCEEDED(optionElement->GetValue(optionValue))                               && optionValue.Length();              PRBool textOK = NS_SUCCEEDED(optionElement->GetText(optionText))                              && optionText.Length();              if (valueOK || textOK) {                /* get schema name from vcard attribute if it exists */                nsAutoString schema;                nsCOMPtr<nsIDOMElement> element = do_QueryInterface(elementNode);                if (element) {                  nsAutoString vcardName; vcardName.AssignWithConversion("VCARD_NAME");                  nsAutoString vcardValue;                  result = element->GetAttribute(vcardName, vcardValue);                  if (NS_OK == result) {                    nsVoidArray* dummy;                    wallet_ReadFromList(vcardValue, schema, dummy, wallet_VcardToSchema_list, PR_FALSE);                  }                }#ifdef IgnoreFieldNames// use displayable text instead of vcard namesschema.SetLength(0);#endif                if (!schema.Length()) {                  /* get schema from displayable text if possible */                  wallet_GetSchemaFromDisplayableText(selectElement, schema, (!valueOK && !textOK));                }                if (valueOK && wallet_Capture(doc, field, optionValue, schema)) {                  captured = PR_TRUE;                }                optionText.Trim(" \n\t\r");                if (textOK && wallet_Capture(doc, field, optionText, schema)) {                  captured = PR_TRUE;                }              }            }          }        }      }    }  }  return captured;}