Ejemplo n.º 1
0
        public string RemoveXMLNameSpace(XmlDocument XmlDoc)
        {
            //Remove the xmlns attribute from all elements in the XmlDoc
            //Replace instances of a single quote with a double single quote.
            XmlAttribute Attrib = null;

            foreach (XmlNode Node in XmlDoc)
            {
                if (Node.HasChildNodes)
                {
                    foreach (XmlNode ChildNode in Node)
                    {
                        if (ChildNode.NodeType == XmlNodeType.Element)
                        {
                            Attrib = ChildNode.Attributes["xmlns"];
                            if ((Attrib != null))
                            {
                                Attrib.RemoveAll();
                            }
                        }
                    }
                }
            }
            //NOTE: I do not think we need to escape the quotes. Stored Procedure Parameters already do that.
            //      Otherwise we just double the quotes in the DB.
            //Dim XmlOut As String = XmlDoc.OuterXml.Replace("'", "''")
            //XmlOut = XmlOut.Replace("utf-8", "utf-16")

            string XmlOut = XmlDoc.OuterXml.Replace("'", "''");

            return(XmlOut);
        }
Ejemplo n.º 2
0
        public void XmlNodeDerivedTypes(XmlAttribute attNode, XmlNamespaceManager nsMgr, XmlNode node2, string path)
        {
            // Fixed paths are ok
            attNode.SelectNodes("fixed");
            attNode.SelectSingleNode(FixedPath);

            attNode.SelectNodes(path);                      // Noncompliant
            attNode.SelectNodes(path, nsMgr);               // Noncompliant

            attNode.SelectSingleNode(path);                 // Noncompliant
            attNode.SelectSingleNode(path, nsMgr);          // Noncompliant

            attNode.ReplaceChild(node2, node2);
            attNode.RemoveAll();
            attNode.WriteContentTo(null);
        }