protected String printable( String s ) { if ( s == null ) return null; final int sLen = s.length(); StringBuilder buf = new StringBuilder( sLen + 10 ); for ( int i = 0; i < sLen; ++i ) { buf.append( printable( s.charAt( i ) ) ); } s = buf.toString(); return s; }
protected char requireInput( char ch, char[] input ) throws XmlPullParserException, IOException { for ( char anInput : input ) { if ( ch != anInput ) { throw new XmlPullParserException( "expected " + printable( anInput ) + " in " + new String( input ) + " and not " + printable( ch ), this, null ); } ch = more(); } return ch; }
/** * Return string describing current position of parsers as text 'STATE [seen %s...] @line:column'. */ public String getPositionDescription() { String fragment = null; if ( posStart <= pos ) { final int start = findFragment( 0, buf, posStart, pos ); // System.err.println("start="+start); if ( start < pos ) { fragment = new String( buf, start, pos - start ); } if ( bufAbsoluteStart > 0 || start > 0 ) fragment = "..." + fragment; } // return " at line "+tokenizerPosRow // +" and column "+(tokenizerPosCol-1) // +(fragment != null ? " seen "+printable(fragment)+"..." : ""); return " " + TYPES[eventType] + ( fragment != null ? " seen " + printable( fragment ) + "..." : "" ) + " " + ( location != null ? location : "" ) + "@" + getLineNumber() + ":" + getColumnNumber(); }
protected char requireNextS() throws XmlPullParserException, IOException { final char ch = more(); if ( !isS( ch ) ) { throw new XmlPullParserException( "white space is required and not " + printable( ch ), this, null ); } return skipS( ch ); }
+ printable( new String( buf, versionStart, versionEnd - versionStart ) ) + "'", this, null ); if ( ch != '=' ) throw new XmlPullParserException( "expected equals sign (=) after encoding and not " + printable( ch ), this, null ); + printable( ch ), this, null ); + printable( ch ), this, null ); + " not " + printable( ch ), this, null ); + printable( ch ), this, null ); + printable( ch ), this, null ); throw new XmlPullParserException( "expected 'yes' or 'no' after standalone and not " + printable( ch ), this, null ); + printable( ch ), this, null ); if ( ch != '?' ) throw new XmlPullParserException( "expected ?> as last part of <?xml not " + printable( ch ), this, null ); throw new XmlPullParserException( "expected ?> as last part of <?xml not " + printable( ch ), this, null );
throw new XmlPullParserException( "unexpected markup <!" + printable( ch ), this, null ); throw new XmlPullParserException( "expected start tag name and not " + printable( ch ), this, null ); throw new XmlPullParserException( "expected start tag name and not " + printable( ch ), this, null ); + printable( ch ), this, null );
+ " not " + printable( ch ), this, null );
protected String printable(String s) { if(s == null) return null; final int sLen = s.length(); StringBuffer buf = new StringBuffer(sLen + 10); for(int i = 0; i < sLen; ++i) { buf.append(printable(s.charAt(i))); } s = buf.toString(); return s; }
protected char requireInput(char ch, char[] input) throws XmlPullParserException, IOException { for (int i = 0; i < input.length; i++) { if(ch != input[i]) { throw new XmlPullParserException( "expected "+printable(input[i])+" in "+new String(input) +" and not "+printable(ch), this, null); } ch = more(); } return ch; }
/** * Return string describing current position of parsers as * text 'STATE [seen %s...] @line:column'. */ public String getPositionDescription () { String fragment = null; if(posStart <= pos) { final int start = findFragment(0, buf, posStart, pos); //System.err.println("start="+start); if(start < pos) { fragment = new String(buf, start, pos - start); } if(bufAbsoluteStart > 0 || start > 0) fragment = "..." + fragment; } // return " at line "+tokenizerPosRow // +" and column "+(tokenizerPosCol-1) // +(fragment != null ? " seen "+printable(fragment)+"..." : ""); return " "+TYPES[ eventType ] + (fragment != null ? " seen "+printable(fragment)+"..." : "") +" "+(location != null ? location : "") +"@"+getLineNumber()+":"+getColumnNumber(); }
protected char requireNextS() throws XmlPullParserException, IOException { final char ch = more(); if(!isS(ch)) { throw new XmlPullParserException( "white space is required and not "+printable(ch), this, null); } return skipS(ch); }