遍厉xml

80酷酷网    80kuku.com

  xml  Public Shared Function FindVlues(ByVal xn As XmlNode, ByVal name As String, ByVal text As String, ByVal sename As String)
            Dim objNode As XmlNode

            If xn.Name = name Then
                Dim objElement As XmlElement = CType(xn, XmlNode)

                objElement.SetAttribute("text", text)
                objElement.SetAttribute("senname", sename)
            Else

                For Each objNode In xn.ChildNodes

                    FindVlues(objNode, name, text, sename)
                Next

            End If
            Return xn
        End Function
        Public Shared Function InsertVlues(ByVal xn As XmlNode, ByVal name As String, ByVal ID As String, ByVal text As String, ByVal sename As String)
            Dim objNode As XmlNode
            Dim objXml As XmlDocument = New XmlDocument
            objXml.Load("F:\project\JGoodIn\AspDotNetStorefront.root\AspDotNetStorefront\ml6219vb\Admin\leftMenu.xml")

            If xn.Name = name Then
                Dim objElement As XmlElement = objXml.CreateElement("node" & ID.ToString())
                objElement.SetAttribute("text", text)
                objElement.SetAttribute("senname", sename)
                objElement.SetAttribute("link", "")
                xn.AppendChild(objElement)
            Else

                For Each objNode In xn.ChildNodes

                    InsertVlues(objNode, name, ID, text, sename)
                Next

            End If
            objXml.Save("F:\project\JGoodIn\AspDotNetStorefront.root\AspDotNetStorefront\ml6219vb\Admin\leftMenu.xml")
            Return xn
        End Function
    End Class 




分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: