Java Code Examples for com.sun.org.apache.xerces.internal.xs.XSObject#getNamespace()

The following examples show how to use com.sun.org.apache.xerces.internal.xs.XSObject#getNamespace() . 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: XSNamedMapImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public synchronized Set<Map.Entry<QName,XSObject>> entrySet() {
    // Defer creation of the entry set until it is actually needed.
    if (fEntrySet == null) {
        final int length = getLength();
        final XSNamedMapEntry[] entries = new XSNamedMapEntry[length];
        for (int i = 0; i < length; ++i) {
            XSObject xso = item(i);
            entries[i] = new XSNamedMapEntry(new QName(xso.getNamespace(), xso.getName()), xso);
        }
        // Create a view of this immutable map.
        fEntrySet = new AbstractSet<Map.Entry<QName,XSObject>>() {
            public Iterator<Map.Entry<QName,XSObject>> iterator() {
                return new Iterator<Map.Entry<QName,XSObject>>() {
                    private int index = 0;
                    public boolean hasNext() {
                        return (index < length);
                    }
                    public Map.Entry<QName,XSObject> next() {
                        if (index < length) {
                            return entries[index++];
                        }
                        throw new NoSuchElementException();
                    }
                    public void remove() {
                        throw new UnsupportedOperationException();
                    }
                };
            }
            public int size() {
                return length;
            }
        };
    }
    return fEntrySet;
}
 
Example 2
Source File: XSNamedMapImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public synchronized Set entrySet() {
    // Defer creation of the entry set until it is actually needed.
    if (fEntrySet == null) {
        final int length = getLength();
        final XSNamedMapEntry[] entries = new XSNamedMapEntry[length];
        for (int i = 0; i < length; ++i) {
            XSObject xso = item(i);
            entries[i] = new XSNamedMapEntry(new QName(xso.getNamespace(), xso.getName()), xso);
        }
        // Create a view of this immutable map.
        fEntrySet = new AbstractSet() {
            public Iterator iterator() {
                return new Iterator() {
                    private int index = 0;
                    public boolean hasNext() {
                        return (index < length);
                    }
                    public Object next() {
                        if (index < length) {
                            return entries[index++];
                        }
                        throw new NoSuchElementException();
                    }
                    public void remove() {
                        throw new UnsupportedOperationException();
                    }
                };
            }
            public int size() {
                return length;
            }
        };
    }
    return fEntrySet;
}
 
Example 3
Source File: XSNamedMapImpl.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public synchronized Set entrySet() {
    // Defer creation of the entry set until it is actually needed.
    if (fEntrySet == null) {
        final int length = getLength();
        final XSNamedMapEntry[] entries = new XSNamedMapEntry[length];
        for (int i = 0; i < length; ++i) {
            XSObject xso = item(i);
            entries[i] = new XSNamedMapEntry(new QName(xso.getNamespace(), xso.getName()), xso);
        }
        // Create a view of this immutable map.
        fEntrySet = new AbstractSet() {
            public Iterator iterator() {
                return new Iterator() {
                    private int index = 0;
                    public boolean hasNext() {
                        return (index < length);
                    }
                    public Object next() {
                        if (index < length) {
                            return entries[index++];
                        }
                        throw new NoSuchElementException();
                    }
                    public void remove() {
                        throw new UnsupportedOperationException();
                    }
                };
            }
            public int size() {
                return length;
            }
        };
    }
    return fEntrySet;
}
 
Example 4
Source File: XSNamedMapImpl.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public synchronized Set entrySet() {
    // Defer creation of the entry set until it is actually needed.
    if (fEntrySet == null) {
        final int length = getLength();
        final XSNamedMapEntry[] entries = new XSNamedMapEntry[length];
        for (int i = 0; i < length; ++i) {
            XSObject xso = item(i);
            entries[i] = new XSNamedMapEntry(new QName(xso.getNamespace(), xso.getName()), xso);
        }
        // Create a view of this immutable map.
        fEntrySet = new AbstractSet() {
            public Iterator iterator() {
                return new Iterator() {
                    private int index = 0;
                    public boolean hasNext() {
                        return (index < length);
                    }
                    public Object next() {
                        if (index < length) {
                            return entries[index++];
                        }
                        throw new NoSuchElementException();
                    }
                    public void remove() {
                        throw new UnsupportedOperationException();
                    }
                };
            }
            public int size() {
                return length;
            }
        };
    }
    return fEntrySet;
}
 
Example 5
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;
    }
}
 
Example 6
Source File: XSDHandler.java    From TencentKona-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 7
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 8
Source File: XSDHandler.java    From JDKSourceCode1.8 with MIT License 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 openjdk-jdk8u 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 10
Source File: XSDHandler.java    From openjdk-jdk8u-backup 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 11
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 12
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 13
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 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;
    }
}