Author Topic: Read XML from a device through a Serial Port  (Read 15583 times)

m_alien

  • Member
  • ***
  • Posts: 3
Read XML from a device through a Serial Port
« on: May 13, 2011, 10:12:10 am »
Anyone have any idea on how to read XML into a vb.net program from a device

My current program can read in a continuous stream of data when initialized and I can send a command to retrieve the devices stored data, I also have within the same program code that will read an XML file and populate from controls.

I have two separate idea's right now that I'm trying to merge into one

I want to read in the XML and populate my controls. I'm aware of delegate and Invoke but I'm having a hard time working them into my XML portion or the opposite "working my XML into my serial port class". I understand this might be the wrong place to ask these questions but i figured i would try.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Read XML from a device through a Serial Port
« Reply #1 on: May 13, 2011, 11:45:44 am »
XML is text. The SerialPort class has methods for reading text from a port. Once the text has been retrieved, the application can do what it wants with the text, but that part has nothing to do with serial ports.

Try a search on:

visual basic convert text xml

Jan

m_alien

  • Member
  • ***
  • Posts: 3
Re: Read XML from a device through a Serial Port
« Reply #2 on: May 13, 2011, 03:05:47 pm »
I understand that, how do i breakup the data coming all in at once into 1 control into multiple controls based on the tags?

thanks for the response

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Read XML from a device through a Serial Port
« Reply #3 on: May 13, 2011, 06:00:50 pm »
Here is a tutorial on string manipulation in VB:

http://msdn.microsoft.com/en-us/library/aa903372%28VS.71%29.aspx

Jan

m_alien

  • Member
  • ***
  • Posts: 3
Re: Read XML from a device through a Serial Port
« Reply #4 on: May 13, 2011, 09:08:20 pm »
O I see, I can see how I could do it this way, I was just thinking if there was a more elegant way to do this, like using a dataset or an array or some kind. Is string munipulation the typical way of doing this? I mean I know there isn't just one way to do something I'm just curious.

Thanks again thou for the link, I've been stuck for a few days getting nowhere, hopefully this will advance me at least a little bit more.

One more question, is there a simulator that you may know of that can send continuous data out and take commands to send responses back, just so I can keep working on this over the weekend.

Thanks Martin

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Read XML from a device through a Serial Port
« Reply #5 on: May 14, 2011, 12:08:59 pm »
After using string functions to parse the incoming data, you can put the elements in a dataset or array. A VB forum might have suggestions.

I have links to serial-port debugging software here:

http://www.lvr.com/serport.htm#software

Jan