Hi, Here is code.
Using reader As XmlReader = XmlReader.Create(filenametextbox)
While reader.Read()
' Check for start elements.
If reader.IsStartElement() Then
' Interaction (read attribute example name, initiate)
If reader.Name = "interaction" Then
'Console.WriteLine("Start <interaction> element.")
attr_name = reader("name")
attr_init = reader("initiate")
'If attr_name IsNot Nothing Then
'Console.WriteLine(" Has attribute name: {0}", attr_name)
'ElseIf attr_init IsNot Nothing Then
'Console.WriteLine(" Has attribute name: {0}", attr_init)
'End If
' participate (read attribute example toRole, fromRole)
ElseIf reader.Name = "participate" Then
' Get toRole,fromRole attribute.
attr_toRole = reader("toRole")
attr_fromRole = reader("fromRole")
from_to_role = ngoac1 & attr_fromRole & sym2 & attr_toRole & ngoac2
ElseIf reader.Name = "workunit" Then
wk_guard = reader("guard")
If InStr(1, wk_guard, " or ") > 0 Then
wk_guard_tem = wk_guard.Replace(" or ", hoac)
End If
If InStr(1, wk_guard, " and ") > 0 Then
wk_guard_tem = wk_guard.Replace(" and ", va)
End If
' exchange (read attribute example name)
ElseIf reader.Name = "exchange" Then
attr_name = reader("name")
' send (read attribute example variable)
ElseIf reader.Name = "send" Then
attr_variable_send = reader("variable")
attr_variable_send_tem = Mid(attr_variable_send, 17, Len(attr_variable_send) - 17)
' receive (read attribute example variable)
ElseIf reader.Name = "receive" Then
attr_variable_receive = reader("variable")
attr_variable_receive_tem = Mid(attr_variable_receive, 17, Len(attr_variable_receive) - 17)
End If
Else
If reader.Name = "exchange" And reader.NodeType = XmlNodeType.EndElement Then
End If
End If
End While
End Using
</interaction>