|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Remove node in xml file from Visual Basic?
I have a question about how to remove a node in a xml tree from VB6.
xml code is like this: <a>
<aa>
<gen_date>13.4.2000</gen_date>
<name>blablabla</name>
</aa>
<aa>
<gen_date>12.4.2000</gen_date>
<name>lablablab</name>
</aa>
</a>So what i do is getting the gen_date (12.4.2000) and i've solved how to delete only that but what i want to do is to delete it's parent to that particular date, which is <aa> Result should then be <a>
<aa>
<gen_date>13.4.2000</gen_date>
<name>blablabla</name>
</aa>
</a>Here is the Visual Basic Code: Dim xmldoc
Dim Check, Tmp_Date, Del_Date As String
Dim Ant, x As Integer
Del_Date = "12.4.2000"
Set xmldoc = CreateObject("Microsoft.XMLDOM")
xmldoc.async = False
xmldoc.Load ("f:\Data.Xml")
Set SlettNode = xmldoc.getElementsByTagName("gen_date")
Ant = SlettNode.length
For x = 0 To Antall - 1
Tmp_Date = SlettNode.Item(x).nodetypedvalue
Tmp_Date = RTrim(Left(Tmp_Dato, 10))
If Mid(Tmp_Date, 2, 1) = "." And Mid(Tmp_Date, 4, 1) = "." Then
Tmp_Date = RTrim(Left(Tmp_Date, 9))
End If
If Tmp_Date = Del_Dato Then
Set OldChild = SlettNode.Item(x).firstchild
SlettNode.Item(x).RemoveChild OldChild
End If
Next x
xmldoc.save ("f:\Data.Xml")Thanks Paal Steven ______________________________________________________ Get Your Private, Free Email at http://www.hotmail.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








