private String readName ( ) throws IOException , KriptonRuntimeException { if ( position >= limit && ! fillBuffer ( 1 ) ) { checkRelaxed ( "name expected" ) ; return "" ; } int start = position ; StringBuilder result = null ; // read the first character char c = buffer [ position ] ; if ( ( c >= ' ' && c <= ' ' ) || ( c >= ' ' && c <= ' ' ) || c == ' ' || c == ' ' || c >= ' ' // TODO: // check // the // XML // spec || relaxed ) { position ++ ; } else { checkRelaxed ( "name expected" ) ; return "" ; } while ( true ) { /* * Make sure we have at least a single character to read from the * buffer. This mutates the buffer, so save the partial result to * the slow path string builder first. */ if ( position >= limit ) { if ( result == null ) { result = new StringBuilder ( ) ; } result . append ( buffer , start , position - start ) ; if ( ! fillBuffer ( 1 ) ) { return result . toString ( ) ; } start = position ; } // read another character c = buffer [ position ] ; if ( ( c >= ' ' && c <= ' ' ) || ( c >= ' ' && c <= ' ' ) || ( c >= ' ' && c <= ' ' ) || c == ' ' || c == ' ' || c == ' ' || c == ' ' || c >= ' ' ) { // TODO: // check // the // XML // spec position ++ ; continue ; } // we encountered a non-name character. done! if ( result == null ) { return stringPool . get ( buffer , start , position - start ) ; } else { result . append ( buffer , start , position - start ) ; return result . toString ( ) ; } } }
Returns an element or attribute name . This is always non - empty for non - relaxed parsers .