DTDSubsetImpl.java 文件源码

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

项目:woodstox 作者:
/**
 * Method that will combine definitions from internal and external subsets,
 * producing a single DTD set.
 */
@Override
public DTDSubset combineWithExternalSubset(InputProblemReporter rep, DTDSubset extSubset)
    throws XMLStreamException
{
    /* First let's see if we can just reuse GE Map used by int or ext
     * subset; (if only one has contents), or if not, combine them.
     */
    HashMap<String,EntityDecl> ge1 = getGeneralEntityMap();
    HashMap<String,EntityDecl> ge2 = extSubset.getGeneralEntityMap();
    if (ge1 == null || ge1.isEmpty()) {
        ge1 = ge2;
    } else {
        if (ge2 != null && !ge2.isEmpty()) {
            /* Internal subset Objects are never shared or reused (and by
             * extension, neither are objects they contain), so we can just
             * modify GE map if necessary
             */
            combineMaps(ge1, ge2);
        }
    }

    // Ok, then, let's combine notations similarly
    HashMap<String,NotationDeclaration> n1 = getNotationMap();
    HashMap<String,NotationDeclaration> n2 = extSubset.getNotationMap();
    if (n1 == null || n1.isEmpty()) {
        n1 = n2;
    } else {
        if (n2 != null && !n2.isEmpty()) {
            /* First; let's make sure there are no colliding notation
             * definitions: it's an error to try to redefine notations.
             */
            checkNotations(n1, n2);

            /* Internal subset Objects are never shared or reused (and by
             * extension, neither are objects they contain), so we can just
             * modify notation map if necessary
             */
            combineMaps(n1, n2);
        }
    }


    // And finally elements, rather similarly:
    HashMap<PrefixedName,DTDElement> e1 = getElementMap();
    HashMap<PrefixedName,DTDElement> e2 = extSubset.getElementMap();
    if (e1 == null || e1.isEmpty()) {
        e1 = e2;
    } else {
        if (e2 != null && !e2.isEmpty()) {
            /* Internal subset Objects are never shared or reused (and by
             * extension, neither are objects they contain), so we can just
             * modify element map if necessary
             */
            combineElements(rep, e1, e2);
        }
    }

    /* Combos are not cachable, and because of that, there's no point
     * in storing any PE info either.
     */
    return constructInstance(false, ge1, null, null, null, n1, e1,
                             mFullyValidating);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号