Ejemplo n.º 1
0
        } // End Sub Add_SEL_User_DataSet

        public static string CreateFragmentString(string strFilename, string strXmlFragment)
        {
            System.Xml.XmlDocument         doc   = XmlTools.File2XmlDocument(strFilename);
            System.Xml.XmlNamespaceManager nsmgr = GetReportNamespaceManager(doc);
            doc = null;

            string strXmlFragment2 = @"<?xml version=""1.0"" encoding=""utf-8""?>
<Report ";

            IDictionary <string, string> dic = nsmgr.GetNamespacesInScope(System.Xml.XmlNamespaceScope.Local);

            foreach (System.Collections.Generic.KeyValuePair <string, string> kvp in dic)
            {
                if (StringComparer.InvariantCultureIgnoreCase.Equals(kvp.Key, "dft"))
                {
                    strXmlFragment2 += "xmlns=\"" + kvp.Value + "\" ";
                }
                else
                {
                    strXmlFragment2 += "xmlns:" + kvp.Key + "=\"" + kvp.Value + "\" ";
                }
                System.Console.WriteLine(kvp);
            } // Next kvp
            strXmlFragment2 += ">\n";
            strXmlFragment2 += strXmlFragment;


            strXmlFragment2 += @"
</Report>";

            return(strXmlFragment2);
        } // End Function CreateFragmentString