Java Code Examples for com.sun.org.apache.xerces.internal.xs.XSConstants#ATTRIBUTE_DECLARATION
The following examples show how to use
com.sun.org.apache.xerces.internal.xs.XSConstants#ATTRIBUTE_DECLARATION .
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 JDKSourceCode1.8 with MIT License | 6 votes |
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 TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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 3
Source File: XSAttributeDecl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Get the type of the object, i.e ELEMENT_DECLARATION. */ public short getType() { return XSConstants.ATTRIBUTE_DECLARATION; }
Example 4
Source File: XSDHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
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 5
Source File: XSDHandler.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
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 6
Source File: XSModelImpl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Convenience method. Returns a list of top-level component declarations * that are defined within the specified namespace, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. * @param namespace The namespace to which the declaration belongs or * <code>null</code> (for components with no target namespace). * @return A list of top-level definitions of the specified type in * <code>objectType</code> and defined in the specified * <code>namespace</code> or an empty <code>XSNamedMap</code>. */ public synchronized XSNamedMap getComponentsByNamespace(short objectType, String namespace) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } // try to find the grammar int i = 0; if (namespace != null) { for (; i < fGrammarCount; ++i) { if (namespace.equals(fNamespaces[i])) { break; } } } else { for (; i < fGrammarCount; ++i) { if (fNamespaces[i] == null) { break; } } } if (i == fGrammarCount) { return XSNamedMapImpl.EMPTY_MAP; } // get the hashtable for this type of components if (fNSComponents[i][objectType] == null) { SymbolHash table = null; switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: table = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: table = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: table = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: table = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: table = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: table = fGrammarList[i].fGlobalNotationDecls; break; } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fNSComponents[i][objectType] = new XSNamedMap4Types(namespace, table, objectType); } else { fNSComponents[i][objectType] = new XSNamedMapImpl(namespace, table); } } return fNSComponents[i][objectType]; }
Example 7
Source File: XSDHandler.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
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: XSModelImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Returns a list of top-level components, i.e. element declarations, * attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. Note that * <code>XSTypeDefinition.SIMPLE_TYPE</code> and * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the * <code>objectType</code> to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definitions of the specified type in * <code>objectType</code> or an empty <code>XSNamedMap</code> if no * such definitions exist. */ public synchronized XSNamedMap getComponents(short objectType) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } SymbolHash[] tables = new SymbolHash[fGrammarCount]; // get all hashtables from all namespaces for this type of components if (fGlobalComponents[objectType] == null) { for (int i = 0; i < fGrammarCount; i++) { switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: tables[i] = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: tables[i] = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: tables[i] = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: tables[i] = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: tables[i] = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: tables[i] = fGrammarList[i].fGlobalNotationDecls; break; case XSConstants.IDENTITY_CONSTRAINT: tables[i] = fGrammarList[i].fGlobalIDConstraintDecls; break; } } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType); } else { fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount); } } return fGlobalComponents[objectType]; }
Example 9
Source File: SchemaGrammar.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * [schema components]: a list of top-level components, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. Note that * <code>XSTypeDefinition.SIMPLE_TYPE</code> and * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the * <code>objectType</code> to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definition of the specified type in * <code>objectType</code> or an empty <code>XSNamedMap</code> if no * such definitions exist. */ public synchronized XSNamedMap getComponents(short objectType) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } if (fComponents == null) fComponents = new XSNamedMap[MAX_COMP_IDX+1]; // get the hashtable for this type of components if (fComponents[objectType] == null) { SymbolHash table = null; switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: table = fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: table = fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: table = fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: table = fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: table = fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: table = fGlobalNotationDecls; break; } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fComponents[objectType] = new XSNamedMap4Types(fTargetNamespace, table, objectType); } else { fComponents[objectType] = new XSNamedMapImpl(fTargetNamespace, table); } } return fComponents[objectType]; }
Example 10
Source File: XSAttributeDecl.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Get the type of the object, i.e ELEMENT_DECLARATION. */ public short getType() { return XSConstants.ATTRIBUTE_DECLARATION; }
Example 11
Source File: XSDHandler.java From JDKSourceCode1.8 with MIT License | 4 votes |
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 12
Source File: XSAttributeDecl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Get the type of the object, i.e ELEMENT_DECLARATION. */ public short getType() { return XSConstants.ATTRIBUTE_DECLARATION; }
Example 13
Source File: SchemaGrammar.java From JDKSourceCode1.8 with MIT License | 4 votes |
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; } Object[] entries = table.getEntries(); fComponentsExt[objectType] = new ObjectListImpl(entries, entries.length); } return fComponentsExt[objectType]; }
Example 14
Source File: XSModelImpl.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Returns a list of top-level components, i.e. element declarations, * attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. Note that * <code>XSTypeDefinition.SIMPLE_TYPE</code> and * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the * <code>objectType</code> to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definitions of the specified type in * <code>objectType</code> or an empty <code>XSNamedMap</code> if no * such definitions exist. */ public synchronized XSNamedMap getComponents(short objectType) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } SymbolHash[] tables = new SymbolHash[fGrammarCount]; // get all hashtables from all namespaces for this type of components if (fGlobalComponents[objectType] == null) { for (int i = 0; i < fGrammarCount; i++) { switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: tables[i] = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: tables[i] = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: tables[i] = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: tables[i] = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: tables[i] = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: tables[i] = fGrammarList[i].fGlobalNotationDecls; break; } } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType); } else { fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount); } } return fGlobalComponents[objectType]; }
Example 15
Source File: XSModelImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Returns a list of top-level components, i.e. element declarations, * attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. Note that * <code>XSTypeDefinition.SIMPLE_TYPE</code> and * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the * <code>objectType</code> to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definitions of the specified type in * <code>objectType</code> or an empty <code>XSNamedMap</code> if no * such definitions exist. */ public synchronized XSNamedMap getComponents(short objectType) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } SymbolHash[] tables = new SymbolHash[fGrammarCount]; // get all hashtables from all namespaces for this type of components if (fGlobalComponents[objectType] == null) { for (int i = 0; i < fGrammarCount; i++) { switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: tables[i] = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: tables[i] = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: tables[i] = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: tables[i] = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: tables[i] = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: tables[i] = fGrammarList[i].fGlobalNotationDecls; break; } } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType); } else { fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount); } } return fGlobalComponents[objectType]; }
Example 16
Source File: SchemaGrammar.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
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 17
Source File: XSAttributeDecl.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Get the type of the object, i.e ELEMENT_DECLARATION. */ public short getType() { return XSConstants.ATTRIBUTE_DECLARATION; }
Example 18
Source File: SchemaGrammar.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * [schema components]: a list of top-level components, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. Note that * <code>XSTypeDefinition.SIMPLE_TYPE</code> and * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the * <code>objectType</code> to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definition of the specified type in * <code>objectType</code> or an empty <code>XSNamedMap</code> if no * such definitions exist. */ public synchronized XSNamedMap getComponents(short objectType) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } if (fComponents == null) fComponents = new XSNamedMap[MAX_COMP_IDX+1]; // get the hashtable for this type of components if (fComponents[objectType] == null) { SymbolHash table = null; switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: table = fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: table = fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: table = fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: table = fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: table = fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: table = fGlobalNotationDecls; break; } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fComponents[objectType] = new XSNamedMap4Types(fTargetNamespace, table, objectType); } else { fComponents[objectType] = new XSNamedMapImpl(fTargetNamespace, table); } } return fComponents[objectType]; }
Example 19
Source File: XSModelImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Returns a list of top-level components, i.e. element declarations, * attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. Note that * <code>XSTypeDefinition.SIMPLE_TYPE</code> and * <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the * <code>objectType</code> to retrieve only complex types or simple * types, instead of all types. * @return A list of top-level definitions of the specified type in * <code>objectType</code> or an empty <code>XSNamedMap</code> if no * such definitions exist. */ public synchronized XSNamedMap getComponents(short objectType) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } SymbolHash[] tables = new SymbolHash[fGrammarCount]; // get all hashtables from all namespaces for this type of components if (fGlobalComponents[objectType] == null) { for (int i = 0; i < fGrammarCount; i++) { switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: tables[i] = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: tables[i] = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: tables[i] = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: tables[i] = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: tables[i] = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: tables[i] = fGrammarList[i].fGlobalNotationDecls; break; } } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType); } else { fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount); } } return fGlobalComponents[objectType]; }
Example 20
Source File: XSModelImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Convenience method. Returns a list of top-level component declarations * that are defined within the specified namespace, i.e. element * declarations, attribute declarations, etc. * @param objectType The type of the declaration, i.e. * <code>ELEMENT_DECLARATION</code>. * @param namespace The namespace to which the declaration belongs or * <code>null</code> (for components with no target namespace). * @return A list of top-level definitions of the specified type in * <code>objectType</code> and defined in the specified * <code>namespace</code> or an empty <code>XSNamedMap</code>. */ public synchronized XSNamedMap getComponentsByNamespace(short objectType, String namespace) { if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) { return XSNamedMapImpl.EMPTY_MAP; } // try to find the grammar int i = 0; if (namespace != null) { for (; i < fGrammarCount; ++i) { if (namespace.equals(fNamespaces[i])) { break; } } } else { for (; i < fGrammarCount; ++i) { if (fNamespaces[i] == null) { break; } } } if (i == fGrammarCount) { return XSNamedMapImpl.EMPTY_MAP; } // get the hashtable for this type of components if (fNSComponents[i][objectType] == null) { SymbolHash table = null; switch (objectType) { case XSConstants.TYPE_DEFINITION: case XSTypeDefinition.COMPLEX_TYPE: case XSTypeDefinition.SIMPLE_TYPE: table = fGrammarList[i].fGlobalTypeDecls; break; case XSConstants.ATTRIBUTE_DECLARATION: table = fGrammarList[i].fGlobalAttrDecls; break; case XSConstants.ELEMENT_DECLARATION: table = fGrammarList[i].fGlobalElemDecls; break; case XSConstants.ATTRIBUTE_GROUP: table = fGrammarList[i].fGlobalAttrGrpDecls; break; case XSConstants.MODEL_GROUP_DEFINITION: table = fGrammarList[i].fGlobalGroupDecls; break; case XSConstants.NOTATION_DECLARATION: table = fGrammarList[i].fGlobalNotationDecls; break; } // for complex/simple types, create a special implementation, // which take specific types out of the hash table if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) { fNSComponents[i][objectType] = new XSNamedMap4Types(namespace, table, objectType); } else { fNSComponents[i][objectType] = new XSNamedMapImpl(namespace, table); } } return fNSComponents[i][objectType]; }