Java Code Examples for com.sun.org.apache.xerces.internal.util.SymbolHash#put()
The following examples show how to use
com.sun.org.apache.xerces.internal.util.SymbolHash#put() .
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: XSModelImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 2
Source File: XSModelImpl.java From JDKSourceCode1.8 with MIT License | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 3
Source File: XSModelImpl.java From Bytecoder with Apache License 2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 4
Source File: XSConstraints.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
public static void findElemInTable(XSComplexTypeDecl type, XSElementDecl elem, SymbolHash elemDeclHash) throws XMLSchemaException { // How can we avoid this concat? LM. String name = elem.fName + "," + elem.fTargetNamespace; XSElementDecl existingElem = null; if ((existingElem = (XSElementDecl)(elemDeclHash.get(name))) == null) { // just add it in elemDeclHash.put(name, elem); } else { // If this is the same check element, we're O.K. if (elem == existingElem) return; if (elem.fType != existingElem.fType) { // Types are not the same throw new XMLSchemaException("cos-element-consistent", new Object[] {type.fName, elem.fName}); } } }
Example 5
Source File: XSModelImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups_Org() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 6
Source File: XSModelImpl.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 7
Source File: XSModelImpl.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 8
Source File: XSModelImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 9
Source File: XSModelImpl.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 10
Source File: XSModelImpl.java From hottub with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups_Org() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 11
Source File: XSConstraints.java From Bytecoder with Apache License 2.0 | 6 votes |
public static void findElemInTable(XSComplexTypeDecl type, XSElementDecl elem, SymbolHash elemDeclHash) throws XMLSchemaException { // How can we avoid this concat? LM. String name = elem.fName + "," + elem.fTargetNamespace; XSElementDecl existingElem = null; if ((existingElem = (XSElementDecl)(elemDeclHash.get(name))) == null) { // just add it in elemDeclHash.put(name, elem); } else { // If this is the same check element, we're O.K. if (elem == existingElem) return; if (elem.fType != existingElem.fType) { // Types are not the same throw new XMLSchemaException("cos-element-consistent", new Object[] {type.fName, elem.fName}); } } }
Example 12
Source File: XSModelImpl.java From Bytecoder with Apache License 2.0 | 6 votes |
private SymbolHash buildSubGroups_Org() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 13
Source File: XSConstraints.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
public static void findElemInTable(XSComplexTypeDecl type, XSElementDecl elem, SymbolHash elemDeclHash) throws XMLSchemaException { // How can we avoid this concat? LM. String name = elem.fName + "," + elem.fTargetNamespace; XSElementDecl existingElem = null; if ((existingElem = (XSElementDecl)(elemDeclHash.get(name))) == null) { // just add it in elemDeclHash.put(name, elem); } else { // If this is the same check element, we're O.K. if (elem == existingElem) return; if (elem.fType != existingElem.fType) { // Types are not the same throw new XMLSchemaException("cos-element-consistent", new Object[] {type.fName, elem.fName}); } } }
Example 14
Source File: XSModelImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private SymbolHash buildSubGroups() { SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null); for (int i = 0 ; i < fGrammarCount; i++) { sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups()); } final XSObjectListImpl elements = getGlobalElements(); final int len = elements.getLength(); final SymbolHash subGroupMap = new SymbolHash(len*2); XSElementDecl head; XSElementDeclaration[] subGroup; for (int i = 0; i < len; i++) { head = (XSElementDecl)elements.item(i); subGroup = sgHandler.getSubstitutionGroup(head); subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST); } return subGroupMap; }
Example 15
Source File: XSModelImpl.java From Bytecoder with Apache License 2.0 | 4 votes |
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) { // copy namespaces/grammars from the array to our arrays int len = grammars.length; final int initialSize = Math.max(len+1, 5); String[] namespaces = new String[initialSize]; SchemaGrammar[] grammarList = new SchemaGrammar[initialSize]; boolean hasS4S = false; for (int i = 0; i < len; i++) { final SchemaGrammar sg = grammars[i]; final String tns = sg.getTargetNamespace(); namespaces[i] = tns; grammarList[i] = sg; if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) { hasS4S = true; } } // If a schema for the schema namespace isn't included, include it here. if (!hasS4S) { namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA; grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion); } SchemaGrammar sg1, sg2; List<SchemaGrammar> gs; int i, j, k; // and recursively get all imported grammars, add them to our arrays for (i = 0; i < len; i++) { // get the grammar sg1 = grammarList[i]; gs = sg1.getImportedGrammars(); // for each imported grammar for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) { sg2 = gs.get(j); // check whether this grammar is already in the list for (k = 0; k < len; k++) { if (sg2 == grammarList[k]) { break; } } // if it's not, add it to the list if (k == len) { // ensure the capacity of the arrays if (len == grammarList.length) { String[] newSA = new String[len*2]; System.arraycopy(namespaces, 0, newSA, 0, len); namespaces = newSA; SchemaGrammar[] newGA = new SchemaGrammar[len*2]; System.arraycopy(grammarList, 0, newGA, 0, len); grammarList = newGA; } namespaces[len] = sg2.getTargetNamespace(); grammarList[len] = sg2; len++; } } } fNamespaces = namespaces; fGrammarList = grammarList; boolean hasIDC = false; // establish the mapping from namespace to grammars fGrammarMap = new SymbolHash(len*2); for (i = 0; i < len; i++) { fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]); // update the idc field if (fGrammarList[i].hasIDConstraints()) { hasIDC = true; } } fHasIDC = hasIDC; fGrammarCount = len; fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1]; fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1]; fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount); // build substitution groups fSubGroupMap = buildSubGroups(); }
Example 16
Source File: XSModelImpl.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) { // copy namespaces/grammars from the array to our arrays int len = grammars.length; final int initialSize = Math.max(len+1, 5); String[] namespaces = new String[initialSize]; SchemaGrammar[] grammarList = new SchemaGrammar[initialSize]; boolean hasS4S = false; for (int i = 0; i < len; i++) { final SchemaGrammar sg = grammars[i]; final String tns = sg.getTargetNamespace(); namespaces[i] = tns; grammarList[i] = sg; if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) { hasS4S = true; } } // If a schema for the schema namespace isn't included, include it here. if (!hasS4S) { namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA; grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion); } SchemaGrammar sg1, sg2; Vector gs; int i, j, k; // and recursively get all imported grammars, add them to our arrays for (i = 0; i < len; i++) { // get the grammar sg1 = grammarList[i]; gs = sg1.getImportedGrammars(); // for each imported grammar for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) { sg2 = (SchemaGrammar)gs.elementAt(j); // check whether this grammar is already in the list for (k = 0; k < len; k++) { if (sg2 == grammarList[k]) { break; } } // if it's not, add it to the list if (k == len) { // ensure the capacity of the arrays if (len == grammarList.length) { String[] newSA = new String[len*2]; System.arraycopy(namespaces, 0, newSA, 0, len); namespaces = newSA; SchemaGrammar[] newGA = new SchemaGrammar[len*2]; System.arraycopy(grammarList, 0, newGA, 0, len); grammarList = newGA; } namespaces[len] = sg2.getTargetNamespace(); grammarList[len] = sg2; len++; } } } fNamespaces = namespaces; fGrammarList = grammarList; boolean hasIDC = false; // establish the mapping from namespace to grammars fGrammarMap = new SymbolHash(len*2); for (i = 0; i < len; i++) { fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]); // update the idc field if (fGrammarList[i].hasIDConstraints()) { hasIDC = true; } } fHasIDC = hasIDC; fGrammarCount = len; fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1]; fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1]; fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount); // build substitution groups fSubGroupMap = buildSubGroups(); }
Example 17
Source File: XSModelImpl.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) { // copy namespaces/grammars from the array to our arrays int len = grammars.length; final int initialSize = Math.max(len+1, 5); String[] namespaces = new String[initialSize]; SchemaGrammar[] grammarList = new SchemaGrammar[initialSize]; boolean hasS4S = false; for (int i = 0; i < len; i++) { final SchemaGrammar sg = grammars[i]; final String tns = sg.getTargetNamespace(); namespaces[i] = tns; grammarList[i] = sg; if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) { hasS4S = true; } } // If a schema for the schema namespace isn't included, include it here. if (!hasS4S) { namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA; grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion); } SchemaGrammar sg1, sg2; Vector gs; int i, j, k; // and recursively get all imported grammars, add them to our arrays for (i = 0; i < len; i++) { // get the grammar sg1 = grammarList[i]; gs = sg1.getImportedGrammars(); // for each imported grammar for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) { sg2 = (SchemaGrammar)gs.elementAt(j); // check whether this grammar is already in the list for (k = 0; k < len; k++) { if (sg2 == grammarList[k]) { break; } } // if it's not, add it to the list if (k == len) { // ensure the capacity of the arrays if (len == grammarList.length) { String[] newSA = new String[len*2]; System.arraycopy(namespaces, 0, newSA, 0, len); namespaces = newSA; SchemaGrammar[] newGA = new SchemaGrammar[len*2]; System.arraycopy(grammarList, 0, newGA, 0, len); grammarList = newGA; } namespaces[len] = sg2.getTargetNamespace(); grammarList[len] = sg2; len++; } } } fNamespaces = namespaces; fGrammarList = grammarList; boolean hasIDC = false; // establish the mapping from namespace to grammars fGrammarMap = new SymbolHash(len*2); for (i = 0; i < len; i++) { fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]); // update the idc field if (fGrammarList[i].hasIDConstraints()) { hasIDC = true; } } fHasIDC = hasIDC; fGrammarCount = len; fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1]; fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1]; fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount); // build substitution groups fSubGroupMap = buildSubGroups(); }
Example 18
Source File: XSModelImpl.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) { // copy namespaces/grammars from the array to our arrays int len = grammars.length; final int initialSize = Math.max(len+1, 5); String[] namespaces = new String[initialSize]; SchemaGrammar[] grammarList = new SchemaGrammar[initialSize]; boolean hasS4S = false; for (int i = 0; i < len; i++) { final SchemaGrammar sg = grammars[i]; final String tns = sg.getTargetNamespace(); namespaces[i] = tns; grammarList[i] = sg; if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) { hasS4S = true; } } // If a schema for the schema namespace isn't included, include it here. if (!hasS4S) { namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA; grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion); } SchemaGrammar sg1, sg2; Vector gs; int i, j, k; // and recursively get all imported grammars, add them to our arrays for (i = 0; i < len; i++) { // get the grammar sg1 = grammarList[i]; gs = sg1.getImportedGrammars(); // for each imported grammar for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) { sg2 = (SchemaGrammar)gs.elementAt(j); // check whether this grammar is already in the list for (k = 0; k < len; k++) { if (sg2 == grammarList[k]) { break; } } // if it's not, add it to the list if (k == len) { // ensure the capacity of the arrays if (len == grammarList.length) { String[] newSA = new String[len*2]; System.arraycopy(namespaces, 0, newSA, 0, len); namespaces = newSA; SchemaGrammar[] newGA = new SchemaGrammar[len*2]; System.arraycopy(grammarList, 0, newGA, 0, len); grammarList = newGA; } namespaces[len] = sg2.getTargetNamespace(); grammarList[len] = sg2; len++; } } } fNamespaces = namespaces; fGrammarList = grammarList; boolean hasIDC = false; // establish the mapping from namespace to grammars fGrammarMap = new SymbolHash(len*2); for (i = 0; i < len; i++) { fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]); // update the idc field if (fGrammarList[i].hasIDConstraints()) { hasIDC = true; } } fHasIDC = hasIDC; fGrammarCount = len; fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1]; fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1]; fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount); // build substitution groups fSubGroupMap = buildSubGroups(); }
Example 19
Source File: XSModelImpl.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) { // copy namespaces/grammars from the array to our arrays int len = grammars.length; final int initialSize = Math.max(len+1, 5); String[] namespaces = new String[initialSize]; SchemaGrammar[] grammarList = new SchemaGrammar[initialSize]; boolean hasS4S = false; for (int i = 0; i < len; i++) { final SchemaGrammar sg = grammars[i]; final String tns = sg.getTargetNamespace(); namespaces[i] = tns; grammarList[i] = sg; if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) { hasS4S = true; } } // If a schema for the schema namespace isn't included, include it here. if (!hasS4S) { namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA; grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion); } SchemaGrammar sg1, sg2; Vector gs; int i, j, k; // and recursively get all imported grammars, add them to our arrays for (i = 0; i < len; i++) { // get the grammar sg1 = grammarList[i]; gs = sg1.getImportedGrammars(); // for each imported grammar for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) { sg2 = (SchemaGrammar)gs.elementAt(j); // check whether this grammar is already in the list for (k = 0; k < len; k++) { if (sg2 == grammarList[k]) { break; } } // if it's not, add it to the list if (k == len) { // ensure the capacity of the arrays if (len == grammarList.length) { String[] newSA = new String[len*2]; System.arraycopy(namespaces, 0, newSA, 0, len); namespaces = newSA; SchemaGrammar[] newGA = new SchemaGrammar[len*2]; System.arraycopy(grammarList, 0, newGA, 0, len); grammarList = newGA; } namespaces[len] = sg2.getTargetNamespace(); grammarList[len] = sg2; len++; } } } fNamespaces = namespaces; fGrammarList = grammarList; boolean hasIDC = false; // establish the mapping from namespace to grammars fGrammarMap = new SymbolHash(len*2); for (i = 0; i < len; i++) { fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]); // update the idc field if (fGrammarList[i].hasIDConstraints()) { hasIDC = true; } } fHasIDC = hasIDC; fGrammarCount = len; fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1]; fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1]; fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount); // build substitution groups fSubGroupMap = buildSubGroups(); }
Example 20
Source File: XSModelImpl.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
public XSModelImpl(SchemaGrammar[] grammars, short s4sVersion) { // copy namespaces/grammars from the array to our arrays int len = grammars.length; final int initialSize = Math.max(len+1, 5); String[] namespaces = new String[initialSize]; SchemaGrammar[] grammarList = new SchemaGrammar[initialSize]; boolean hasS4S = false; for (int i = 0; i < len; i++) { final SchemaGrammar sg = grammars[i]; final String tns = sg.getTargetNamespace(); namespaces[i] = tns; grammarList[i] = sg; if (tns == SchemaSymbols.URI_SCHEMAFORSCHEMA) { hasS4S = true; } } // If a schema for the schema namespace isn't included, include it here. if (!hasS4S) { namespaces[len] = SchemaSymbols.URI_SCHEMAFORSCHEMA; grammarList[len++] = SchemaGrammar.getS4SGrammar(s4sVersion); } SchemaGrammar sg1, sg2; Vector gs; int i, j, k; // and recursively get all imported grammars, add them to our arrays for (i = 0; i < len; i++) { // get the grammar sg1 = grammarList[i]; gs = sg1.getImportedGrammars(); // for each imported grammar for (j = gs == null ? -1 : gs.size() - 1; j >= 0; j--) { sg2 = (SchemaGrammar)gs.elementAt(j); // check whether this grammar is already in the list for (k = 0; k < len; k++) { if (sg2 == grammarList[k]) { break; } } // if it's not, add it to the list if (k == len) { // ensure the capacity of the arrays if (len == grammarList.length) { String[] newSA = new String[len*2]; System.arraycopy(namespaces, 0, newSA, 0, len); namespaces = newSA; SchemaGrammar[] newGA = new SchemaGrammar[len*2]; System.arraycopy(grammarList, 0, newGA, 0, len); grammarList = newGA; } namespaces[len] = sg2.getTargetNamespace(); grammarList[len] = sg2; len++; } } } fNamespaces = namespaces; fGrammarList = grammarList; boolean hasIDC = false; // establish the mapping from namespace to grammars fGrammarMap = new SymbolHash(len*2); for (i = 0; i < len; i++) { fGrammarMap.put(null2EmptyString(fNamespaces[i]), fGrammarList[i]); // update the idc field if (fGrammarList[i].hasIDConstraints()) { hasIDC = true; } } fHasIDC = hasIDC; fGrammarCount = len; fGlobalComponents = new XSNamedMap[MAX_COMP_IDX+1]; fNSComponents = new XSNamedMap[len][MAX_COMP_IDX+1]; fNamespacesList = new StringListImpl(fNamespaces, fGrammarCount); // build substitution groups fSubGroupMap = buildSubGroups(); }