protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String getErrorDesc(int errorType, int currEvent) { // Defaults are mostly fine, except we can easily add event type desc switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return ErrorConsts.ERR_STATE_NOT_STELEM+", got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token, got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag(), got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_WRONG_TYPE: return "Got "+ErrorConsts.tokenTypeDesc(currEvent)+", instead of START_ELEMENT, END_ELEMENT or SPACE"; } return null; }
protected void reportInvalidContent(int evtType) throws XMLStreamException { switch (mVldContent) { case XMLValidator.CONTENT_ALLOW_NONE: reportValidationProblem(ErrorConsts.ERR_VLD_EMPTY, getTopElementDesc(), ErrorConsts.tokenTypeDesc(evtType)); break; case XMLValidator.CONTENT_ALLOW_WS: reportValidationProblem(ErrorConsts.ERR_VLD_NON_MIXED, getTopElementDesc()); break; case XMLValidator.CONTENT_ALLOW_VALIDATABLE_TEXT: case XMLValidator.CONTENT_ALLOW_ANY_TEXT: /* Not 100% sure if this should ever happen... depends on * interpretation of 'any' content model? */ reportValidationProblem(ErrorConsts.ERR_VLD_ANY, getTopElementDesc(), ErrorConsts.tokenTypeDesc(evtType)); break; default: // should never occur: reportValidationProblem("Internal error: trying to report invalid content for "+evtType); } }
reportValidationProblem(ErrorConsts.ERR_VLD_EMPTY, mElementStack.getTopElementDesc(), ErrorConsts.tokenTypeDesc(evtType)); break; case XMLValidator.CONTENT_ALLOW_WS: ErrorConsts.tokenTypeDesc(evtType)); break; default: // should never occur:
return next; throwParseError("Received event "+ErrorConsts.tokenTypeDesc(next) +", instead of START_ELEMENT or END_ELEMENT.");
if (be == null) { // incorrect state throw new WstxException("Trying to create START_ELEMENT when current event is " +ErrorConsts.tokenTypeDesc(sr.getEventType()), loc); case ATTRIBUTE: throw new WstxException("Internal error: should not get " +ErrorConsts.tokenTypeDesc(r.getEventType())); default: throw new IllegalStateException("Unrecognized event type "+r.getEventType()+".");
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
@Override protected String getErrorDesc(int errorType, int currEvent) { // Defaults are mostly fine, except we can easily add event type desc switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return ErrorConsts.ERR_STATE_NOT_STELEM+", got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token, got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag(), got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_WRONG_TYPE: return "Got "+ErrorConsts.tokenTypeDesc(currEvent)+", instead of START_ELEMENT, END_ELEMENT or SPACE"; } return null; }
protected String tokenTypeDesc(int type) { return ErrorConsts.tokenTypeDesc(type); }
protected String getErrorDesc(int errorType, int currEvent) { // Defaults are mostly fine, except we can easily add event type desc switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return ErrorConsts.ERR_STATE_NOT_STELEM+", got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token, got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag(), got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_WRONG_TYPE: return "Got "+ErrorConsts.tokenTypeDesc(currEvent)+", instead of START_ELEMENT, END_ELEMENT or SPACE"; } return null; }
private void throwNotTextual(int type) { throw new IllegalStateException("Not a textual event (" +ErrorConsts.tokenTypeDesc(mCurrEvent)+")"); }
private void throwNotTextual(int type) { throw new IllegalStateException("Not a textual event (" +ErrorConsts.tokenTypeDesc(mCurrEvent)+")"); }
/** * Method called upon encountering a problem that should result * in an exception being thrown. If non-null String is returned. * that will be used as the message of exception thrown; if null, * a standard message will be used instead. * * @param errorType Type of the problem, one of <code>ERR_</code> * constants * @param eventType Type of the event that triggered the problem, * if any; -1 if not available. */ protected String getErrorDesc(int errorType, int currEvent) { // Defaults are mostly fine, except we can easily add event type desc switch (errorType) { case ERR_GETELEMTEXT_NOT_START_ELEM: return ErrorConsts.ERR_STATE_NOT_STELEM+", got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_GETELEMTEXT_NON_TEXT_EVENT: return "Expected a text token, got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_NON_WS_TEXT: return "Only all-whitespace CHARACTERS/CDATA (or SPACE) allowed for nextTag(), got "+ErrorConsts.tokenTypeDesc(currEvent); case ERR_NEXTTAG_WRONG_TYPE: return "Got "+ErrorConsts.tokenTypeDesc(currEvent)+", instead of START_ELEMENT, END_ELEMENT or SPACE"; } return null; }
private void throwNotTextual(int type) { throw new IllegalStateException("Not a textual event (" +ErrorConsts.tokenTypeDesc(mCurrEvent)+")"); }