JABOSL
Programmer
- Jan 25, 2006
- 35
Can someone help me figure out why this isn't working? I always get the exception "The data at the root level is invalid. Line 1, position 1." on the doc.loadxml line.
Here's what I'm reading. I've tried it with out the first (?xml...) line too but it still gives me the error.
<?xml version="1.0" encoding="UTF-8"?>
<request>
<sequence_number>000002</sequence_number>
<account_number>103363463355</account_number>
<response_fields>
<reply_code>201</reply_code>
</response_fields>
</request>
Code:
Dim doc As Xml.XmlDocument = New Xml.XmlDocument
Dim reader As New Xml.XmlTextReader("c:\test.xml")
Try
doc.LoadXml(reader.Read)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Here's what I'm reading. I've tried it with out the first (?xml...) line too but it still gives me the error.
<?xml version="1.0" encoding="UTF-8"?>
<request>
<sequence_number>000002</sequence_number>
<account_number>103363463355</account_number>
<response_fields>
<reply_code>201</reply_code>
</response_fields>
</request>