Step over Node in VB.net XML parsing -


i'm trying use xml parsing capabilities of vb.net

here xml returned google's traffic directions api.

enter image description here

my vb.net code total distance value is

returneddistancemeters = returnedxml...<route>...<leg>...<distance>...<value>.value 

but "short cutting" value in first "step" node , giving me 88 want 193108. how avoid jumping first node called "distance" ?

i don't know if there better way. every time have work xml on .net prefer use xsd.exe create class.

http://msdn.microsoft.com/en-us/library/x6c1kb0s(v=vs.110).aspx

after adding .vb file project, can initialize class xml file using function:

private function gettraficfromfile(byval path string) trafic     dim stream new io.streamreader(path)     dim ser new xml.serialization.xmlserializer(gettype(trafic))     dim mytrafic new trafic     mytrafic = ctype(ser.deserialize(stream), trafic)     stream.close()      return mytrafic end function 

you can access xml values normal properties, in case like:

dim mytraffic trafic = gettraficfromfile(path) msgbox(mytraffic.route.leg.step(19).distance) 

Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -