5 Replies - 699 Views - Last Post: 27 June 2010 - 05:41 AM Rate Topic: -----

#1 AmpedExport  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 30-May 10

XML File On Server

Posted 26 June 2010 - 04:53 AM

On my personal server, I have an xml file with various data in. Is there anyway in VB.Net to retrieve the relevant data from the XML file and read it into various arrays.

An example of what is in the xml file

<data>
<drivers>
<newDriver id="10" name="Xavier" nat="0" team="5" total="0" dn="12" results=",,,,,"/>
<newDriver id="17" name="James" nat="0" team="9" total="-1" dn="22" results=",,,,,"/>
<newDriver id="18" name="Kevin" nat="3" team="9" total="-1" dn="23" results=",,,,,"/>
<newDriver id="21" name="Tony" nat="0" team="11" total="-1" dn="24" results=",,,,,"/>
<newDriver id="22" name="Peter" nat="0" team="11" total="-1" dn="25" results=",,,,,"/>
<newDriver id="23" name="Jamie" nat="0" team="12" total="-1" dn="20" results=",,,,,"/>
<newDriver id="24" name="Paul" nat="0" team="12" total="-1" dn="21" results=",,,,,"/>
</drivers>
<timeStamp>
<stamp val="TS101">
</timeStamp>
</data>


So basically, how could I store all the drivers data into an array of objects, and then use this data within VB?

Im not looking strictly for code, just an idea of what functions/methods to use and then I should be able to work out the rest on my own.

Is This A Good Question/Topic? 0
  • +

Replies To: XML File On Server

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6064
  • View blog
  • Posts: 23,519
  • Joined: 23-August 08

Re: XML File On Server

Posted 26 June 2010 - 05:38 AM

Your XML is not well-formed (the stamp element is not closed).

XmlSerialization is what you're looking for.
Was This Post Helpful? 0
  • +
  • -

#3 AmpedExport  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 26
  • Joined: 30-May 10

Re: XML File On Server

Posted 26 June 2010 - 08:01 AM

View PostJackOfAllTrades, on 26 June 2010 - 04:38 AM, said:

Your XML is not well-formed (the stamp element is not closed).

XmlSerialization is what you're looking for.


I must admit XML is not my strong point at all, I only had to get it working within a Flash AS2 system.

OK, thanks for the tip, I will do some goooogling.
Was This Post Helpful? 0
  • +
  • -

#4 Guest_t3hc13h*


Reputation:

Re: XML File On Server

Posted 26 June 2010 - 01:19 PM

Also, have a look at the XMLDocument Class. Using XMLSerialization is easy but I find it too be a bit too heavy for most of my projects so I end up accessing my XML docs through the XMLDocument class with the XMlElement and XMLNode classes.
Was This Post Helpful? 0

#5 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2263
  • View blog
  • Posts: 9,467
  • Joined: 29-May 08

Re: XML File On Server

Posted 26 June 2010 - 02:46 PM

Plus there's LINQ to XML
Was This Post Helpful? 0
  • +
  • -

#6 Curtis Rutland  Icon User is online

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 4490
  • View blog
  • Posts: 7,822
  • Joined: 08-June 10

Re: XML File On Server

Posted 27 June 2010 - 05:41 AM

I would also throw my vote in for LINQ to XML. To me, it's easier, especially if you are unfamiliar with XML and the DOM.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1