private void getGlobalElements() { globals = new ArrayList(); SchemaGrammar[] sgs = gb.getGrammars(); for (int i = 0; i < sgs.length; i++) { addGlobals(sgs[i]); } }
private void addGrammars(ASModelImpl model, XSGrammarBucket grammarBucket) { SchemaGrammar [] grammarList = grammarBucket.getGrammars(); for(int i=0; i<grammarList.length; i++) { ASModelImpl newModel = new ASModelImpl(); newModel.setGrammar(grammarList[i]); model.addASModel(newModel); } } // addGrammars
public Grammar[] retrieveInitialGrammarSet(String grammarType) { if (grammarType == XMLGrammarDescription.XML_SCHEMA) { if (fInitialGrammarSet == null) { if (fGrammarBucket == null) { fInitialGrammarSet = new Grammar [] {SchemaGrammar.Schema4Annotations.getSchema4Annotations(fSchemaVersion)}; } else { SchemaGrammar [] schemaGrammars = fGrammarBucket.getGrammars(); /** * If the grammar bucket already contains the schema for schemas * then we already have the definitions for the parts relevant * to annotations. */ for (int i = 0; i < schemaGrammars.length; ++i) { if (SchemaSymbols.URI_SCHEMAFORSCHEMA.equals(schemaGrammars[i].getTargetNamespace())) { fInitialGrammarSet = schemaGrammars; return fInitialGrammarSet; } } Grammar [] grammars = new Grammar[schemaGrammars.length + 1]; System.arraycopy(schemaGrammars, 0, grammars, 0, schemaGrammars.length); grammars[grammars.length - 1] = SchemaGrammar.Schema4Annotations.getSchema4Annotations(fSchemaVersion); fInitialGrammarSet = grammars; } } return fInitialGrammarSet; } return new Grammar[0]; }
/** * Namespace growth * * Go throuth the grammar bucket, and for each grammar in the bucket * check the import list. If there exists a grammar in import list * that has the same namespace as newGrammar, but a different instance, * then update the import list and replace the old grammar instance with * the new one */ private void updateImportListWith(SchemaGrammar newGrammar) { SchemaGrammar[] schemaGrammars = fGrammarBucket.getGrammars(); for (int i = 0; i < schemaGrammars.length; ++i) { SchemaGrammar sg = schemaGrammars[i]; if (sg != newGrammar) { Vector importedGrammars = sg.getImportedGrammars(); if (importedGrammars != null) { for (int j=0; j<importedGrammars.size(); j++) { SchemaGrammar isg = (SchemaGrammar) importedGrammars.elementAt(j); if (null2EmptyString(isg.getTargetNamespace()).equals(null2EmptyString(newGrammar.getTargetNamespace()))) { if (isg != newGrammar) { importedGrammars.set(j, newGrammar); } break; } } } } } }
private void assertionValidatorEndElementDelegate(QName element) { // initialize augmentation information to be passed to assertions processor Augmentations assertAugs = new AugmentationsImpl(); ElementPSVImpl assertElemPSVI = new ElementPSVImpl(); assertElemPSVI.fDeclaration = fCurrentElemDecl; assertElemPSVI.fTypeDecl = fCurrentType; assertElemPSVI.fNotation = fNotation; assertElemPSVI.fGrammars = fGrammarBucket.getGrammars(); assertAugs.putItem(Constants.ELEMENT_PSVI, assertElemPSVI); assertAugs.putItem(XSAssertConstants.isAssertProcNeededForUnionElem, Boolean.valueOf(fIsAssertProcessingNeededForSTUnionElem)); fAssertionValidator.handleEndElement(element, assertAugs); fFailedAssertions = assertElemPSVI.fFailedAssertions; if (fAugPSVI && fIsAssertProcessingNeededForSTUnionElem) { // update PSVI fValidatedInfo.memberType = assertElemPSVI.fValue.memberType; } fIsAssertProcessingNeededForSTUnionElem = true; } // assertionValidatorEndElementDelegate
fGrammarPool.cacheGrammars(XMLGrammarDescription.XML_SCHEMA, fGrammarBucket.getGrammars());
SchemaGrammar[] grammars = grammarBucket.getGrammars(); for (int i = grammars.length-1; i >= 0; i--) { SGHandler.addSubstitutionGroup(grammars[i].getSubstitutionGroups());
grammars = fGrammarBucket.getGrammars();