Click here to Skip to main content
15,917,565 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: Convert XML/XSL to Image File Pin
Anonymous12-Jun-05 4:27
Anonymous12-Jun-05 4:27 
GeneralXML TO EXCEL Pin
Abhinavbhatia7-Jun-05 1:53
Abhinavbhatia7-Jun-05 1:53 
GeneralRe: Xml programming c# Pin
DavidNohejl7-Jun-05 2:21
DavidNohejl7-Jun-05 2:21 
Generalnested ado datasets in XML Pin
sparty10226-Jun-05 4:50
sparty10226-Jun-05 4:50 
GeneralExport to excel data from ultrawebgrid each row contain one worksheet Pin
sunilmskr3-Jun-05 2:38
sunilmskr3-Jun-05 2:38 
GeneralXSL HTML table and matching tags problem Pin
Leftyfarrell2-Jun-05 4:16
Leftyfarrell2-Jun-05 4:16 
GeneralRe: XSL HTML table and matching tags problem Pin
DavidNohejl2-Jun-05 7:33
DavidNohejl2-Jun-05 7:33 
QuestionHow to remove node Pin
mathuros_paiboon1-Jun-05 15:38
mathuros_paiboon1-Jun-05 15:38 
Hi
I want to delete node from xml file
this is example of xml file

<audit_list>
<control_type>xxx
<control_group group="xxx1">
<control_sub_group sub_group="yyy1">
<activity>
<control_activity>zzzz</control_activity>
<comment>large</comment>
</activity>
</control_sub_group>
<control_sub_group sub_group="xxx2">
<activity>
<control_activity>ccccc</control_activity>
<comment>medium</comment>
</activity>
<activity>
<control_activity>bbbb</control_activity>
<comment>large</comment>
</activity>
</control_sub_group>
<control_group group = "xxx2">
<control_sub_grop sub_group = "">
.....



this is my command to delete node but I get some error that I can't solv
please help me?
I want to delete node <activity> which have text of <control_activity> = ........ (get from user)


Dim listname As String
If rdo_type1.Checked Then
listname = "audit_list.xml"
ElseIf rdo_type2.Checked Then
listname = "audit_list_application.xml"
End If
'==============
Dim objdomdocument, objxmldomnode, objelement, strxpath, objCurrNode
objdomdocument = CreateObject("Microsoft.XMLDOM")
objdomdocument.async = False
objdomdocument.load(Server.MapPath(listname))

'==========
objCurrNode = objdomdocument.documentelement.firstchild
'==========
strxpath = "audit_list/control_type/control_group[@group = '" + lst_group.SelectedItem.Text.ToString() + "']/control_sub_group[@sub_group = '" + lst_subgroup.SelectedItem.Text.ToString() + "']/control_activity/activity"

objelement = objdomdocument.selectSingleNode(strxpath)

Dim i As Integer
Dim t_attribute As String
Dim x_text As String
Dim j As Integer
Dim x_nodelist
Dim a As Integer
For i = 1 To 50
t_attribute = objCurrNode.childnodes(i).getattribute("group")
If t_attribute = lst_group.SelectedItem.Text.ToString() Then
objCurrNode = objCurrNode.childnodes(i)
For j = 1 To 50
x_nodelist = objCurrNode.childnodes(j).getelementsbytagname("control_activity")
For a = 0 To x_nodelist.length
x_text = x_nodelist.item(a).firstchild.nodevalue
If x_text = lst_activity.SelectedItem.Text.ToString() Then
objCurrNode.childnodes(j).childnodes.item(a).removechild(objelement)
Exit For
End If
Next
Next
End If
Next
objdomdocument.save(Server.MapPath(listname))

thank you.

AnswerRe: How to remove node Pin
Christian Graus1-Jun-05 15:46
protectorChristian Graus1-Jun-05 15:46 
GeneralRe: How to remove node Pin
mathuros_paiboon1-Jun-05 16:27
mathuros_paiboon1-Jun-05 16:27 
GeneralRe: How to remove node Pin
Christian Graus1-Jun-05 16:42
protectorChristian Graus1-Jun-05 16:42 
GeneralRe: How to remove node Pin
mathuros_paiboon1-Jun-05 17:02
mathuros_paiboon1-Jun-05 17:02 
GeneralRe: How to remove node Pin
Christian Graus1-Jun-05 17:07
protectorChristian Graus1-Jun-05 17:07 
GeneralRe: How to remove node Pin
mathuros_paiboon1-Jun-05 17:44
mathuros_paiboon1-Jun-05 17:44 
GeneralRe: How to remove node Pin
Christian Graus1-Jun-05 17:52
protectorChristian Graus1-Jun-05 17:52 
GeneralRe: How to remove node Pin
mathuros_paiboon1-Jun-05 18:32
mathuros_paiboon1-Jun-05 18:32 
AnswerRe: How to remove node Pin
niansah3-Jun-05 6:41
niansah3-Jun-05 6:41 
GeneralSImple Problem with XML Pin
CSharpDavid31-May-05 4:47
CSharpDavid31-May-05 4:47 
GeneralRe: SImple Problem with XML Pin
DavidNohejl31-May-05 7:08
DavidNohejl31-May-05 7:08 
GeneralRe: Simple Problem with XML Pin
CSharpDavid31-May-05 7:56
CSharpDavid31-May-05 7:56 
GeneralRe: SImple Problem with XML Pin
Christian Graus31-May-05 12:07
protectorChristian Graus31-May-05 12:07 
GeneralRe: SImple Problem with XML Pin
DavidNohejl31-May-05 12:20
DavidNohejl31-May-05 12:20 
GeneralRe: SImple Problem with XML Pin
Christian Graus31-May-05 12:22
protectorChristian Graus31-May-05 12:22 
GeneralRe: SImple Problem with XML Pin
niansah3-Jun-05 21:37
niansah3-Jun-05 21:37 
Generalworml list style capturing Pin
ramissues30-May-05 19:21
ramissues30-May-05 19:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.