Ok, here is my issue, i have some code which was written to downlaod an File from an FTP server and then process the XML file. All good for a long time but now the XML file has a Namespace and my code no longer works. Here is the code in question which finds all call nodes and then processes them
Public Shared Function ParseXMLAndSave(ByVal xmlContent As String) As Generic.List(Of CallDetailRecordDataType)
Dim xmlDoc As New XmlDocument
Try
xmlDoc.LoadXml(xmlContent)
Catch ex As Exception
Throw New Exception("Failed to load xml content. " & ex.Message)
End Try
Dim nodes As XmlNodeList = xmlDoc.SelectNodes("File/CDRs/Call")
If nodes.Count = 0 Then Throw New Exception("No data node [File/CDRs/Call] found")
Dim list As New Generic.List(Of CallDetailRecordDataType)
For temp As Integer = 0 To nodes.Count - 1
Try
Dim record As CallDetailRecordDataType = ParseMainNode(nodes(temp))
list.Add(record)
SaveCallRecord(record)
Catch ex As Exception
Trace.WriteLine("Failed to parse node. " & ex.Message)
End Try
Next
Return list
End Function
So what do i need to do to be able to use to find those nodes again after my xml file has now a NameSpace ?
The Namespace looks like this in the XML Doc
<File xmlns="http://www.metaswitch.com/cfs/billing/V1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" compatibility="2">