<?xml version="1.0" standalone="yes"?> <DsXmlDbDemo xmlns="http://tempuri.org/DsXmlDbDemo.xsd"> <Customers> <CustomerId>1</CustomerId> <Name>dfgdfg</Name> <Address1>dfgdfg</Address1> <Address2>dfgdfg</Address2> <City>dfgdfgdf</City> <St>dfgdfg</St> <Zip>45646</Zip> </Customers> <Customers> <CustomerId>2</CustomerId> <Name>asfdasd</Name> <Address1>sedufsufh</Address1> <Address2>sdoifo</Address2> <City>efef</City> <St>sdfsf</St> <Zip>6656</Zip> </Customers> </DsXmlDbDemo>
intid = dgvxml(0, dgvxml.CurrentRow.Index).Value.ToString 'If intid = 0 Then Dim xd As New XmlDocument() xd.Load(mXmlFilePath) 'Else Dim node As XmlNode Dim xe As XmlElement = xd.DocumentElement While x.Read If x.Name = "CustomerId" Then node = xd.SelectSingleNode("/Customers[CustomerId='2']") xd.ParentNode.RemoveChild(node) xd.Save(mXmlFilePath) Exit While End If End While
Dim xmlDoc As Xml.XmlDocument = Nothing, xmlRoot As Xml.XmlNode = Nothing Dim xmlNode As Xml.XmlNode = Nothing, xmlChild As Xml.XmlNode = Nothing Try xmlDoc = New Xml.XmlDocument() xmlDoc.Load("E:\MyXML.xml") xmlRoot = xmlDoc.DocumentElement() xmlNode = xmlRoot.ChildNodes(1) For Each xmlChild In xmlNode MsgBox(xmlChild.Name & vbCr & xmlChild.InnerText) Next Catch ex As Exception MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Error") Finally xmlRoot = Nothing xmlNode = Nothing xmlDoc = Nothing End Try
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)