private void parseDefault ( String elementName , String name , String type , String enumer ) throws Exception { int valueType = ATTRIBUTE_DEFAULT_SPECIFIED ; String value = null ; int flags = LIT_ATTRIBUTE ; boolean saved = expandPE ; String defaultType = null ; // LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace // chars to spaces (doesn't matter when that's done if it doesn't // interfere with char refs expanding to whitespace). if ( ! skippedPE ) { flags |= LIT_ENTITY_REF ; if ( handler . stringInterning ) { if ( "CDATA" != type ) { flags |= LIT_NORMALIZE ; } } else { if ( ! "CDATA" . equals ( type ) ) { flags |= LIT_NORMALIZE ; } } } expandPE = false ; if ( tryRead ( ' ' ) ) { if ( tryRead ( "FIXED" ) ) { defaultType = "#FIXED" ; valueType = ATTRIBUTE_DEFAULT_FIXED ; requireWhitespace ( ) ; value = readLiteral ( flags ) ; } else if ( tryRead ( "REQUIRED" ) ) { defaultType = "#REQUIRED" ; valueType = ATTRIBUTE_DEFAULT_REQUIRED ; } else if ( tryRead ( "IMPLIED" ) ) { defaultType = "#IMPLIED" ; valueType = ATTRIBUTE_DEFAULT_IMPLIED ; } else { fatal ( "illegal keyword for attribute default value" ) ; } } else { value = readLiteral ( flags ) ; } expandPE = saved ; setAttribute ( elementName , name , type , enumer , value , valueType ) ; if ( handler . stringInterning ) { if ( "ENUMERATION" == type ) { type = enumer ; } else if ( "NOTATION" == type ) { type = "NOTATION " + enumer ; } } else { if ( "ENUMERATION" . equals ( type ) ) { type = enumer ; } else if ( "NOTATION" . equals ( type ) ) { type = "NOTATION " + enumer ; } } if ( ! skippedPE ) { handler . getDeclHandler ( ) . attributeDecl ( elementName , name , type , defaultType , value ) ; } }
Parse the default value for an attribute .