Example #1
0
        /// <summary>
        /// Append xml into 'text' string after node 'parent' in root/nodes
        /// </summary>
        /// <param name="text">xml string to insert</param>
        /// <param name="parent">xmlnode parent under root/nodes</param>
        public void Text2Xml(string text, System.Xml.XmlNode parent)
        {
            System.Xml.XmlNode xmlParent = FindXmlNodeByGuid(GetAttributeByName(parent, PazDocumentLegacy.TAG_GUID));

            System.Xml.XmlDocumentFragment frag = xmlDoc.CreateDocumentFragment();
            frag.InnerXml = text;

            parent.ParentNode.InsertAfter(frag, parent);
        }
Example #2
0
        } // End Sub AddOrReplaceParameter

        public static void AddCustomParameter(string strFilename, System.Xml.XmlNode xnInsertHere, bool bFirst, bool bLast, string strXmlFragment)
        {
            string strReportName = System.IO.Path.GetFileNameWithoutExtension(strFilename);


            if (xnInsertHere != null)
            {
                Logging.LogMessage("{0}\t{1}", strReportName, "hasParameters");

                System.Xml.XmlDocument         doc        = xnInsertHere.OwnerDocument;
                System.Xml.XmlDocumentFragment xmlDocFrag = doc.CreateDocumentFragment();
                xmlDocFrag.InnerXml = strXmlFragment;


                bool bDoNotFechParameter = bFirst || bLast;

                if (bDoNotFechParameter)
                {
                    if (bFirst)
                    {
                        xnInsertHere.PrependChild(xmlDocFrag);
                    }
                    else
                    {
                        xnInsertHere.AppendChild(xmlDocFrag);
                    }
                }
                else
                {
                    if (StringComparer.InvariantCultureIgnoreCase.Equals(xnInsertHere.LocalName, "ReportParameters"))
                    {
                        xnInsertHere.AppendChild(xmlDocFrag);
                    }
                    else
                    {
                        xnInsertHere.ParentNode.InsertAfter(xmlDocFrag, xnInsertHere);
                    }
                } // End else of if (bDoNotFechParameter)

                XmlTools.SaveDocument(doc, strFilename, true);
            } // End if (xn
            else
            {
                Logging.LogMessage("{0}\tKeine Parameter in Report.", strReportName);
            }
        } // End Sub AddCustomParameter
Example #3
0
        } // End Function GetDataSetDefinition

        public static void AddMainParametersNode(string strFilename)
        {
            if (HasParameters(strFilename))
            {
                return;
            }

            System.Xml.XmlNode xnDataSets = GetDataSetsNode(strFilename);
            if (xnDataSets == null)
            {
                return;
            }

            System.Xml.XmlDocument         doc        = xnDataSets.OwnerDocument;
            System.Xml.XmlDocumentFragment xmlDocFrag = doc.CreateDocumentFragment();
            xmlDocFrag.InnerXml = "<ReportParameters></ReportParameters>";

            xnDataSets.ParentNode.InsertAfter(xmlDocFrag, xnDataSets);
            XmlTools.SaveDocument(doc, strFilename, true);
        }