private void _reportBadDirective(String dir) throws XMLStreamException { String msg = "Unrecognized DTD directive '<!"+dir+" >'; expected ATTLIST, ELEMENT, ENTITY or NOTATION"; if (mCfgSupportDTDPP) { msg += " (or, for DTD++, TARGETNS)"; } _reportWFCViolation(msg); }
private void throwForbiddenPE() throws XMLStreamException { _reportWFCViolation("Can not have parameter entities in the internal subset, except for defining complete declarations (XML 1.0, #2.8, WFC 'PEs In Internal Subset')"); }
private void throwDTDAttrError(String msg, DTDElement elem, PrefixedName attrName) throws XMLStreamException { _reportWFCViolation(attrDesc(elem, attrName) + ": " + msg); }
protected void handleGreedyEntityProblem(WstxInputSource input) throws XMLStreamException { // Here it can only be of VC kind... if (mCfgFullyValidating) { // since it's a VC, not WFC _reportWFCViolation(entityDesc(input) + ": " + "Unbalanced PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } }
private void throwDTDElemError(String msg, Object elem) throws XMLStreamException { _reportWFCViolation(elemDesc(elem) + ": " + msg); }
private void loadMoreScoped(WstxInputSource currScope, String entityName, Location loc) throws XMLStreamException { boolean check = (mInput == currScope); loadMore(getErrorMsg()); // Did we get out of the scope? if (check && (mInput != currScope)) { _reportWFCViolation("Unterminated entity value for entity '" +entityName+"' (definition started at " +loc+")"); } }
/** * @return True, if input contains 'PUBLIC' keyword; false if it * contains 'SYSTEM'; otherwise throws an exception. */ private boolean checkPublicSystemKeyword(char c) throws XMLStreamException { String errId; if (c == 'P') { errId = checkDTDKeyword("UBLIC"); if (errId == null) { return true; } errId = "P" + errId; } else if (c == 'S') { errId = checkDTDKeyword("YSTEM"); if (errId == null) { return false; } errId = "S" + errId; } else { if (!isNameStartChar(c)) { throwDTDUnexpectedChar(c, "; expected 'PUBLIC' or 'SYSTEM' keyword"); } errId = readDTDKeyword(String.valueOf(c)); } _reportWFCViolation("Unrecognized keyword '"+errId+"'; expected 'PUBLIC' or 'SYSTEM'"); return false; // never gets here }
/** * Handling of PE matching problems is actually intricate; one type * will be a WFC ("PE Between Declarations", which refers to PEs that * start from outside declarations), and another just a VC * ("Proper Declaration/PE Nesting", when PE is contained within * declaration) */ protected void handleIncompleteEntityProblem(WstxInputSource closing) throws XMLStreamException { // Did it start outside of declaration? if (closing.getScopeId() == 0) { // yup // and being WFC, need not be validating _reportWFCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to fully contain a declaration (as per xml 1.0.3, section 2.8, WFC 'PE Between Declarations')"); } else { // whereas the other one is only sent in validating mode.. if (mCfgFullyValidating) { _reportVCViolation(entityDesc(closing) + ": " +"Incomplete PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } } }
_reportWFCViolation("Internal DTD subset can not use (INCLUDE/IGNORE) directives (except via external entities)"); _reportWFCViolation("Unrecognized directive '"+keyword+"'; expected either 'IGNORE' or 'INCLUDE'");
_reportWFCViolation("Empty content specification for '"+elemName+"' (need at least one entry)"); } else { if (isChoice != newChoice) { _reportWFCViolation("Can not mix content spec separators ('|' and ','); need to use parenthesis groups");
_reportWFCViolation("Unrecognized directive #"+keyw+"'; expected #PCDATA (or element name)"); if (c != '*') { if (m.size() > 0) { _reportWFCViolation("Missing trailing '*' after a non-empty mixed content specification");
_reportWFCViolation("Missing namespace URI for TARGETNS directive");
_reportWFCViolation(ErrorConsts.ERR_WF_PI_MISSING_TARGET); _reportWFCViolation(ErrorConsts.ERR_WF_PI_XML_TARGET, target);
private void throwDTDAttrError(String msg, DTDElement elem, PrefixedName attrName) throws XMLStreamException { _reportWFCViolation(attrDesc(elem, attrName) + ": " + msg); }
protected void handleGreedyEntityProblem(WstxInputSource input) throws XMLStreamException { // Here it can only be of VC kind... if (mCfgFullyValidating) { // since it's a VC, not WFC _reportWFCViolation(entityDesc(input) + ": " + "Unbalanced PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } }
private void throwDTDElemError(String msg, Object elem) throws XMLStreamException { _reportWFCViolation(elemDesc(elem) + ": " + msg); }
protected void handleGreedyEntityProblem(WstxInputSource input) throws XMLStreamException { // Here it can only be of VC kind... if (mCfgFullyValidating) { // since it's a VC, not WFC _reportWFCViolation(entityDesc(input) + ": " + "Unbalanced PE: has to be fully contained in a declaration (as per xml 1.0.3, section 2.8, VC 'Proper Declaration/PE Nesting')"); } }
keyw = readDTDKeyword(String.valueOf(c)); _reportWFCViolation("Unrecognized DTD content spec keyword '" +keyw+"' (for element <"+elemName+">); expected ANY or EMPTY"); } while (false);
_reportWFCViolation("Unexpected end of ENTITY declaration (expected a system id after public id): trying to use an SGML DTD instead of XML one?"); _reportWFCViolation("Unrecognized keyword '"+keyw+"'; expected NOTATION (or closing '>')");
_reportWFCViolation("Unterminated attribute default value for attribute '" +attrName+"' (definition started at " +loc+")");