private static void MergeComplexStructure_Action(XmlNode childNode, XmlNode destinationNode)
        {
            if (childNode == null)
            {
                return;
            }

            MetadataDocumentManagement metaDataDocMgt = MetadataDocumentManagement.Instance;
            XmlNode actionIDNode = childNode.SelectSingleNode("./a:ID", metaDataDocMgt.XmlNamespaceMgt);

            if ((actionIDNode == null) || (String.IsNullOrEmpty(actionIDNode.InnerText)))
            {
                XmlNode captionMlNode = childNode.SelectSingleNode("./a:CaptionML", metaDataDocMgt.XmlNamespaceMgt);
                if (captionMlNode == null)
                {
                    captionMlNode = childNode.FirstChild;
                    string log = string.Format(CultureInfo.InvariantCulture, Resources.AddCaptionMl, childNode.InnerXml);
                    TransformationLog.GenericLogEntry(log, LogCategory.Warning, metaDataDocMgt.GetCurrentPageId);
                }

                String newID =
                    metaDataDocMgt.CalcId(GetProperty(captionMlNode.ParentNode, "NewID"),
                                          XmlUtility.GetCaption(captionMlNode.InnerText), captionMlNode.ParentNode.ParentNode.Name).ToString(CultureInfo.InvariantCulture);

                actionIDNode           = metaDataDocMgt.XmlDocument.CreateNode(XmlNodeType.Element, "ID", metaDataDocMgt.XmlNamespace);
                actionIDNode.InnerText = newID;

                XmlNode newNode = metaDataDocMgt.XmlDocument.ImportNode(childNode, true);
                newNode.PrependChild(actionIDNode);
                destinationNode.AppendChild(newNode);
            }
            else
            {
                XmlNode destinationActionNode = destinationNode.SelectSingleNode("./a:" + childNode.Name + "[./a:ID = " + actionIDNode.InnerText + "]", metaDataDocMgt.XmlNamespaceMgt);
                if (destinationActionNode != null)
                {
                    MergeSimpleSection(childNode, destinationActionNode);
                }
                else
                {
                    /* TODO  !!! TEMPORARY !!!  we should change TransformPages.xml instead! */
                    // Lets try to find it by ID:
                    XmlNodeList actionListById = childNode.SelectNodes(@".//a:ID", metaDataDocMgt.XmlNamespaceMgt);
                    if (actionListById.Count == 0)
                    {
                        /* Something is wrong in the transformation input file... */
                        string logStr = string.Format(
                            CultureInfo.InvariantCulture,
                            Resources.IDNotFound,
                            actionIDNode.InnerText);
                        TransformationLog.GenericLogEntry(logStr, LogCategory.CheckInputFile, metaDataDocMgt.GetCurrentPageId);

                        // break;
                        return;
                    }

                    foreach (XmlNode actionById in actionListById)
                    {
                        string  query = ".//a:Action[./a:ID = " + actionById.InnerText + "]";
                        XmlNode destinationActionNodeById = destinationNode.ParentNode.SelectSingleNode(query, metaDataDocMgt.XmlNamespaceMgt);
                        if (destinationActionNodeById != null)
                        {
                            MergeSimpleSection(actionById.ParentNode, destinationActionNodeById);
                        }
                        else
                        {
                            /* Something is wrong in the transformation input file... */
                            string logStr = string.Format(
                                CultureInfo.InvariantCulture,
                                Resources.IDNotFound,
                                actionById.InnerText);
                            string  tmpAddStr = string.Empty;
                            XmlNode tmp       = metaDataDocMgt.XmlCurrentFormNode.SelectSingleNode(".//a:ID[../a:ID = " + actionById.InnerText + "]", metaDataDocMgt.XmlNamespaceMgt);
                            if (tmp != null)
                            {
                                tmpAddStr = tmp.ParentNode.ParentNode.InnerXml;
                            }
                            TransformationLog.GenericLogEntry(logStr, LogCategory.CheckInputFile, metaDataDocMgt.GetCurrentPageId, tmpAddStr);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// ?abc?
        /// </summary>
        public static void Start()
        {
            MetadataDocumentManagement metaDataDocMgt = MetadataDocumentManagement.Instance;

            if (metaDataDocMgt.RenumberPagesDoc != null)
            {
                XmlNodeList pageNodeList = metaDataDocMgt.RenumberPagesDoc.SelectNodes(@"./a:MovePages/a:Page", metaDataDocMgt.XmlNamespaceMgt);
                foreach (XmlNode pageNode in pageNodeList)
                {
                    String  pageID         = pageNode.Attributes["ID"].Value;
                    XmlNode nodeToRenumber = metaDataDocMgt.XmlDocument.SelectSingleNode("./a:Objects/a:Page[./@ID='" + pageID + "']", metaDataDocMgt.XmlNamespaceMgt);
                    if (nodeToRenumber != null)
                    {
                        String  destinationID = pageNode.Attributes["destinationID"].Value;
                        XmlNode existingNode  = metaDataDocMgt.XmlDocument.SelectSingleNode("./a:Objects/a:Page[./@ID='" + destinationID + "']", metaDataDocMgt.XmlNamespaceMgt);
                        nodeToRenumber.Attributes["ID"].Value   = destinationID;
                        nodeToRenumber.Attributes["Name"].Value = pageNode.Attributes["destinationName"].Value;
                        if (existingNode != null)
                        {
                            XmlNode goodCaptionML = existingNode.SelectSingleNode("./a:Properties/a:CaptionML", metaDataDocMgt.XmlNamespaceMgt);
                            if (goodCaptionML != null)
                            {
                                XmlNode originalCaptionML = nodeToRenumber.SelectSingleNode("./a:Properties/a:CaptionML", metaDataDocMgt.XmlNamespaceMgt);
                                if (originalCaptionML != null)
                                {
                                    originalCaptionML.InnerText = goodCaptionML.InnerText;
                                }
                                else
                                {
                                    XmlNode tmpNode = nodeToRenumber.SelectSingleNode("./a:Properties", metaDataDocMgt.XmlNamespaceMgt);
                                    if (tmpNode != null)
                                    {
                                        tmpNode.AppendChild(XmlUtility.CreateXmlElement("CaptionML", goodCaptionML.InnerText));
                                    }
                                }
                            }

                            existingNode.ParentNode.RemoveChild(existingNode);
                        }
                    }
                }
            }

            if (!System.IO.File.Exists(UserSetupManagement.Instance.TranslationFile))
            {
                return;
            }

            Console.WriteLine(Resources.ImportingLocalizedStrings);
            XmlNodeList nodeList = metaDataDocMgt.XmlDocument.SelectNodes(@"./a:Objects/a:Page", metaDataDocMgt.XmlNamespaceMgt);

            foreach (XmlNode formNode in nodeList)
            {
                AddMlCaptions(formNode);

                if (AddMultiLanguageSupport.FileState == AddMultiLanguageSupport.TranslationFileStates.NotReady)
                {
                    return;
                }
            }
        }
        private static void RemoveIgnoredForm(String pageID)
        {
            MetadataDocumentManagement metaDataDocMgt = MetadataDocumentManagement.Instance;
            XmlNode formToBeIgnored = metaDataDocMgt.XmlDocument.SelectSingleNode("./a:Objects/a:Form[@ID =" + pageID + "]", metaDataDocMgt.XmlNamespaceMgt);

            if (formToBeIgnored == null)
            {
                return;
            }

            XmlNode codeTriggerNode = formToBeIgnored.SelectSingleNode(@".//a:Code", metaDataDocMgt.XmlNamespaceMgt);
            Boolean restart         = true;
            Int32   startAfter      = 0;

            while (restart)
            {
                restart = false;
                Boolean inProcedure   = false;
                Boolean inCodeBody    = false;
                Int32   beginPosition = 0;

                SimpleNAVCodeParser sNAVCodeParser = new SimpleNAVCodeParser();
                foreach (NormalizedCode normNAVCode in sNAVCodeParser.GenerateNormalisedCode(codeTriggerNode.InnerText))
                {
                    if (inProcedure)
                    {
                        if (inCodeBody)
                        {
                            if ((normNAVCode.xPos == 2) && (normNAVCode.Token == "END"))
                            {
                                inProcedure = false;
                                inCodeBody  = false;

                                String beginningPart = codeTriggerNode.InnerText.Substring(0, beginPosition + 6);
                                String endPart       = codeTriggerNode.InnerText.Substring(normNAVCode.position - 1);
                                codeTriggerNode.RemoveAll();

                                XmlCDataSection data = metaDataDocMgt.XmlDocument.CreateCDataSection(
                                    String.Format(CultureInfo.InvariantCulture, "{0}{1}", beginningPart, endPart));
                                codeTriggerNode.AppendChild(data);

                                startAfter    = beginPosition;
                                beginPosition = 0;
                                inProcedure   = false;
                                inCodeBody    = false;
                                restart       = true;
                                break;
                            }
                        }
                        else
                        {
                            if ((normNAVCode.xPos == 2) && (normNAVCode.Token == "BEGIN"))
                            {
                                inCodeBody    = true;
                                beginPosition = normNAVCode.position;
                            }
                        }
                    }
                    else
                    {
                        if ((normNAVCode.position >= startAfter) && (normNAVCode.xPos == 2) && ((normNAVCode.Token == "LOCAL") ||
                                                                                                (normNAVCode.Token == "PROCEDURE") ||
                                                                                                (normNAVCode.Token == "EVENT")))
                        {
                            inProcedure = true;
                        }
                    }
                }
            }

            XmlNode controlNode = formToBeIgnored.SelectSingleNode(@".//a:Controls", metaDataDocMgt.XmlNamespaceMgt);

            controlNode.ParentNode.ReplaceChild(XmlUtility.CreateXmlElement("Controls", null), controlNode);

            XmlNode triggerNode = formToBeIgnored.SelectSingleNode(@".//a:Triggers", metaDataDocMgt.XmlNamespaceMgt);

            triggerNode.ParentNode.ReplaceChild(XmlUtility.CreateXmlElement("Triggers", null), triggerNode);

            // TransformationLog.IgnoreFormsLog(Convert.ToInt32(pageID.Value, CultureInfo.InvariantCulture));
            String logStr = Resources.FormIgnored;

            TransformationLog.GenericLogEntry(logStr, LogCategory.IgnoreForms, pageID, null);
        }
        private static void AddMlCaptions(XmlNode page)
        {
            MetadataDocumentManagement metaDataDocMgt = MetadataDocumentManagement.Instance;
            XmlNodeList idList        = page.SelectNodes(@".//a:ID", metaDataDocMgt.XmlNamespaceMgt);
            int         destinationID = Convert.ToInt32(page.Attributes["ID"].Value, CultureInfo.InvariantCulture);

            foreach (XmlNode id in idList)
            {
                if (!string.IsNullOrEmpty(id.InnerText))
                {
                    try
                    {
                        AddMultiLanguageSupport.PopulateMlStrings(id.ParentNode, destinationID, Convert.ToInt32(id.InnerText, CultureInfo.InvariantCulture));
                    }
                    catch (Exception ex)
                    {
                        string log = String.Format(CultureInfo.InvariantCulture, Resources.CannotGetMlCaption, "control ", id.InnerText);
                        TransformationLog.GenericLogEntry(log, LogCategory.Warning, destinationID, "Ignore");
                        TransformationLog.WriteErrorToLogFile(ex, destinationID, LogCategory.Warning);
                    }
                }
            }

            XmlNode pageCaption = page.SelectSingleNode(@"./a:Properties", metaDataDocMgt.XmlNamespaceMgt);

            if (pageCaption != null)
            {
                try
                {
                    AddMultiLanguageSupport.PopulateMlStrings(pageCaption, destinationID, 0);
                }
                catch (Exception ex)
                {
                    string log = String.Format(CultureInfo.InvariantCulture, Resources.CannotGetMlCaption, "page", string.Empty);
                    TransformationLog.GenericLogEntry(log, LogCategory.Warning, destinationID, "Ignore");
                    TransformationLog.WriteErrorToLogFile(ex, destinationID, LogCategory.Warning);
                }
            }

            XmlNode code = page.SelectSingleNode(@"./a:Code", metaDataDocMgt.XmlNamespaceMgt);

            if (code == null)
            {
                return;
            }

            try
            {
                System.Text.RegularExpressions.Regex textVariableExp = new System.Text.RegularExpressions.Regex(@"\@(?<varId>\d+)\s*\:\s*TextConst\s*\'", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                if (!textVariableExp.Match(code.InnerText).Success)
                {
                    return;
                }

                string[] codeArr = code.InnerText.Split(new char[] { '\r' });
                System.Text.RegularExpressions.Match textVariableMatch;
                int    textVarId;
                string textVarNewCaption;
                for (int i = 0; i < codeArr.Length; i++)
                {
                    textVariableMatch = textVariableExp.Match(codeArr[i]);
                    if (textVariableMatch.Success)
                    {
                        textVarId         = Convert.ToInt32(textVariableMatch.Result("${varId}"), CultureInfo.InvariantCulture);
                        textVarNewCaption = AddMultiLanguageSupport.GetCaptionML(destinationID, textVarId, AddMultiLanguageSupport.TranslationType.TextVariable);
                        if (!string.IsNullOrEmpty(textVarNewCaption))
                        {
                            textVarNewCaption = textVarNewCaption.Replace("'", "''");
                            codeArr[i]        = codeArr[i].Remove(textVariableMatch.Length + textVariableMatch.Index) + textVarNewCaption + "';";
                        }
                    }
                }

                XmlNode codeNode = XmlUtility.CreateXmlElement("Code");
                codeNode.AppendChild(XmlUtility.CreateCDataSection(string.Join("\r", codeArr)));
                code.ParentNode.AppendChild(codeNode);
                code.ParentNode.RemoveChild(code);
            }
            catch (Exception ex)
            {
                string log = String.Format(CultureInfo.InvariantCulture, Resources.CannotGetMlCaption, "code", string.Empty);
                TransformationLog.GenericLogEntry(log, LogCategory.Warning, destinationID, "Ignore");
                TransformationLog.WriteErrorToLogFile(ex, destinationID, LogCategory.Warning);
            }
        }
        public static void CleanProperties()
        {
            MetadataDocumentManagement metaDataDocMgt = MetadataDocumentManagement.Instance;
            bool isForm = (metaDataDocMgt.GetCurrentPageId > 0);

            UpdatePropertyValuesYesNoToTRUEFALSE(
                metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@".//a:Controls//a:Properties/a:FontItalic", metaDataDocMgt.XmlNamespaceMgt));
            UpdatePropertyValuesYesNoToTRUEFALSE(
                metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@".//a:Controls//a:Properties/a:FontStrikeThru", metaDataDocMgt.XmlNamespaceMgt));
            UpdatePropertyValuesYesNoToTRUEFALSE(
                metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@".//a:Controls//a:Properties/a:Editable", metaDataDocMgt.XmlNamespaceMgt));
            UpdatePropertyValuesYesNoToTRUEFALSE(
                metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@".//a:Properties/a:Enabled", metaDataDocMgt.XmlNamespaceMgt));
            UpdatePropertyValuesYesNoToTRUEFALSE(
                metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@".//a:Properties/a:Visible", metaDataDocMgt.XmlNamespaceMgt));
            if (isForm)
            {
                UpdatePropertyValuesYesNoToTRUEFALSE(
                    metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@"./a:Properties/a:LookupMode", metaDataDocMgt.XmlNamespaceMgt));
            }

            CodeTransformationRules.PerformMoveToTriggerActions(true);
            CodeTransformationRules.PerformMoveToPropertyActions();
            if (isForm)
            {
                CodeTransformationRules.LookupModePropertyToOnInitTrigger();
            }

            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, ".//a:Properties/a:tempNode_InstructionalTextML", metaDataDocMgt.XmlNamespaceMgt);
            UpdateNewIdNodes();

            /* PageProperties */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Caption", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:DataCaptionExpr", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:BorderStyle", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:CaptionBar", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Minimizable", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Maximizable", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Sizeable", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:LogWidth", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:LogHeight", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Width", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Height", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:XPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:YPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:BackColor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:Visible", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:ActiveControlOnOpen", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:MinimizedOnOpen", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:MaximizedOnOpen", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:AutoPosition", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:TableBoxID", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:LookupMode", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:CalcFields", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:SourceTablePlacement", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:SourceTableRecord", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:SaveTableView", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:SaveControlInfo", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:SaveColumnWidths", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:SavePosAndSize", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:UpdateOnActivate", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:HorzGrid", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Properties/a:VertGrid", metaDataDocMgt.XmlNamespaceMgt);

            /* PageControls */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:XPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:YPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Width", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Height", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:HorzGlue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:VertGlue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Focusable", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FocusOnClick", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Default", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Cancel", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ParentControl", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InFrame", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InPage", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InColumn", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InMatrix", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InMatrixHeading", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Caption", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ShowCaption", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:HorzAlign", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:VertAlign", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BackColor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BackTransparent", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Border", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BorderColor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BorderStyle", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BorderWidth", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FontName", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FontSize", metaDataDocMgt.XmlNamespaceMgt);

            SetEmphasis();
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FontBold", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ForeColor", metaDataDocMgt.XmlNamespaceMgt);

            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FontItalic", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FontStrikethru", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:FontUnderline", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:PadChar", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:LeaderDots", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:MaxLength", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:AutoEnter", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BitmapPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:AutoRepeat", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InvalidActionAppearance", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Bitmap", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:BitmapList", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ShapeStyle", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Orientation", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Percentage", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:MenuItemType", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:MenuLevel", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:TopLineOnly", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:PageNames", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:PageNamesML", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:RowHeight", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:MatrixColumnWidth", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:HeadingHeight", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ToolTip", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Lookup", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:DrillDown", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:AssistEdit", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:DropDown", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:PermanentAssist", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:InlineEditing", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:OptionString", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:OptionCaption", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:OptionValue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:StepValue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ClearOnLookup", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Format", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:SignDisplacement", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:DropDown", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, ".//a:Control/a:Properties/a:Title", metaDataDocMgt.XmlNamespaceMgt);

            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:CaptionClass", metaDataDocMgt.XmlNamespaceMgt);
            //XmlNodeList captionClassNodes = metaDataDocMgt.XmlCurrentFormNode.SelectNodes(@".//a:Controls//a:CaptionClass", metaDataDocMgt.XmlNamespaceMgt);
            //foreach (XmlNode captionClassNode in captionClassNodes)
            //{
            //  captionClassNode.ParentNode.ReplaceChild(
            //    XmlUtility.CreateXmlElement("CaptionExpression", captionClassNode.LastChild.Value),
            //    captionClassNode);
            //}

            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Divisor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:AutoCalcField", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ValidateTableRelation", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:RunFormLinkType", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:RunCommand", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:LookupFormID", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:DrillDownFormID", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Menu", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:MatrixSourceTable", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:RunFormOnRec", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:UpdateOnAction", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:NextControl", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:PushAction", metaDataDocMgt.XmlNamespaceMgt);
            // temporarily commented out
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:ClosingDates", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:MultiLine", metaDataDocMgt.XmlNamespaceMgt);

            /* For ActionGroup support */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, ".//a:Control/a:Properties/a:PushAction", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, ".//a:Control/a:Properties/a:RunObject", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, ".//a:Control/a:Properties/a:RunFormView", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, ".//a:Control/a:Properties/a:RunFormLink", metaDataDocMgt.XmlNamespaceMgt);

            /* Group */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:Controltype", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:SourceExpr", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:OptionCaptionML", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:TableRelation", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:NotBlank", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:AutoFormatType", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:DecimalPlaces", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:MinValue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:MaxValue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Properties/a:ToolTipML", metaDataDocMgt.XmlNamespaceMgt);

            /* TODO Needs logging */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Group/a:Triggers", metaDataDocMgt.XmlNamespaceMgt);

            /* PageActions */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:XPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:YPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Width", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Height", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:HorzGlue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:VertGlue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Focusable", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FocusOnClick", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Default", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Cancel", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ParentControl", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InFrame", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InPage", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InColumn", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InMatrix", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InMatrixHeading", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Caption", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ShowCaption", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:HorzAlign", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:VertAlign", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ForeColor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BackColor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BackTransparent", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Border", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BorderColor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BorderStyle", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BorderWidth", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FontName", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FontSize", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FontBold", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FontItalic", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FontStrikethru", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:FontUnderline", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:PadChar", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:LeaderDots", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:MaxLength", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:AutoEnter", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BitmapPos", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:AutoRepeat", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InvalidActionAppearance", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Bitmap", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:BitmapList", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ShapeStyle", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Orientation", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Percentage", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:MenuItemType", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:MenuLevel", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:TopLineOnly", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:PageNames", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:PageNamesML", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:RowHeight", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:MatrixColumnWidth", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:HeadingHeight", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ToolTip", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Lookup", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:DrillDown", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:AssistEdit", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:DropDown", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:PermanentAssist", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:InlineEditing", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:OptionString", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:OptionCaption", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:OptionValue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:StepValue", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ClearOnLookup", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Format", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:SignDisplacement", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:CaptionClass", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Divisor", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:AutoCalcField", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:ValidateTableRelation", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:RunFormLinkType", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:RunCommand", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:LookupFormID", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:DrillDownFormID", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Menu", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:MatrixSourceTable", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:RunFormOnRec", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:UpdateOnAction", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:NextControl", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Controltype", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:MultiLine", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:SourceExpr", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:PushAction", metaDataDocMgt.XmlNamespaceMgt);

            /* Temporarily removed */
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Visible", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Enabled", metaDataDocMgt.XmlNamespaceMgt);
            /* Temporarily removed */

            /* TODO subtype see excel???? */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Numeric", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:PasswordText", metaDataDocMgt.XmlNamespaceMgt);
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:DateFormula", metaDataDocMgt.XmlNamespaceMgt);

            ///* PageTriggers */
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnInit", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnQueryCloseForm", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnActivateForm", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnDeactivateForm", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnAfterGetCurrRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnBeforePutRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnTimer", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnCreateHyperlink", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Triggers/a:OnHyperlink", metaDataDocMgt.XmlNamespaceMgt);

            ///* ControlTriggers */
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnActivate", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnDeactivate", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnFormat", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnBeforeInput", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnInputChange", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnAfterInput", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnAfterValidate", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnFindRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnNextRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnAfterGetRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnAfterGetCurrRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnBeforePutRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnNewRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnInsertRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnModifyRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnDeleteRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Triggers/a:OnPush", metaDataDocMgt.XmlNamespaceMgt);

            ///* ActionTriggers */
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnActivate", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnDeactivate", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnFormat", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnBeforeInput", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnInputChange", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnAfterInput", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnAfterValidate", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnFindRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnNextRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnAfterGetRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnAfterGetCurrRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnBeforePutRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnNewRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnInsertRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnModifyRecord", metaDataDocMgt.XmlNamespaceMgt);
            //XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Actions//a:Triggers/a:OnDeleteRecord", metaDataDocMgt.XmlNamespaceMgt);

            /* Controls with control parent. */
            /* TODO Needs logging */
            XmlUtility.DeleteElements(metaDataDocMgt.XmlCurrentFormNode, "./a:Controls//a:Control/a:Control", metaDataDocMgt.XmlNamespaceMgt);

            /*Temporary until codewash */
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes("./a:Properties/a:DataCaptionExpr", metaDataDocMgt.XmlNamespaceMgt), "'Removed'", false);
            //if (pageId != 0)
            //{
            //  TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnOpenForm", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //}
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnFindRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnAfterGetRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnNewRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnDeleteRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnInsertRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnAssistEdit", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnAction", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnDrillDown", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnValidate", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnLookup", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnNextRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnCloseForm", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);
            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:OnModifyRecord", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND;\r\n", true);

            //TempCodeWash(metaDataDocMgt.XmlCurrentFormNode.SelectNodes(".//a:Code", metaDataDocMgt.XmlNamespaceMgt), "BEGIN\r\nif true then;\r\nEND.\r\n", true);
        }