@Override public void startElement(String uri,String localName,String name,Attributes attributes){
  fixWhiteSpace();
  final String ariaLabel=attributes.getValue("aria-label");
  final String alt=attributes.getValue("alt");
  final String title=attributes.getValue("title");
  if (ariaLabel != null) {
    mOutputBuilder.append(ariaLabel);
  }
 else   if (alt != null) {
    mOutputBuilder.append(alt);
  }
 else   if (title != null) {
    mOutputBuilder.append(title);
  }
  final String role=attributes.getValue("role");
  final String roleName=mAriaRoleToDesc.get(role);
  final String type=attributes.getValue("type");
  final String tagInfo=mTagToDesc.get(name.toLowerCase());
  if (roleName != null) {
    mPostorderTextStack.push(roleName);
  }
 else   if (name.equalsIgnoreCase("input") && (type != null)) {
    final String typeInfo=mInputTypeToDesc.get(type.toLowerCase());
    if (typeInfo != null) {
      mPostorderTextStack.push(typeInfo);
    }
 else {
      mPostorderTextStack.push("");
    }
  }
 else   if (tagInfo != null) {
    mPostorderTextStack.push(tagInfo);
  }
 else {
    mPostorderTextStack.push("");
  }
  final String value=attributes.getValue("value");
  if (value != null) {
    String elementType=name;
    if (name.equalsIgnoreCase("input") && (type != null)) {
      elementType=type;
    }
    if (!elementType.equalsIgnoreCase("checkbox") && !elementType.equalsIgnoreCase("radio")) {
      fixWhiteSpace();
      mOutputBuilder.append(value);
    }
  }
}

@ Override public void startElement ( String uri , String localName , String name , Attributes attributes ) { fixWhiteSpace ( ) ; final String ariaLabel = attributes . getValue ( "aria-label" ) ; final String alt = attributes . getValue ( "alt" ) ; final String title = attributes . getValue ( "title" ) ; if ( ariaLabel != null ) { mOutputBuilder . append ( ariaLabel ) ; } else if ( alt != null ) { mOutputBuilder . append ( alt ) ; } else if ( title != null ) { mOutputBuilder . append ( title ) ; } final String role = attributes . getValue ( "role" ) ; final String roleName = mAriaRoleToDesc . get ( role ) ; final String type = attributes . getValue ( "type" ) ; final String tagInfo = mTagToDesc . get ( name . toLowerCase ( ) ) ; if ( roleName != null ) { mPostorderTextStack . push ( roleName ) ; } else if ( name . equalsIgnoreCase ( "input" ) && ( type != null ) ) { final String typeInfo = mInputTypeToDesc . get ( type . toLowerCase ( ) ) ; if ( typeInfo != null ) { mPostorderTextStack . push ( typeInfo ) ; } else { mPostorderTextStack . push ( "" ) ; } } else if ( tagInfo != null ) { mPostorderTextStack . push ( tagInfo ) ; } else { mPostorderTextStack . push ( "" ) ; } final String value = attributes . getValue ( "value" ) ; if ( value != null ) { String elementType = name ; if ( name . equalsIgnoreCase ( "input" ) && ( type != null ) ) { elementType = type ; } if ( ! elementType . equalsIgnoreCase ( "checkbox" ) && ! elementType . equalsIgnoreCase ( "radio" ) ) { fixWhiteSpace ( ) ; mOutputBuilder . append ( value ) ; } } }
depending on the type of element , generate text describing its conceptual value and role and add it to the output . the role text is spoken after any content , so it is added to the stack to wait for the closing tag .
