ahbenshaut
Well-known member
Good Day to all.
I am having an interesting time parsing an XML file. Any help would be greatly appreciated. My biggest hurdle is getting node attributes. Here is what I have as an XML example:
<?xml version="1.0" ?>
<ILS_BULK_EXPORT>
<Loan MISMOVersionIdentifier="2.6" E3_ApplicationNumber="1234567890" E3_LoanNumber="0987654321" E3_MapLastUpdated=" 01/01/1900">
<_APPLICATION _ID="somelongnumber">
<_DATA_INFORMATION>
<ADDITIONAL_CASE_DATA>
<TRANSMITTAL_DATA CurrentSomethingOrAnother="blah"
and on and on...
</ILS_BULK_EXPORT>
What I am trying to do is get specific node attributes, E3_ApplicationNumber and E3_LoanNumber, for starters
and my code:
Private Sub ParseFile()
Try
Dim m_xmlDoc As XmlDocument
Dim m_nodeList As XmlNodeList
Dim m_node As XmlNode
m_xmlDoc = New XmlDocument
'm_xmlDoc.Load(txtFileToParse.Text)
m_xmlDoc.Load("C:\Documents and Settings\jmuslin\Desktop\AfterUpgrade.xml")
m_nodeList = m_xmlDoc.DocumentElement.SelectNodes("Loan MISMOVersionIdentifier='2.6' ")
For Each m_node In m_nodeList
MessageBox.Show(m_node.Attributes("E3_ApplicationNumber").Value.ToString)
Next
'm_nodeList = m_xmlDoc.SelectNodes("ILS_BULK_EXPORT/Loan MISMOVersionIdentifier='2.6' ")
'For Each m_node In m_nodeList
' Dim appNumber = m_node.Attributes.GetNamedItem("E3_LoanNumber").Value
' MessageBox.Show(appNumber)
'Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
When I debug the code, I get the following error: 'Loan MISMOVersionIdentifier='2.6' ' has an invalid token. I have no idea what that means...
thank you in advance for the help. May the schwartz be with you!
I am having an interesting time parsing an XML file. Any help would be greatly appreciated. My biggest hurdle is getting node attributes. Here is what I have as an XML example:
<?xml version="1.0" ?>
<ILS_BULK_EXPORT>
<Loan MISMOVersionIdentifier="2.6" E3_ApplicationNumber="1234567890" E3_LoanNumber="0987654321" E3_MapLastUpdated=" 01/01/1900">
<_APPLICATION _ID="somelongnumber">
<_DATA_INFORMATION>
<ADDITIONAL_CASE_DATA>
<TRANSMITTAL_DATA CurrentSomethingOrAnother="blah"
and on and on...
</ILS_BULK_EXPORT>
What I am trying to do is get specific node attributes, E3_ApplicationNumber and E3_LoanNumber, for starters
and my code:
Private Sub ParseFile()
Try
Dim m_xmlDoc As XmlDocument
Dim m_nodeList As XmlNodeList
Dim m_node As XmlNode
m_xmlDoc = New XmlDocument
'm_xmlDoc.Load(txtFileToParse.Text)
m_xmlDoc.Load("C:\Documents and Settings\jmuslin\Desktop\AfterUpgrade.xml")
m_nodeList = m_xmlDoc.DocumentElement.SelectNodes("Loan MISMOVersionIdentifier='2.6' ")
For Each m_node In m_nodeList
MessageBox.Show(m_node.Attributes("E3_ApplicationNumber").Value.ToString)
Next
'm_nodeList = m_xmlDoc.SelectNodes("ILS_BULK_EXPORT/Loan MISMOVersionIdentifier='2.6' ")
'For Each m_node In m_nodeList
' Dim appNumber = m_node.Attributes.GetNamedItem("E3_LoanNumber").Value
' MessageBox.Show(appNumber)
'Next
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
When I debug the code, I get the following error: 'Loan MISMOVersionIdentifier='2.6' ' has an invalid token. I have no idea what that means...
thank you in advance for the help. May the schwartz be with you!