SCXMLReader.java 文件源码

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

项目:commons-scxml 作者:
/**
 * Report an ignored 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 which is ignored.
 * @param value The value of the attribute which is ignored.
 *
 * @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 reportIgnoredAttribute(final XMLStreamReader reader, final Configuration configuration,
                                           final String element, final String attr, final String value)
        throws XMLStreamException, ModelException {

    StringBuilder sb = new StringBuilder();
    sb.append("Ignoring unknown or invalid <").append(element).append("> attribute ").append(attr)
            .append("=\"").append(value).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());
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号