Java Code Examples for com.sun.org.apache.xerces.internal.xs.XSConstants#SCOPE_GLOBAL

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSConstants#SCOPE_GLOBAL . 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: XSConstraints.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkElementDeclsConsistent(XSComplexTypeDecl type,
        XSParticleDecl particle,
        SymbolHash elemDeclHash,
        SubstitutionGroupHandler sgHandler)
    throws XMLSchemaException {

    // check for elements in the tree with the same name and namespace

    int pType = particle.fType;

    if (pType == XSParticleDecl.PARTICLE_WILDCARD)
        return;

    if (pType == XSParticleDecl.PARTICLE_ELEMENT) {
        XSElementDecl elem = (XSElementDecl)(particle.fValue);
        findElemInTable(type, elem, elemDeclHash);

        if (elem.fScope == XSConstants.SCOPE_GLOBAL) {
            // Check for subsitution groups.
            XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(elem);
            for (int i = 0; i < subGroup.length; i++) {
                findElemInTable(type, subGroup[i], elemDeclHash);
            }
        }
        return;
    }

    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    for (int i = 0; i < group.fParticleCount; i++)
        checkElementDeclsConsistent(type, group.fParticles[i], elemDeclHash, sgHandler);
}
 
Example 2
Source File: XSConstraints.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public static void checkElementDeclsConsistent(XSComplexTypeDecl type,
        XSParticleDecl particle,
        SymbolHash elemDeclHash,
        SubstitutionGroupHandler sgHandler)
    throws XMLSchemaException {

    // check for elements in the tree with the same name and namespace

    int pType = particle.fType;

    if (pType == XSParticleDecl.PARTICLE_WILDCARD)
        return;

    if (pType == XSParticleDecl.PARTICLE_ELEMENT) {
        XSElementDecl elem = (XSElementDecl)(particle.fValue);
        findElemInTable(type, elem, elemDeclHash);

        if (elem.fScope == XSConstants.SCOPE_GLOBAL) {
            // Check for subsitution groups.
            XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(elem);
            for (int i = 0; i < subGroup.length; i++) {
                findElemInTable(type, subGroup[i], elemDeclHash);
            }
        }
        return;
    }

    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    for (int i = 0; i < group.fParticleCount; i++)
        checkElementDeclsConsistent(type, group.fParticles[i], elemDeclHash, sgHandler);
}
 
Example 3
Source File: SubstitutionGroupHandler.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (Objects.equals(element.localpart, exemplar.fName) &&
        Objects.equals(element.uri, exemplar.fTargetNamespace)) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL) {
        return null;
    }

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
        return null;
    }

    // get the decl for the element
    XSElementDecl eDecl = fXSElementDeclHelper.getGlobalElementDecl(element);
    if (eDecl == null) {
        return null;
    }

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock)) {
        return eDecl;
    }

    return null;
}
 
Example 4
Source File: XSDHandler.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedElementComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 5
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void addRelatedAttribute(XSAttributeDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedAttributeComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 6
Source File: XSConstraints.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public static void checkElementDeclsConsistent(XSComplexTypeDecl type,
        XSParticleDecl particle,
        SymbolHash elemDeclHash,
        SubstitutionGroupHandler sgHandler)
    throws XMLSchemaException {

    // check for elements in the tree with the same name and namespace

    int pType = particle.fType;

    if (pType == XSParticleDecl.PARTICLE_WILDCARD)
        return;

    if (pType == XSParticleDecl.PARTICLE_ELEMENT) {
        XSElementDecl elem = (XSElementDecl)(particle.fValue);
        findElemInTable(type, elem, elemDeclHash);

        if (elem.fScope == XSConstants.SCOPE_GLOBAL) {
            // Check for subsitution groups.
            XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(elem);
            for (int i = 0; i < subGroup.length; i++) {
                findElemInTable(type, subGroup[i], elemDeclHash);
            }
        }
        return;
    }

    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    for (int i = 0; i < group.fParticleCount; i++)
        checkElementDeclsConsistent(type, group.fParticles[i], elemDeclHash, sgHandler);
}
 
Example 7
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
private void addRelatedAttribute(XSAttributeDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedAttributeComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 8
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedElementComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 9
Source File: SubstitutionGroupHandler.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (element.localpart == exemplar.fName &&
        element.uri == exemplar.fTargetNamespace) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL)
        return null;

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0)
        return null;

    // get grammar of the element
    SchemaGrammar sGrammar = fGrammarBucket.getGrammar(element.uri);
    if (sGrammar == null)
        return null;

    // get the decl for the element
    XSElementDecl eDecl = sGrammar.getGlobalElementDecl(element.localpart);
    if (eDecl == null)
        return null;

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock))
        return eDecl;

    return null;
}
 
Example 10
Source File: SubstitutionGroupHandler.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (element.localpart == exemplar.fName &&
        element.uri == exemplar.fTargetNamespace) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL)
        return null;

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0)
        return null;

    // get grammar of the element
    SchemaGrammar sGrammar = fGrammarBucket.getGrammar(element.uri);
    if (sGrammar == null)
        return null;

    // get the decl for the element
    XSElementDecl eDecl = sGrammar.getGlobalElementDecl(element.localpart);
    if (eDecl == null)
        return null;

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock))
        return eDecl;

    return null;
}
 
Example 11
Source File: SubstitutionGroupHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (element.localpart == exemplar.fName &&
        element.uri == exemplar.fTargetNamespace) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL)
        return null;

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0)
        return null;

    // get grammar of the element
    SchemaGrammar sGrammar = fGrammarBucket.getGrammar(element.uri);
    if (sGrammar == null)
        return null;

    // get the decl for the element
    XSElementDecl eDecl = sGrammar.getGlobalElementDecl(element.localpart);
    if (eDecl == null)
        return null;

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock))
        return eDecl;

    return null;
}
 
Example 12
Source File: XSConstraints.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkElementDeclsConsistent(XSComplexTypeDecl type,
        XSParticleDecl particle,
        SymbolHash elemDeclHash,
        SubstitutionGroupHandler sgHandler)
    throws XMLSchemaException {

    // check for elements in the tree with the same name and namespace

    int pType = particle.fType;

    if (pType == XSParticleDecl.PARTICLE_WILDCARD)
        return;

    if (pType == XSParticleDecl.PARTICLE_ELEMENT) {
        XSElementDecl elem = (XSElementDecl)(particle.fValue);
        findElemInTable(type, elem, elemDeclHash);

        if (elem.fScope == XSConstants.SCOPE_GLOBAL) {
            // Check for subsitution groups.
            XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(elem);
            for (int i = 0; i < subGroup.length; i++) {
                findElemInTable(type, subGroup[i], elemDeclHash);
            }
        }
        return;
    }

    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    for (int i = 0; i < group.fParticleCount; i++)
        checkElementDeclsConsistent(type, group.fParticles[i], elemDeclHash, sgHandler);
}
 
Example 13
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedElementComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 14
Source File: XSConstraints.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public static void checkElementDeclsConsistent(XSComplexTypeDecl type,
        XSParticleDecl particle,
        SymbolHash elemDeclHash,
        SubstitutionGroupHandler sgHandler)
    throws XMLSchemaException {

    // check for elements in the tree with the same name and namespace

    int pType = particle.fType;

    if (pType == XSParticleDecl.PARTICLE_WILDCARD)
        return;

    if (pType == XSParticleDecl.PARTICLE_ELEMENT) {
        XSElementDecl elem = (XSElementDecl)(particle.fValue);
        findElemInTable(type, elem, elemDeclHash);

        if (elem.fScope == XSConstants.SCOPE_GLOBAL) {
            // Check for subsitution groups.
            XSElementDecl[] subGroup = sgHandler.getSubstitutionGroup(elem);
            for (int i = 0; i < subGroup.length; i++) {
                findElemInTable(type, subGroup[i], elemDeclHash);
            }
        }
        return;
    }

    XSModelGroupImpl group = (XSModelGroupImpl)particle.fValue;
    for (int i = 0; i < group.fParticleCount; i++)
        checkElementDeclsConsistent(type, group.fParticles[i], elemDeclHash, sgHandler);
}
 
Example 15
Source File: XSDHandler.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void addRelatedAttribute(XSAttributeDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedAttributeComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 16
Source File: SubstitutionGroupHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (element.localpart == exemplar.fName &&
        element.uri == exemplar.fTargetNamespace) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL) {
        return null;
    }

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0) {
        return null;
    }

    // get the decl for the element
    XSElementDecl eDecl = fXSElementDeclHelper.getGlobalElementDecl(element);
    if (eDecl == null) {
        return null;
    }

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock)) {
        return eDecl;
    }

    return null;
}
 
Example 17
Source File: SubstitutionGroupHandler.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public XSElementDecl getMatchingElemDecl(QName element, XSElementDecl exemplar) {
    if (element.localpart == exemplar.fName &&
        element.uri == exemplar.fTargetNamespace) {
        return exemplar;
    }

    // if the exemplar is not a global element decl, then it's not possible
    // to be substituted by another element.
    if (exemplar.fScope != XSConstants.SCOPE_GLOBAL)
        return null;

    // if the decl blocks substitution, return false
    if ((exemplar.fBlock & XSConstants.DERIVATION_SUBSTITUTION) != 0)
        return null;

    // get grammar of the element
    SchemaGrammar sGrammar = fGrammarBucket.getGrammar(element.uri);
    if (sGrammar == null)
        return null;

    // get the decl for the element
    XSElementDecl eDecl = sGrammar.getGlobalElementDecl(element.localpart);
    if (eDecl == null)
        return null;

    // and check by using substitutionGroup information
    if (substitutionGroupOK(eDecl, exemplar, exemplar.fBlock))
        return eDecl;

    return null;
}
 
Example 18
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedElementComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 19
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void addRelatedAttribute(XSAttributeDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedAttributeComponents(decl, componentList, namespace, dependencies);
    }
}
 
Example 20
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
private void addRelatedElement(XSElementDeclaration decl, Vector componentList, String namespace, Map<String, Vector> dependencies) {
    if (decl.getScope() == XSConstants.SCOPE_GLOBAL) {
        if (!componentList.contains(decl)) {
            Vector importedNamespaces = findDependentNamespaces(namespace, dependencies);
            addNamespaceDependency(namespace, decl.getNamespace(), importedNamespaces);
            componentList.add(decl);
        }
    }
    else {
        expandRelatedElementComponents(decl, componentList, namespace, dependencies);
    }
}