/** * Reports XPointer Warnings * */ private void reportWarning(String key, Object[] arguments) throws XNIException { fXPointerErrorReporter.reportError( XPointerMessageFormatter.XPOINTER_DOMAIN, key, arguments, XMLErrorReporter.SEVERITY_WARNING); }
public void reportError(String domain, String key, Object[] arguments, short severity) throws XNIException { currentErrorKey = key; currentMessageArguments = arguments; super.reportError(domain, key, arguments, severity); } };
void reportSchemaError(XMLErrorReporter errorReporter, SimpleLocator loc, String key, Object[] args) { if (loc != null) { errorReporter.reportError(loc, XSMessageFormatter.SCHEMA_DOMAIN, key, args, XMLErrorReporter.SEVERITY_ERROR); } else { errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, key, args, XMLErrorReporter.SEVERITY_ERROR); } }
/** * Convenience function used in all XML scanners. */ protected void reportFatalError(String msgId, Object[] args) throws XNIException { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, msgId, args, XMLErrorReporter.SEVERITY_FATAL_ERROR); }
private void reportError(String key, Object[] args, short severity, Exception exception) { if (fErrorReporter != null) { fErrorReporter.reportError( XIncludeMessageFormatter.XINCLUDE_DOMAIN, key, args, severity, exception); } // we won't worry about when error reporter is null, since there should always be // at least the default error reporter }
/** * Reports an error at a specific location. * * @param location The error location. * @param domain The error domain. * @param key The key of the error message. * @param arguments The replacement arguments for the error message, * if needed. * @param severity The severity of the error. * @return The formatted error message. * * @see #SEVERITY_WARNING * @see #SEVERITY_ERROR * @see #SEVERITY_FATAL_ERROR */ public String reportError(XMLLocator location, String domain, String key, Object[] arguments, short severity) throws XNIException { return reportError(location, domain, key, arguments, severity, null); } // reportError(XMLLocator,String,String,Object[],short):String
/** * Reports an error. The error message passed to the error handler * is formatted for the locale by the message formatter installed * for the specified error domain. * * @param domain The error domain. * @param key The key of the error message. * @param arguments The replacement arguments for the error message, * if needed. * @param severity The severity of the error. * @return The formatted error message. * * @see #SEVERITY_WARNING * @see #SEVERITY_ERROR * @see #SEVERITY_FATAL_ERROR */ public String reportError(String domain, String key, Object[] arguments, short severity) throws XNIException { return reportError(fLocator, domain, key, arguments, severity); } // reportError(String,String,Object[],short):String
/** * Reports an error. The error message passed to the error handler * is formatted for the locale by the message formatter installed * for the specified error domain. * * @param domain The error domain. * @param key The key of the error message. * @param arguments The replacement arguments for the error message, * if needed. * @param severity The severity of the error. * @param exception The exception to wrap. * @return The formatted error message. * * @see #SEVERITY_WARNING * @see #SEVERITY_ERROR * @see #SEVERITY_FATAL_ERROR */ public String reportError(String domain, String key, Object[] arguments, short severity, Exception exception) throws XNIException { return reportError(fLocator, domain, key, arguments, severity, exception); } // reportError(String,String,Object[],short,Exception):String
public void nodeCountCheck(){ if( fSecurityManager != null && nodeCount++ > maxNodeLimit){ if(DEBUG){ System.out.println("nodeCount = " + nodeCount ) ; System.out.println("nodeLimit = " + maxNodeLimit ) ; } fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "maxOccurLimit", new Object[]{ new Integer(maxNodeLimit) }, XMLErrorReporter.SEVERITY_FATAL_ERROR); // similarly to entity manager behaviour, take into accont // behaviour if continue-after-fatal-error is set. nodeCount = 0; } }//nodeCountCheck()
void testOccurrences(int occurs) { if (fSecurityManager != null && (occurs < 0 || occurs > maxNodeLimit)) { fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "maxOccurLimit", new Object[]{ new Integer(maxNodeLimit) }, XMLErrorReporter.SEVERITY_FATAL_ERROR); } } }//CMNodeFactory()
/** Root element specified. */ private final void rootElementSpecified(QName rootElement) throws XNIException { if (fPerformValidation) { String root1 = fRootElement.rawname; String root2 = rootElement.rawname; if (root1 == null || !root1.equals(root2)) { fErrorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, "RootElementTypeMustMatchDoctypedecl", new Object[]{root1, root2}, XMLErrorReporter.SEVERITY_ERROR); } } } // rootElementSpecified(QName)
public void reportError(String domain, String key, Object[] arguments, short severity) throws XNIException { String message = fErrorReporter.reportError(domain, key, arguments, severity); if (fAugPSVI) { fErrors.addElement(key); fErrors.addElement(message); } } // reportError(String,String,Object[],short)
void reportSchemaError(String key, Object[] args, Element ele, Exception exception) { if (element2Locator(ele, xl)) { fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN, key, args, XMLErrorReporter.SEVERITY_ERROR, exception); } else { fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, key, args, XMLErrorReporter.SEVERITY_ERROR, exception); } }
void reportSchemaWarning(String key, Object[] args, Element ele, Exception exception) { if (element2Locator(ele, xl)) { fErrorReporter.reportError(xl, XSMessageFormatter.SCHEMA_DOMAIN, key, args, XMLErrorReporter.SEVERITY_WARNING, exception); } else { fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, key, args, XMLErrorReporter.SEVERITY_WARNING, exception); } }
public void reportError( XMLLocator location, String domain, String key, Object[] arguments, short severity) throws XNIException { String message = fErrorReporter.reportError(location, domain, key, arguments, severity); if (fAugPSVI) { fErrors.addElement(key); fErrors.addElement(message); } } // reportError(XMLLocator,String,String,Object[],short) }
public static void validateQNameValue(String qNameStr, NamespaceContext namespaceContext, XMLErrorReporter errorReporter) { String[] parsedQname = parseQnameString(qNameStr); String prefix = parsedQname[0]; String localpart = parsedQname[1]; // both prefix (if any) and localpart of QName, must be valid NCName if ((prefix.length() > 0 && !XMLChar.isValidNCName(prefix)) || !XMLChar.isValidNCName(localpart)) { errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "cvc-datatype-valid.1.2.1", new Object[] {qNameStr, "QName"}, XMLErrorReporter.SEVERITY_ERROR); } // try to resolve QName prefix to a namespace URI, and report an error if resolution fails. String uri = namespaceContext.getURI(prefix.intern()); if (prefix.length() > 0 && uri == null) { errorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "UndeclaredPrefix", new Object[] {qNameStr, prefix}, XMLErrorReporter.SEVERITY_ERROR); } } // validateQNameValue
/** * Adds an internal entity declaration. * <p> * <strong>Note:</strong> This method ignores subsequent entity * declarations. * <p> * <strong>Note:</strong> The name should be a unique symbol. The * SymbolTable can be used for this purpose. * * @param name The name of the entity. * @param text The text of the entity. * @param paramEntityRefs Count of direct and indirect references to parameter entities in the value of the entity. * * @see SymbolTable */ public void addInternalEntity(String name, String text, int paramEntityRefs) { if (!fEntities.containsKey(name)) { Entity entity = new InternalEntity(name, text, fInExternalSubset, paramEntityRefs); fEntities.put(name, entity); } else{ if(fWarnDuplicateEntityDef){ fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_DUPLICATE_ENTITY_DEFINITION", new Object[]{ name }, XMLErrorReporter.SEVERITY_WARNING ); } } } // addInternalEntity(String,String,int)
private void initGrammarBucket(){ if(fGrammarPool != null) { Grammar [] initialGrammars = fGrammarPool.retrieveInitialGrammarSet(XMLGrammarDescription.XML_SCHEMA); final int length = (initialGrammars != null) ? initialGrammars.length : 0; for (int i = 0; i < length; ++i) { // put this grammar into the bucket, along with grammars // imported by it (directly or indirectly) if (!fGrammarBucket.putGrammar((SchemaGrammar)(initialGrammars[i]), true)) { // REVISIT: a conflict between new grammar(s) and grammars // in the bucket. What to do? A warning? An exception? fErrorReporter.reportError(XSMessageFormatter.SCHEMA_DOMAIN, "GrammarConflict", null, XMLErrorReporter.SEVERITY_WARNING); } } } }
/** * Check standalone entity reference. * Made static to make common between the validator and loader. * * @param name *@param grammar grammar to which entity belongs * @param tempEntityDecl empty entity declaration to put results in * @param errorReporter error reporter to send errors to * * @throws XNIException Thrown by application to signal an error. */ protected static void checkStandaloneEntityRef(String name, DTDGrammar grammar, XMLEntityDecl tempEntityDecl, XMLErrorReporter errorReporter) throws XNIException { // check VC: Standalone Document Declartion, entities references appear in the document. int entIndex = grammar.getEntityDeclIndex(name); if (entIndex > -1) { grammar.getEntityDecl(entIndex, tempEntityDecl); if (tempEntityDecl.inExternal) { errorReporter.reportError( XMLMessageFormatter.XML_DOMAIN, "MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE", new Object[]{name}, XMLErrorReporter.SEVERITY_ERROR); } } }
/** * A comment. * * @param text The text in the comment. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by application to signal an error. */ public void comment(XMLString text, Augmentations augs) throws XNIException { // fixes E15.1 if (fPerformValidation && fElementDepth >= 0 && fDTDGrammar != null) { fDTDGrammar.getElementDecl(fCurrentElementIndex, fTempElementDecl); if (fTempElementDecl.type == XMLElementDecl.TYPE_EMPTY) { fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN, "MSG_CONTENT_INVALID_SPECIFIED", new Object[]{ fCurrentElement.rawname, "EMPTY", "comment"}, XMLErrorReporter.SEVERITY_ERROR); } } // call handlers if (fDocumentHandler != null) { fDocumentHandler.comment(text, augs); } } // comment(XMLString)