private CorePackage createPackage(XNamespace xnamespace, CoreNamespace ownerNamespace, CoreModelElement owner, XElement xpackage) { CorePackage corePackage = new CorePackageImpl(); corePackage.setName(xpackage.Attribute("name").Value); corePackage.setElemOwner(owner); updateElemOwnedElements(owner, corePackage); corePackage.setNamespace(ownerNamespace); updateNamespaceElemOwnedElements(ownerNamespace, corePackage); lookup.Add(xpackage.Attribute("xmi.id").Value, corePackage); var xcoreNamespace = xpackage.Element(xnamespace + "Namespace.ownedElement"); if (xcoreNamespace != null) { CoreNamespace coreNamespace = new CoreNamespaceImpl(); var xmodelClasses = xcoreNamespace.Elements(xnamespace + "Class"); createModelClasses(xnamespace, coreNamespace, corePackage, xmodelClasses); var xpackages = xcoreNamespace.Elements(xnamespace + "Package"); foreach (var xinnerpackage in xpackages) { createPackage(xnamespace, coreNamespace, coreModel, xinnerpackage); } var xstereotypes = xcoreNamespace.Elements(xnamespace + "Stereotype"); foreach (var xstereotype in xstereotypes) { createStereotype(coreNamespace, corePackage, xstereotype); } var xinterfaces = xcoreNamespace.Elements(xnamespace + "Interface"); foreach (var xinterface in xinterfaces) { createInterface(coreNamespace, corePackage, xinterface); } } return(corePackage); }
private CorePackage createPackage(XNamespace xnamespace, CoreNamespace ownerNamespace, CoreModelElement owner, XElement xpackage) { CorePackage corePackage = new CorePackageImpl(); corePackage.setName(xpackage.Attribute("name").Value); corePackage.setElemOwner(owner); updateElemOwnedElements(owner, corePackage); corePackage.setNamespace(ownerNamespace); updateNamespaceElemOwnedElements(ownerNamespace, corePackage); lookup.Add(xpackage.Attribute("Id").Value, corePackage); var xcoreNamespace = xpackage.Element(xnamespace + "packagedElements"); if (xcoreNamespace != null) { CoreNamespace coreNamespace = new CoreNamespaceImpl(); var xhasnamedelements = xcoreNamespace.Element(xnamespace + "packageHasNamedElement"); if (xhasnamedelements != null) { var xenumerations = xcoreNamespace.Descendants(xnamespace + "enumeration"); var stereotype = createStereotype(ownerNamespace, owner, "Enumeration"); foreach (var xenumeration in xenumerations) { createEnumeration(xnamespace, coreNamespace, corePackage, xenumeration, stereotype); } var stereotypeId = createStereotype(ownerNamespace, owner, "Id"); var xmodelClasses = xcoreNamespace.Descendants(xnamespace + "class"); createModelClasses(xnamespace, coreNamespace, corePackage, xmodelClasses, stereotypeId); var xpackages = xcoreNamespace.Descendants(xnamespace + "package"); foreach (var xinnerpackage in xpackages) { createPackage(xnamespace, coreNamespace, coreModel, xinnerpackage); } } } return(corePackage); }