private SchemaGrammar getSchemaGrammar(XSDDescription desc) { SchemaGrammar sg = findGrammar(desc, fNamespaceGrowth); if (sg == null) { sg = new SchemaGrammar(desc.getNamespace(), desc.makeClone(), fSymbolTable); fGrammarBucket.putGrammar(sg); } else if (sg.isImmutable()){ sg = createGrammarFrom(sg); } return sg; }
XSNamedMap map = newGrammar.getComponents(XSConstants.ELEMENT_DECLARATION); int length = map.getLength(); for (int i = 0; i < length; ++i) { XSElementDecl decl = (XSElementDecl) map.item(i); if (cachedGrammar.getGlobalElementDecl(decl.getName()) == null) { cachedGrammar.addGlobalElementDecl(decl); map = newGrammar.getComponents(XSConstants.ATTRIBUTE_DECLARATION); length = map.getLength(); for (int i = 0; i < length; ++i) { XSAttributeDecl decl = (XSAttributeDecl) map.item(i); if (cachedGrammar.getGlobalAttributeDecl(decl.getName()) == null) { cachedGrammar.addGlobalAttributeDecl(decl); map = newGrammar.getComponents(XSConstants.TYPE_DEFINITION); length = map.getLength(); for (int i = 0; i < length; ++i) { XSTypeDefinition decl = (XSTypeDefinition) map.item(i); if (cachedGrammar.getGlobalTypeDecl(decl.getName()) == null) { cachedGrammar.addGlobalTypeDecl(decl); map = newGrammar.getComponents(XSConstants.ATTRIBUTE_GROUP); length = map.getLength(); for (int i = 0; i < length; ++i) { XSAttributeGroupDecl decl = (XSAttributeGroupDecl) map.item(i); if (cachedGrammar.getGlobalAttributeGroupDecl(decl.getName()) == null) { cachedGrammar.addGlobalAttributeGroupDecl(decl); map = newGrammar.getComponents(XSConstants.MODEL_GROUP);
private void addNewGrammarLocations(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) { final StringList locations = srcGrammar.getDocumentLocations(); final int locSize = locations.size(); final StringList locations2 = dstGrammar.getDocumentLocations(); for (int i=0; i<locSize; i++) { String loc = locations.item(i); if (!locations2.contains(loc)) { dstGrammar.addDocument(null, loc); } } }
case XSConstants.TYPE_DEFINITION : if (!((XSTypeDefinition) component).getAnonymous()) { if (sg.getGlobalTypeDecl(name) == null) { sg.addGlobalTypeDecl((XSTypeDefinition) component); if (sg.getGlobalTypeDecl(name, "") == null) { sg.addGlobalTypeDecl((XSTypeDefinition) component, ""); case XSConstants.ATTRIBUTE_DECLARATION : if (((XSAttributeDecl) component).getScope() == XSAttributeDecl.SCOPE_GLOBAL) { if (sg.getGlobalAttributeDecl(name) == null) { sg.addGlobalAttributeDecl((XSAttributeDecl) component); if (sg.getGlobalAttributeDecl(name, "") == null) { sg.addGlobalAttributeDecl((XSAttributeDecl) component, ""); if (sg.getGlobalAttributeDecl(name) == null) { sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component); if (sg.getGlobalAttributeDecl(name, "") == null) { sg.addGlobalAttributeGroupDecl((XSAttributeGroupDecl) component, ""); sg.addGlobalElementDeclAll((XSElementDecl) component); if (sg.getGlobalElementDecl(name) == null) { sg.addGlobalElementDecl((XSElementDecl) component); if (sg.getGlobalElementDecl(name, "") == null) { sg.addGlobalElementDecl((XSElementDecl) component, "");
private void addGlobalElementDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) { XSNamedMap components = srcGrammar.getComponents(XSConstants.ELEMENT_DECLARATION); int len = components.getLength(); XSElementDecl srcDecl, dstDecl; dstDecl = dstGrammar.getGlobalElementDecl(srcDecl.getName()); if (dstDecl == null) { dstGrammar.addGlobalElementDecl(srcDecl); ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ELEMENT_DECLARATION); len = componentsExt.getLength(); dstDecl = dstGrammar.getGlobalElementDecl(name, location); if ( dstDecl == null) { dstGrammar.addGlobalElementDecl(srcDecl, location);
if (sg2.isImmutable()) { sg = new SchemaGrammar(sg2); fGrammarBucket.putGrammar(sg); sg = findGrammar(desc, false); if(sg == null) { sg = new SchemaGrammar(currSchemaInfo.fTargetNamespace, desc.makeClone(), fSymbolTable, fSchemaVersion); fGrammarBucket.putGrammar(sg); sg = new SchemaGrammar(currSchemaInfo.fTargetNamespace, desc.makeClone(), fSymbolTable, fSchemaVersion); fGrammarBucket.putGrammar(sg); sg.addDocument(null, (String)fDoc2SystemId.get(currSchemaInfo.fSchemaElement)); sg.addAnnotation( fElementTraverser.traverseAnnotationDecl(importChild, importAttrs, true, currSchemaInfo)); } else { String text = DOMUtil.getSyntheticAnnotation(child); if (text != null) { sg.addAnnotation(fElementTraverser.traverseSyntheticAnnotation(child, text, importAttrs, true, currSchemaInfo)); if (fNamespaceGrowth) { try { if (isg.getDocumentLocations().contains(XMLEntityManager.expandSystemId(schemaHint, fSchemaGrammarDescription.getBaseSystemId(), false))) { continue; sg.addAnnotation( fElementTraverser.traverseAnnotationDecl(includeChild, includeAttrs, true, currSchemaInfo));
private void addGlobalAttributeDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) { XSNamedMap components = srcGrammar.getComponents(XSConstants.ATTRIBUTE_DECLARATION); int len = components.getLength(); XSAttributeDecl srcDecl, dstDecl; dstDecl = dstGrammar.getGlobalAttributeDecl(srcDecl.getName()); if (dstDecl == null) { dstGrammar.addGlobalAttributeDecl(srcDecl); ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ATTRIBUTE_DECLARATION); len = componentsExt.getLength(); dstDecl = dstGrammar.getGlobalAttributeDecl(name, location); if (dstDecl == null) { dstGrammar.addGlobalAttributeDecl(srcDecl, location);
private void addGlobalGroupDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) { XSNamedMap components = srcGrammar.getComponents(XSConstants.MODEL_GROUP_DEFINITION); int len = components.getLength(); XSGroupDecl srcDecl, dstDecl; dstDecl = dstGrammar.getGlobalGroupDecl(srcDecl.getName()); if (dstDecl == null) { dstGrammar.addGlobalGroupDecl(srcDecl); ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.MODEL_GROUP_DEFINITION); len = componentsExt.getLength(); dstDecl = dstGrammar.getGlobalGroupDecl(name, location); if (dstDecl == null) { dstGrammar.addGlobalGroupDecl(srcDecl, location);
private void addGlobalAttributeGroupDecls(SchemaGrammar srcGrammar, SchemaGrammar dstGrammar) { XSNamedMap components = srcGrammar.getComponents(XSConstants.ATTRIBUTE_GROUP); int len = components.getLength(); XSAttributeGroupDecl srcDecl, dstDecl; dstDecl = dstGrammar.getGlobalAttributeGroupDecl(srcDecl.getName()); if (dstDecl == null) { dstGrammar.addGlobalAttributeGroupDecl(srcDecl); ObjectList componentsExt = srcGrammar.getComponentsExt(XSConstants.ATTRIBUTE_GROUP); len = componentsExt.getLength(); dstDecl = dstGrammar.getGlobalAttributeGroupDecl(name, location); if (dstDecl == null) { dstGrammar.addGlobalAttributeGroupDecl(srcDecl, location);
if (grammar.getGlobalGroupDecl(group.fName) == null || DOMUtil.getLocalName(DOMUtil.getParent(elmNode)).equals(SchemaSymbols.ELT_REDEFINE)) { grammar.addGlobalGroupDecl(group); final XSGroupDecl group2 = grammar.getGlobalGroupDecl(group.fName, loc); if (group2 == null) { grammar.addGlobalGroupDecl(group, loc); if (redefinedGrp != null) { grammar.addRedefinedGroupDecl(group, (XSGroupDecl)redefinedGrp, fSchemaHandler.element2Locator(elmNode));
contentRestore(); grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode)); grammar.addGlobalComplexTypeDecl(type); if (grammar.getGlobalTypeDecl(type.getName()) == null) { grammar.addGlobalComplexTypeDecl(type); final XSTypeDefinition type2 = grammar.getGlobalTypeDecl(type.getName(), loc); if (type2 == null) { grammar.addGlobalComplexTypeDecl(type, loc);
elementType = SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion); else if ((((XSComplexTypeDecl)parent).getDerivationMethod() != XSConstants.DERIVATION_RESTRICTION) || (((XSComplexTypeDecl)parent).getBaseType() == SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion))) { reportSchemaError ("src-element.4.3.2", new Object[] {nameAtt}, elmDecl); grammar.addGlobalElementDeclAll(element); if (grammar.getGlobalElementDecl(element.fName) == null) { grammar.addGlobalElementDecl(element); final XSElementDecl element2 = grammar.getGlobalElementDecl(element.fName, loc); if (element2 == null) { grammar.addGlobalElementDecl(element, loc);
else if ((enclCT.getDerivationMethod() != XSConstants.DERIVATION_RESTRICTION) || enclCT.getBaseType() == SchemaGrammar.getXSAnyType(fSchemaHandler.fSchemaVersion)) { reportSchemaError ("src-attribute.6.3.2", new Object[] {nameAtt}, attrDecl); if (grammar.getGlobalAttributeDecl(nameAtt) == null) { grammar.addGlobalAttributeDecl(attribute); final XSAttributeDecl attribute2 = grammar.getGlobalAttributeDecl(nameAtt, loc); if (attribute2 == null) { grammar.addGlobalAttributeDecl(attribute, loc);
if (grammar.getGlobalAttributeGroupDecl(attrGrp.fName) == null || DOMUtil.getLocalName(DOMUtil.getParent(elmNode)).equals(SchemaSymbols.ELT_REDEFINE)) { grammar.addGlobalAttributeGroupDecl(attrGrp); final XSAttributeGroupDecl attrGrp2 = grammar.getGlobalAttributeGroupDecl(attrGrp.fName, loc); if (attrGrp2 == null) { grammar.addGlobalAttributeGroupDecl(attrGrp, loc);
private SchemaGrammar createGrammarFrom(SchemaGrammar grammar) { SchemaGrammar newGrammar = new SchemaGrammar(grammar); fGrammarBucket.putGrammar(newGrammar); // update all the grammars in the bucket to point to the new grammar. updateImportListWith(newGrammar); // update import list of the new grammar updateImportListFor(newGrammar); return newGrammar; }
addDocument(null, (String)grammar.fLocations.elementAt(k));
/** * Traverse local complexType declarations * * @param Element * @param XSDocumentInfo * @param SchemaGrammar * @return XSComplexTypeDecl */ XSComplexTypeDecl traverseLocal(Element complexTypeNode, XSDocumentInfo schemaDoc, SchemaGrammar grammar, XSObject context) { Object[] attrValues = fAttrChecker.checkAttributes(complexTypeNode, false, schemaDoc); String complexTypeName = genAnonTypeName(complexTypeNode); contentBackup(); XSComplexTypeDecl type = traverseComplexTypeDecl (complexTypeNode, complexTypeName, attrValues, schemaDoc, grammar, context); contentRestore(); // need to add the type to the grammar for later constraint checking grammar.addComplexTypeDecl(type, fSchemaHandler.element2Locator(complexTypeNode)); type.setIsAnonymous(); fAttrChecker.returnAttrArray(attrValues, schemaDoc); return type; }
currSG.addAnnotation(fElementTraverser.traverseAnnotationDecl(globalComp, currSchemaDoc.getSchemaAttrs(), true, currSchemaDoc)); sawAnnotation = true; String text = DOMUtil.getSyntheticAnnotation(currRoot); if (text != null) { currSG.addAnnotation(fElementTraverser.traverseSyntheticAnnotation(currRoot, text, currSchemaDoc.getSchemaAttrs(), true, currSchemaDoc));