Beispiel #1
0
        public void export(EAPackage rootPackage, string filePath)
        {
            connectorSet.Clear();
            depSet.Clear();
            // create document with declaration
            XDocument xDocument = new XDocument(new XDeclaration("1.0", "UTF-8", null));

            // add element
            XElement rootElment = createRootElement();
            XElement element    = new XElement(this.xmiNameSapce + "Documentation",
                                               new XAttribute("exporter", "Enterprise Architect"), new XAttribute("exporterVersion", "6.5"));

            xDocument.Add(rootElment);
            rootElment.Add(element);
            XElement modelElement = new XElement(this.umlNameSapce + "Model",
                                                 new XAttribute(this.xmiNameSapce + "type", "Enterprise Architect"), new XAttribute("name", "EA_Model"));

            rootElment.Add(modelElement);

            initDocumentWithPackage(modelElement, rootPackage);

            XElement extendElement = new XElement(this.xmiNameSapce + "Extension",
                                                  new XAttribute("extender", "Enterprise Architect"), new XAttribute("extenderID", "6.5"));

            rootElment.Add(extendElement);


            XElement xmlEles = new XElement("elements");
            XElement xmlCon  = new XElement("connectors");
            XElement xmlPrim = new XElement("primitivetypes");
            XElement xmlDia  = new XElement("diagrams");

            extendElement.Add(xmlEles);
            extendElement.Add(xmlCon);
            extendElement.Add(xmlPrim);
            extendElement.Add(xmlDia);
            addExtension(xmlEles, xmlCon, xmlPrim, xmlDia, rootPackage.EaPackage);

            // Encrypt and save
            AESHelper.encryptXML(xDocument, filePath);
            // save element
            //    xDocument.Save(filePath);
        }