gpt4 book ai didi

org.apache.xerces.impl.XMLErrorReporter.reportError()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-23 17:35:05 26 4
gpt4 key购买 nike

本文整理了Java中org.apache.xerces.impl.XMLErrorReporter.reportError()方法的一些代码示例,展示了XMLErrorReporter.reportError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLErrorReporter.reportError()方法的具体详情如下:
包路径:org.apache.xerces.impl.XMLErrorReporter
类名称:XMLErrorReporter
方法名:reportError

XMLErrorReporter.reportError介绍

[英]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.
[中]报告错误。传递给错误处理程序的错误消息由为指定错误域安装的消息格式化程序针对区域设置进行格式化。

代码示例

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * Reports XPointer Warnings
 * 
 */
private void reportWarning(String key, Object[] arguments)
    throws XNIException {
  fXPointerErrorReporter.reportError(
      XPointerMessageFormatter.XPOINTER_DOMAIN, key, arguments,
      XMLErrorReporter.SEVERITY_WARNING);
}

代码示例来源:origin: org.wso2.wsdl.validator/wsdl-validator

public void reportError(String domain, String key, Object[] arguments,
   short severity) throws XNIException
 {
  currentErrorKey = key;
  currentMessageArguments = arguments;
  super.reportError(domain, key, arguments, severity);
 }
};

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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);
  }
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * 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);
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * 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

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * 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

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * 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

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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()

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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()

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/** 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)

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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)

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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);
  }
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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);
  }
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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)
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * 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)

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

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);
      }
    }
  }
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/** 
 * 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);
    }
  }
}

代码示例来源:origin: com.rackspace.apache/xerces2-xsd11

/**
 * 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)

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com