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

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSConstants#IDENTITY_CONSTRAINT . 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 expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
Example 2
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
Example 3
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
Example 4
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 6 votes vote down vote up
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
Example 5
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
private void expandRelatedComponents(XSObject component, Vector componentList, Map<String, Vector> dependencies) {
    short componentType = component.getType();
    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        expandRelatedTypeComponents((XSTypeDefinition) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        expandRelatedAttributeComponents((XSAttributeDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        expandRelatedAttributeGroupComponents((XSAttributeGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ELEMENT_DECLARATION :
        expandRelatedElementComponents((XSElementDeclaration) component, componentList, component.getNamespace(), dependencies);
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        expandRelatedModelGroupDefinitionComponents((XSModelGroupDefinition) component, componentList, component.getNamespace(), dependencies);
    case XSConstants.ATTRIBUTE_USE :
        //expandRelatedAttributeUseComponents((XSAttributeUse)component, componentList, dependencies);
    case XSConstants.NOTATION_DECLARATION :
    case XSConstants.IDENTITY_CONSTRAINT :
    default :
        break;
    }
}
 
Example 6
Source File: IdentityConstraint.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the type of the object, i.e ELEMENT_DECLARATION.
 */
public short getType() {
    return XSConstants.IDENTITY_CONSTRAINT;
}
 
Example 7
Source File: XSDHandler.java    From openjdk-8-source 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 8
Source File: XSDHandler.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void addGlobalComponent(XSObject component, XSDDescription desc) {
    final String namespace = component.getNamespace();

    desc.setNamespace(namespace);
    final SchemaGrammar sg = getSchemaGrammar(desc);

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

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (!((XSTypeDefinition) component).getAnonymous()) {
            if (sg.getGlobalTypeDecl(name) == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalTypeDecl(name, "") == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
            if (sg.getGlobalAttributeDecl(name) == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalAttributeDecl(name, "") == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalAttributeDecl(name, "") == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
            sg.addGlobalElementDeclAll((XSElementDecl) component);

            if (sg.getGlobalElementDecl(name) == null) {
                sg.addGlobalElementDecl((XSElementDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalElementDecl(name, "") == null) {
                sg.addGlobalElementDecl((XSElementDecl) component, "");
            }
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalGroupDecl(name, "") == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component, "");
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalNotationDecl(name, "") == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component, "");
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        break;
    }
}
 
Example 9
Source File: XSDHandler.java    From hottub 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 10
Source File: SchemaGrammar.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
public synchronized ObjectList getComponentsExt(short objectType) {
    if (objectType <= 0 || objectType > MAX_COMP_IDX ||
        !GLOBAL_COMP[objectType]) {
        return ObjectListImpl.EMPTY_LIST;
    }

    if (fComponentsExt == null)
        fComponentsExt = new ObjectList[MAX_COMP_IDX+1];

    // get the hashtable for this type of components
    if (fComponentsExt[objectType] == null) {
        SymbolHash table = null;
        switch (objectType) {
        case XSConstants.TYPE_DEFINITION:
        case XSTypeDefinition.COMPLEX_TYPE:
        case XSTypeDefinition.SIMPLE_TYPE:
            table = fGlobalTypeDeclsExt;
            break;
        case XSConstants.ATTRIBUTE_DECLARATION:
            table = fGlobalAttrDeclsExt;
            break;
        case XSConstants.ELEMENT_DECLARATION:
            table = fGlobalElemDeclsExt;
            break;
        case XSConstants.ATTRIBUTE_GROUP:
            table = fGlobalAttrGrpDeclsExt;
            break;
        case XSConstants.MODEL_GROUP_DEFINITION:
            table = fGlobalGroupDeclsExt;
            break;
        case XSConstants.NOTATION_DECLARATION:
            table = fGlobalNotationDeclsExt;
            break;
        case XSConstants.IDENTITY_CONSTRAINT:
            table = this.fGlobalIDConstraintDeclsExt;
            break;
        }

        Object[] entries = table.getEntries();
        fComponentsExt[objectType] = new ObjectListImpl(entries, entries.length);
    }

    return fComponentsExt[objectType];
}
 
Example 11
Source File: IdentityConstraint.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Get the type of the object, i.e ELEMENT_DECLARATION.
 */
public short getType() {
    return XSConstants.IDENTITY_CONSTRAINT;
}
 
Example 12
Source File: XSDHandler.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void addGlobalComponent(XSObject component, XSDDescription desc) {
    final String namespace = component.getNamespace();

    desc.setNamespace(namespace);
    final SchemaGrammar sg = getSchemaGrammar(desc);

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

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (!((XSTypeDefinition) component).getAnonymous()) {
            if (sg.getGlobalTypeDecl(name) == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalTypeDecl(name, "") == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
            if (sg.getGlobalAttributeDecl(name) == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalAttributeDecl(name, "") == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalAttributeDecl(name, "") == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
            sg.addGlobalElementDeclAll((XSElementDecl) component);

            if (sg.getGlobalElementDecl(name) == null) {
                sg.addGlobalElementDecl((XSElementDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalElementDecl(name, "") == null) {
                sg.addGlobalElementDecl((XSElementDecl) component, "");
            }
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalGroupDecl(name, "") == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component, "");
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalNotationDecl(name, "") == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component, "");
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        break;
    }
}
 
Example 13
Source File: XSDHandler.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void addGlobalComponent(XSObject component, XSDDescription desc) {
    final String namespace = component.getNamespace();

    desc.setNamespace(namespace);
    final SchemaGrammar sg = getSchemaGrammar(desc);

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

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (!((XSTypeDefinition) component).getAnonymous()) {
            if (sg.getGlobalTypeDecl(name) == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalTypeDecl(name, "") == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
            if (sg.getGlobalAttributeDecl(name) == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalAttributeDecl(name, "") == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalAttributeDecl(name, "") == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
            sg.addGlobalElementDeclAll((XSElementDecl) component);

            if (sg.getGlobalElementDecl(name) == null) {
                sg.addGlobalElementDecl((XSElementDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalElementDecl(name, "") == null) {
                sg.addGlobalElementDecl((XSElementDecl) component, "");
            }
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalGroupDecl(name, "") == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component, "");
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalNotationDecl(name, "") == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component, "");
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        break;
    }
}
 
Example 14
Source File: XSDHandler.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void addGlobalComponent(XSObject component, XSDDescription desc) {
    final String namespace = component.getNamespace();

    desc.setNamespace(namespace);
    final SchemaGrammar sg = getSchemaGrammar(desc);

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

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (!((XSTypeDefinition) component).getAnonymous()) {
            if (sg.getGlobalTypeDecl(name) == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalTypeDecl(name, "") == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
            if (sg.getGlobalAttributeDecl(name) == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalAttributeDecl(name, "") == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalAttributeDecl(name, "") == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
            sg.addGlobalElementDeclAll((XSElementDecl) component);

            if (sg.getGlobalElementDecl(name) == null) {
                sg.addGlobalElementDecl((XSElementDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalElementDecl(name, "") == null) {
                sg.addGlobalElementDecl((XSElementDecl) component, "");
            }
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalGroupDecl(name, "") == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component, "");
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalNotationDecl(name, "") == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component, "");
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        break;
    }
}
 
Example 15
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 16
Source File: IdentityConstraint.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * Get the type of the object, i.e ELEMENT_DECLARATION.
 */
public short getType() {
    return XSConstants.IDENTITY_CONSTRAINT;
}
 
Example 17
Source File: XSDHandler.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void addGlobalComponent(XSObject component, XSDDescription desc) {
    final String namespace = component.getNamespace();

    desc.setNamespace(namespace);
    final SchemaGrammar sg = getSchemaGrammar(desc);

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

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (!((XSTypeDefinition) component).getAnonymous()) {
            if (sg.getGlobalTypeDecl(name) == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalTypeDecl(name, "") == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
            if (sg.getGlobalAttributeDecl(name) == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalAttributeDecl(name, "") == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalAttributeDecl(name, "") == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
            sg.addGlobalElementDeclAll((XSElementDecl) component);

            if (sg.getGlobalElementDecl(name) == null) {
                sg.addGlobalElementDecl((XSElementDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalElementDecl(name, "") == null) {
                sg.addGlobalElementDecl((XSElementDecl) component, "");
            }
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalGroupDecl(name, "") == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component, "");
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalNotationDecl(name, "") == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component, "");
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        break;
    }
}
 
Example 18
Source File: XSDHandler.java    From openjdk-jdk8u-backup 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: IdentityConstraint.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * Get the type of the object, i.e ELEMENT_DECLARATION.
 */
public short getType() {
    return XSConstants.IDENTITY_CONSTRAINT;
}
 
Example 20
Source File: XSDHandler.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
private void addGlobalComponent(XSObject component, XSDDescription desc) {
    final String namespace = component.getNamespace();

    desc.setNamespace(namespace);
    final SchemaGrammar sg = getSchemaGrammar(desc);

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

    switch (componentType) {
    case XSConstants.TYPE_DEFINITION :
        if (!((XSTypeDefinition) component).getAnonymous()) {
            if (sg.getGlobalTypeDecl(name) == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalTypeDecl(name, "") == null) {
                sg.addGlobalTypeDecl((XSTypeDefinition) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_DECLARATION :
        if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) {
            if (sg.getGlobalAttributeDecl(name) == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalAttributeDecl(name, "") == null) {
                sg.addGlobalAttributeDecl((XSAttributeDecl) component, "");
            }
        }
        break;
    case XSConstants.ATTRIBUTE_GROUP :
        if (sg.getGlobalAttributeDecl(name) == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalAttributeDecl(name, "") == null) {
            sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, "");
        }
        break;
    case XSConstants.ELEMENT_DECLARATION :
        if (((XSElementDecl) component).getScope() == XSElementDecl.SCOPE_GLOBAL) {
            sg.addGlobalElementDeclAll((XSElementDecl) component);

            if (sg.getGlobalElementDecl(name) == null) {
                sg.addGlobalElementDecl((XSElementDecl) component);
            }
            // store the declaration in the extended map, using an empty location
            if (sg.getGlobalElementDecl(name, "") == null) {
                sg.addGlobalElementDecl((XSElementDecl) component, "");
            }
        }
        break;
    case XSConstants.MODEL_GROUP_DEFINITION :
        if (sg.getGlobalGroupDecl(name) == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalGroupDecl(name, "") == null) {
            sg.addGlobalGroupDecl((XSGroupDecl) component, "");
        }
        break;
    case XSConstants.NOTATION_DECLARATION :
        if (sg.getGlobalNotationDecl(name) == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component);
        }
        // store the declaration in the extended map, using an empty location
        if (sg.getGlobalNotationDecl(name, "") == null) {
            sg.addGlobalNotationDecl((XSNotationDecl) component, "");
        }
        break;
    case XSConstants.IDENTITY_CONSTRAINT :
    case XSConstants.ATTRIBUTE_USE :
    default :
        break;
    }
}