private static int headingIndex ( Element element ) { String tagName = element . tagName ( ) ; if ( tagName . startsWith ( "h" ) ) { try { return Integer . parseInt ( tagName . substring ( 1 ) ) ; } catch ( Throwable ex ) { throw new IllegalArgumentException ( "Must be a header tag: " + tagName , ex ) ; } } else { throw new IllegalArgumentException ( "Must be a header tag: " + tagName ) ; } }
Retrieves numeric index of a heading .