public EAClass createEAClassFromXMLNode(XmlNode xmlNode) { XmlElement xmlElement = xmlNode as XmlElement; string name = xmlElement.GetAttribute("name"); string id = xmlElement.GetAttribute("xmi:id"); string stereoType = getFaceType(xmlNode); EAClass eaClass = new EAClass(name, stereoType, id); string realizeId = xmlElement.GetAttribute("realizes"); if (realizeId != "") { eaClass.RealizeClassID = realizeId; } string measurementAxis = xmlElement.GetAttribute("measurementAxis"); if (measurementAxis != "") { List <string> measurementList = measurementAxis.Split(' ').ToList(); eaClass.MeasurementAxisList = measurementList; } foreach (XmlNode n in xmlNode.ChildNodes) { XmlElement element = n as XmlElement; EAAttribute eAAttribute = null; if (isAttribute(n)) { eAAttribute = new EAAttribute(element.GetAttribute(attributeStr), getFaceType(n), element.GetAttribute("xmi:id")); } if (eAAttribute != null && isAttributeClass(n)) { eAAttribute.Name = element.GetAttribute("name"); eAAttribute.IsEAClass = true; } if (eAAttribute != null) { eaClass.addAttribute(eAAttribute); } } return(eaClass); }
private void initPackage(EA.Package topPackage, EAPackage rootPackage) { foreach (EA.Package p in topPackage.Packages) { EAPackage newPackage = new EAPackage(p.Name, p.PackageGUID); newPackage.EaPackage = p; foreach (EA.Element element in p.Elements) { EAClass eAClass = new EAClass(element.Name, element.ElementGUID); eAClass.Element = element; foreach (EA.Attribute attribute in element.Attributes) { EAAttribute eAAttribute = new EAAttribute(attribute.Name, attribute.AttributeGUID); eAAttribute.Attribute = attribute; eAClass.addAttribute(eAAttribute); } newPackage.addClass(eAClass); } rootPackage.addPackage(newPackage); initPackage(p, newPackage); } }