public static String mocaNodeToString(MocaNode mocaNode) { //create xml stub with a single root node XmlDocument xmlDocStub = MocaTreeUtil.createMocaXMLDoc(); //parse this object to moca element tree MocaNode treeElement = mocaNode; //parse moca element to xmlElement tree XmlElement serializedMocaRoot = treeElement.serializeToXmlTree(xmlDocStub); //append new xmlElement to xmlDocument xmlDocStub.FirstChild.AppendChild(serializedMocaRoot); return(MocaTreeUtil.xmlDocumentToString(xmlDocStub)); }
/// <summary> /// Serializes the current Object 1. to MocaTree and 2. to XmlDocument and saves the XmlDocument /// represented as String to a TaggedValue. Last some EA GUI stuff is done which is used to make sure that /// the visualization in EA works correctly. /// </summary> public void saveTreeToEATaggedValue(Boolean updateEaGui) { String documentString = ""; if (!this.isIgnored()) { //create xml stub with a single root node XmlDocument xmlDocStub = MocaTreeUtil.createMocaXMLDoc(); //parse this object to moca element tree MocaNode treeElement = this.serializeToMocaTree(); //parse moca element to xmlElement tree XmlElement serializedMocaRoot = treeElement.serializeToXmlTree(xmlDocStub); //append new xmlElement to xmlDocument xmlDocStub.FirstChild.AppendChild(serializedMocaRoot); documentString = MocaTreeUtil.xmlDocumentToString(xmlDocStub); } if (Import.MainImport.ImportBusy) { foreach (String oldGuid in Import.MainImport.getInstance(Repository, null).OldGuidToNewGuid.Keys) { documentString = documentString.Replace(oldGuid, Import.MainImport.getInstance(Repository, null).OldGuidToNewGuid[oldGuid]); } } if (!isLocked()) { EAEcoreAddin.Util.EAUtil.setTaggedValueNotes(Repository, getObjectToBeTagged(), Main.MoflonExportTreeTaggedValueName, documentString); if (updateEaGui) { doEaGuiStuff(); } } refreshSQLObject(); }