Java Code Examples for com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar#isImmutable()

The following examples show how to use com.sun.org.apache.xerces.internal.impl.xs.SchemaGrammar#isImmutable() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 6 votes vote down vote up
private void addGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
    if (dstGrammar == null) {
        createGrammarFrom(srcGrammar);
        return;
    }

    SchemaGrammar tmpGrammar = dstGrammar;
    if (tmpGrammar.isImmutable()) {
        tmpGrammar = createGrammarFrom(dstGrammar);
    }

    // add any new locations
    addNewGrammarLocations(srcGrammar, tmpGrammar);

    // add any new imported grammars
    addNewImportedGrammars(srcGrammar, tmpGrammar);

    // add any new global components
    addNewGrammarComponents(srcGrammar, tmpGrammar);
}
 
Example 2
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 3
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 4
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void addGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
    if (dstGrammar == null) {
        createGrammarFrom(srcGrammar);
        return;
    }

    SchemaGrammar tmpGrammar = dstGrammar;
    if (tmpGrammar.isImmutable()) {
        tmpGrammar = createGrammarFrom(dstGrammar);
    }

    // add any new locations
    addNewGrammarLocations(srcGrammar, tmpGrammar);

    // add any new imported grammars
    addNewImportedGrammars(srcGrammar, tmpGrammar);

    // add any new global components
    addNewGrammarComponents(srcGrammar, tmpGrammar);
}
 
Example 5
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 6
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private void addGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
    if (dstGrammar == null) {
        createGrammarFrom(srcGrammar);
        return;
    }

    SchemaGrammar tmpGrammar = dstGrammar;
    if (tmpGrammar.isImmutable()) {
        tmpGrammar = createGrammarFrom(dstGrammar);
    }

    // add any new locations
    addNewGrammarLocations(srcGrammar, tmpGrammar);

    // add any new imported grammars
    addNewImportedGrammars(srcGrammar, tmpGrammar);

    // add any new global components
    addNewGrammarComponents(srcGrammar, tmpGrammar);
}
 
Example 7
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 8
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 9
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void addGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
    if (dstGrammar == null) {
        createGrammarFrom(srcGrammar);
        return;
    }

    SchemaGrammar tmpGrammar = dstGrammar;
    if (tmpGrammar.isImmutable()) {
        tmpGrammar = createGrammarFrom(dstGrammar);
    }

    // add any new locations
    addNewGrammarLocations(srcGrammar, tmpGrammar);

    // add any new imported grammars
    addNewImportedGrammars(srcGrammar, tmpGrammar);

    // add any new global components
    addNewGrammarComponents(srcGrammar, tmpGrammar);
}
 
Example 10
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private void addGrammarComponents(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) {
    if (dstGrammar == null) {
        createGrammarFrom(srcGrammar);
        return;
    }

    SchemaGrammar tmpGrammar = dstGrammar;
    if (tmpGrammar.isImmutable()) {
        tmpGrammar = createGrammarFrom(dstGrammar);
    }

    // add any new locations
    addNewGrammarLocations(srcGrammar, tmpGrammar);

    // add any new imported grammars
    addNewImportedGrammars(srcGrammar, tmpGrammar);

    // add any new global components
    addNewGrammarComponents(srcGrammar, tmpGrammar);
}
 
Example 11
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 12
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 13
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
private boolean isExistingGrammar(XSDDescription desc, boolean ignoreConflict) {
    SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
    if (sg == null) {
        return findGrammar(desc, ignoreConflict) != null;
    }
    else if (sg.isImmutable()) {
        return true;
    }
    else {
        try {
            return sg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(desc.getLiteralSystemId(), desc.getBaseSystemId(), false));
        }
        catch (MalformedURIException e) {
            return false;
        }
    }
}
 
Example 14
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}
 
Example 15
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}
 
Example 16
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}
 
Example 17
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}
 
Example 18
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}
 
Example 19
Source File: XSDHandler.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}
 
Example 20
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private boolean canAddComponent(XSObject component, XSDDescription desc) {
    desc.setNamespace(component.getNamespace());

    final SchemaGrammar sg = findGrammar(desc, false);
    if (sg == null) {
        return true;
    }
    else if (sg.isImmutable()) {
        return false;
    }

    short componentType = component.getType();
    final String name = component.getName();

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (sg.getGlobalTypeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (sg.getGlobalElementDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == component) {
            return true;
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        return true;
    }
    return false;
}