SCXMLReader.java 文件源码

java
阅读 25 收藏 0 点赞 0 评论 0

项目:commons-scxml 作者:
/**
 * Report a conflicting attribute via the {@link XMLReporter} if available and
 * {@link org.apache.commons.logging.Log}.
 *
 * @param reader The {@link XMLStreamReader} providing the SCXML document to parse.
 * @param configuration The {@link Configuration} to use while parsing.
 * @param element The element name.
 * @param attr The attribute with which a conflict is detected.
 * @param conflictingAttr The conflicting attribute
 *
 * @throws XMLStreamException An exception processing the underlying {@link XMLStreamReader}.
 * @throws ModelException The Commons SCXML object model is incomplete or inconsistent (includes
 *                        errors in the SCXML document that may not be identified by the schema).
 */
private static void reportConflictingAttribute(final XMLStreamReader reader, final Configuration configuration,
                                         final String element, final String attr, final String conflictingAttr)
        throws XMLStreamException, ModelException {

    StringBuilder sb = new StringBuilder();
    sb.append("Ignoring <").append(element).append("> attribute \"").append(conflictingAttr)
            .append("\" which conflicts with already defined attribute \"").append(attr)
            .append("\" at ").append(reader.getLocation());
    if (!configuration.isSilent() && logger.isWarnEnabled()) {
        logger.warn(sb.toString());
    }
    if (configuration.isStrict()) {
        throw new ModelException(sb.toString());
    }
    XMLReporter reporter = configuration.reporter;
    if (reporter != null) {
        reporter.report(sb.toString(), "COMMONS_SCXML", null, reader.getLocation());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号