XML from StreamReader vb.net

34 Views Asked by At

I've connected to a REST API and received the data I want using a StreamReader.

sReader = New System.IO.StreamReader(xData.GetResponseStream)

It all works fine now I have to do something with it.

the data comes in a xml file i'm having a total brain fart on dealing with the data.

All I can think is to use xmlreader on sReader using

.name = "timestamp" .name = "datestamp"

into an array where all the indexs should match? And should be all easy to send to SQL

It just seems so easy im sure I have something wrong. Is xml that easy? I havn't worked with it for years, and have a memory of it being a hassle.... Is my memory wrong? Or have I got terrible etiquette at 1am?

I did a couple of tests by using xmlreader to populate it into listboxs, the data integrity looks good. Just seems so simple im sure I must have overlooked a serious problem doing it this way.

<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<new-messages xmlns:ns6=blah blah url xml:ns5... 4... 3... 2>
 <Messages xsi:type=>
  <Timestamp> time </timestamp>
  <Datestamp> Date </datestamp>
 </messages>
 <Messages xsi:type=>
  <Timestamp> time </timestamp>
  <Datestamp> Date </datestamp>
 </messages>
 <Messages xsi:type=>
  <Timestamp> time </timestamp>
  <Datestamp> Date </datestamp>
 </messages>
</new-messages>

I have tried looking for reasons not to use xmlreader

I know xmlreader will work, im just not sure its the "correct" and robust way.

There is other ways I could use like parsing/delimitating. its just a basic app im making to get the data from an API every 60 seconds and filter it into SQL tables

0

There are 0 best solutions below