473,799 Members | 3,382 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i read the nodes of this file in asp.net???

hi there,

i have an xml file, but am not too sure how to read all these elements using
vb.net code.

any help would be greatly appreciated:))
<---------CODE--------------->

<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<CurrentConditi ons>
<country>Albani a</country>
<city>Tirana</city>
<weatherImageUR L>cloudy.gif</weatherImageURL >
<celcius>14°C </celcius>
<farenheit>57°F </farenheit>
<description>Pa rtly Cloudy</description>
<relativeHumidi ty>61%</relativeHumidit y>
<wind>WSW at 10 mph (16 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>4:36 PM</sunset>
<barometricPres sure>26.1Hg (F)</barometricPress ure>
<lastUpdated> 15/01/2004 13:21:14</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Thursday </day>
<highCelcius>14 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 58°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day1>
<Day2>
<day>Friday</day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 4°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day2>
<Day3>
<day>Saturday </day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day3>
<Day4>
<day>Sunday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-1°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>3 1°F</lowFarenheit>
<imageURL>rain. gif</imageURL>
</Day4>
<Day5>
<day>Monday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-4°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>2 4°F</lowFarenheit>
<imageURL>snow. gif</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>
<---------CODE--------------->

thanks in advance,
PM
Nov 12 '05 #1
6 1560
Hi Paul,

The following is one way (of many ways) you can get at the elements in your
document. I find this way easy to follow and I'm sure there are more
elegant ways of accomplishing the same end result.

1. You can use the xmldocument class to load in your xml document. This
class exists in system in the system.xml namespace.
e.g. Dim myXMLDoc as new xmldocument()

Try
myXMLDoc.load(< path and filename of your xml document>

Catch
....

2. Declare the following xmlelement types
Dim xe_CurrentCondi tions as XMLElement
Dim xe_CurrentCondi tionsChild As XMLElement
Dim xe_FiveDayForec ast as XMLElement
Dim xe_FiveDayForec astDay as XMLElement
Dim xe_FiveDayForec astDayDetails as XMLElement

3. Set your elements by doing the following

xe_CurrentCondi tions =
myXMLDoc.Select SingleNode("/weatherFeed/CurrentConditio ns") ' The string
in the function is an xpath expression

' this is extremely important to get familiar with when working with

' xml documents ALSO XML and XPath ARE CASE SENSTIVE AS WELL
4. You can cycle through your xe_CurrentCondi tions by using the following
loop

For Each xe_CurrentCondi tionsChild in xe_CurrentCondi tions.childNode s
Dim strThisElementN ame as String
Dim strThisElementV alue as String

strThisElementN ame = xe_CurrentCondi tionsChild.Name ' Should
yield country this 1st time thru your loop
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText '
Should Albania 1st time thru
Next

5. You can cycle through your FiveDayForecast by doing the same thing by
using a nested For Each and getting your

xe_FiveDayForec ast =
myXMLDoc.Select SingleNode("wea therFeed/CurrentConditio ns/fiveDayForecast ")

For Each xe_FiveDayForec astDay in xe_xe_FiveDayFo recast.ChildNod es
' the elemnt name of xe_FiveDayForec astDay will be Day1 the first
time thru, Day2 the 2nd time thru...
For Each xe_FiveDayForec astDayDetails in
xe_FiveDayForec astDay.ChildNod es
Dim strThisElementN ame as String
Dim strThisElementV alue as String

' This will let you cycle through each <day>
<highCelius><lo wCelius> elements You can use them as you see fit.
strThisElementN ame = xe_CurrentCondi tionsChild.Name '
element name is
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText
Next
Next

I hope this helps.

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:uP******** ******@tk2msftn gp13.phx.gbl...
hi there,

i have an xml file, but am not too sure how to read all these elements using vb.net code.

any help would be greatly appreciated:))
<---------CODE--------------->

<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<CurrentConditi ons>
<country>Albani a</country>
<city>Tirana</city>
<weatherImageUR L>cloudy.gif</weatherImageURL >
<celcius>14°C </celcius>
<farenheit>57°F </farenheit>
<description>Pa rtly Cloudy</description>
<relativeHumidi ty>61%</relativeHumidit y>
<wind>WSW at 10 mph (16 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>4:36 PM</sunset>
<barometricPres sure>26.1Hg (F)</barometricPress ure>
<lastUpdated> 15/01/2004 13:21:14</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Thursday </day>
<highCelcius>14 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 58°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day1>
<Day2>
<day>Friday</day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 4°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day2>
<Day3>
<day>Saturday </day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day3>
<Day4>
<day>Sunday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-1°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>3 1°F</lowFarenheit>
<imageURL>rain. gif</imageURL>
</Day4>
<Day5>
<day>Monday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-4°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>2 4°F</lowFarenheit>
<imageURL>snow. gif</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>
<---------CODE--------------->

thanks in advance,
PM

Nov 12 '05 #2
thanks heaps!!!

this looks like an excellent example. i'll get right onto it and hope to get
it working soon.

regards,
Paul.

"Larry Rubin" <ru****@aeltus. com> wrote in message
news:eA******** ******@TK2MSFTN GP11.phx.gbl...
Hi Paul,

The following is one way (of many ways) you can get at the elements in your document. I find this way easy to follow and I'm sure there are more
elegant ways of accomplishing the same end result.

1. You can use the xmldocument class to load in your xml document. This
class exists in system in the system.xml namespace.
e.g. Dim myXMLDoc as new xmldocument()

Try
myXMLDoc.load(< path and filename of your xml document>

Catch
....

2. Declare the following xmlelement types
Dim xe_CurrentCondi tions as XMLElement
Dim xe_CurrentCondi tionsChild As XMLElement
Dim xe_FiveDayForec ast as XMLElement
Dim xe_FiveDayForec astDay as XMLElement
Dim xe_FiveDayForec astDayDetails as XMLElement

3. Set your elements by doing the following

xe_CurrentCondi tions =
myXMLDoc.Select SingleNode("/weatherFeed/CurrentConditio ns") ' The string in the function is an xpath expression

' this is extremely important to get familiar with when working with

' xml documents ALSO XML and XPath ARE CASE SENSTIVE AS WELL
4. You can cycle through your xe_CurrentCondi tions by using the following
loop

For Each xe_CurrentCondi tionsChild in xe_CurrentCondi tions.childNode s
Dim strThisElementN ame as String
Dim strThisElementV alue as String

strThisElementN ame = xe_CurrentCondi tionsChild.Name ' Should
yield country this 1st time thru your loop
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText '
Should Albania 1st time thru
Next

5. You can cycle through your FiveDayForecast by doing the same thing by
using a nested For Each and getting your

xe_FiveDayForec ast =
myXMLDoc.Select SingleNode("wea therFeed/CurrentConditio ns/fiveDayForecast ")

For Each xe_FiveDayForec astDay in xe_xe_FiveDayFo recast.ChildNod es
' the elemnt name of xe_FiveDayForec astDay will be Day1 the first time thru, Day2 the 2nd time thru...
For Each xe_FiveDayForec astDayDetails in
xe_FiveDayForec astDay.ChildNod es
Dim strThisElementN ame as String
Dim strThisElementV alue as String

' This will let you cycle through each <day>
<highCelius><lo wCelius> elements You can use them as you see fit.
strThisElementN ame = xe_CurrentCondi tionsChild.Name '
element name is
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText
Next
Next

I hope this helps.

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:uP******** ******@tk2msftn gp13.phx.gbl...
hi there,

i have an xml file, but am not too sure how to read all these elements

using
vb.net code.

any help would be greatly appreciated:))
<---------CODE--------------->

<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<CurrentConditi ons>
<country>Albani a</country>
<city>Tirana</city>
<weatherImageUR L>cloudy.gif</weatherImageURL >
<celcius>14°C </celcius>
<farenheit>57°F </farenheit>
<description>Pa rtly Cloudy</description>
<relativeHumidi ty>61%</relativeHumidit y>
<wind>WSW at 10 mph (16 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>4:36 PM</sunset>
<barometricPres sure>26.1Hg (F)</barometricPress ure>
<lastUpdated> 15/01/2004 13:21:14</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Thursday </day>
<highCelcius>14 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 58°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day1>
<Day2>
<day>Friday</day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 4°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day2>
<Day3>
<day>Saturday </day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day3>
<Day4>
<day>Sunday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-1°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>3 1°F</lowFarenheit>
<imageURL>rain. gif</imageURL>
</Day4>
<Day5>
<day>Monday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-4°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>2 4°F</lowFarenheit>
<imageURL>snow. gif</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>
<---------CODE--------------->

thanks in advance,
PM


Nov 12 '05 #3
actually, just one more thing.

the CurrentConditio ns tag, may appear multiple times depending on how many
cities there are for that country.
Is this also easy to implement?

thanks again for your valuable help.

Paul.

"Larry Rubin" <ru****@aeltus. com> wrote in message
news:eA******** ******@TK2MSFTN GP11.phx.gbl...
Hi Paul,

The following is one way (of many ways) you can get at the elements in your document. I find this way easy to follow and I'm sure there are more
elegant ways of accomplishing the same end result.

1. You can use the xmldocument class to load in your xml document. This
class exists in system in the system.xml namespace.
e.g. Dim myXMLDoc as new xmldocument()

Try
myXMLDoc.load(< path and filename of your xml document>

Catch
....

2. Declare the following xmlelement types
Dim xe_CurrentCondi tions as XMLElement
Dim xe_CurrentCondi tionsChild As XMLElement
Dim xe_FiveDayForec ast as XMLElement
Dim xe_FiveDayForec astDay as XMLElement
Dim xe_FiveDayForec astDayDetails as XMLElement

3. Set your elements by doing the following

xe_CurrentCondi tions =
myXMLDoc.Select SingleNode("/weatherFeed/CurrentConditio ns") ' The string in the function is an xpath expression

' this is extremely important to get familiar with when working with

' xml documents ALSO XML and XPath ARE CASE SENSTIVE AS WELL
4. You can cycle through your xe_CurrentCondi tions by using the following
loop

For Each xe_CurrentCondi tionsChild in xe_CurrentCondi tions.childNode s
Dim strThisElementN ame as String
Dim strThisElementV alue as String

strThisElementN ame = xe_CurrentCondi tionsChild.Name ' Should
yield country this 1st time thru your loop
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText '
Should Albania 1st time thru
Next

5. You can cycle through your FiveDayForecast by doing the same thing by using a nested For Each and getting your

xe_FiveDayForec ast =
myXMLDoc.Select SingleNode("wea therFeed/CurrentConditio ns/fiveDayForecast ")

For Each xe_FiveDayForec astDay in xe_xe_FiveDayFo recast.ChildNod es
' the elemnt name of xe_FiveDayForec astDay will be Day1 the first time thru, Day2 the 2nd time thru...
For Each xe_FiveDayForec astDayDetails in
xe_FiveDayForec astDay.ChildNod es
Dim strThisElementN ame as String
Dim strThisElementV alue as String

' This will let you cycle through each <day>
<highCelius><lo wCelius> elements You can use them as you see fit.
strThisElementN ame = xe_CurrentCondi tionsChild.Name '
element name is
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText
Next
Next

I hope this helps.

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:uP******** ******@tk2msftn gp13.phx.gbl...
hi there,

i have an xml file, but am not too sure how to read all these elements

using
vb.net code.

any help would be greatly appreciated:))
<---------CODE--------------->

<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<CurrentConditi ons>
<country>Albani a</country>
<city>Tirana</city>
<weatherImageUR L>cloudy.gif</weatherImageURL >
<celcius>14°C </celcius>
<farenheit>57°F </farenheit>
<description>Pa rtly Cloudy</description>
<relativeHumidi ty>61%</relativeHumidit y>
<wind>WSW at 10 mph (16 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>4:36 PM</sunset>
<barometricPres sure>26.1Hg (F)</barometricPress ure>
<lastUpdated> 15/01/2004 13:21:14</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Thursday </day>
<highCelcius>14 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 58°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day1>
<Day2>
<day>Friday</day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 4°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day2>
<Day3>
<day>Saturday </day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day3>
<Day4>
<day>Sunday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-1°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>3 1°F</lowFarenheit>
<imageURL>rain. gif</imageURL>
</Day4>
<Day5>
<day>Monday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-4°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>2 4°F</lowFarenheit>
<imageURL>snow. gif</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>
<---------CODE--------------->

thanks in advance,
PM


Nov 12 '05 #4
Paul, I'm glad the example will be of help to you.

In the case of the <CurrentConditi ons> tag appearing multiple times, you
would establish a For Each loop on a xe_WeatherFeed element.

For example, xe_WeatherFeed = myXMLDoc.Select SingleNode("/weatherFeed")

' This loop would be the outermost loop in the code example below.
For Each xe_CurrentCondi tion in xeWeatherFeed.C hildNodes

' The 1st time through would be for your first city, the 2nd time
through would be your 2nd city... etc.

Next

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:eX******** ******@TK2MSFTN GP10.phx.gbl...
actually, just one more thing.

the CurrentConditio ns tag, may appear multiple times depending on how many
cities there are for that country.
Is this also easy to implement?

thanks again for your valuable help.

Paul.

"Larry Rubin" <ru****@aeltus. com> wrote in message
news:eA******** ******@TK2MSFTN GP11.phx.gbl...
Hi Paul,

The following is one way (of many ways) you can get at the elements in your
document. I find this way easy to follow and I'm sure there are more
elegant ways of accomplishing the same end result.

1. You can use the xmldocument class to load in your xml document. This class exists in system in the system.xml namespace.
e.g. Dim myXMLDoc as new xmldocument()

Try
myXMLDoc.load(< path and filename of your xml document>

Catch
....

2. Declare the following xmlelement types
Dim xe_CurrentCondi tions as XMLElement
Dim xe_CurrentCondi tionsChild As XMLElement
Dim xe_FiveDayForec ast as XMLElement
Dim xe_FiveDayForec astDay as XMLElement
Dim xe_FiveDayForec astDayDetails as XMLElement

3. Set your elements by doing the following

xe_CurrentCondi tions =
myXMLDoc.Select SingleNode("/weatherFeed/CurrentConditio ns") ' The

string
in the function is an xpath expression

' this is extremely important to get familiar with when working with

' xml documents ALSO XML and XPath ARE CASE SENSTIVE AS WELL
4. You can cycle through your xe_CurrentCondi tions by using the following loop

For Each xe_CurrentCondi tionsChild in xe_CurrentCondi tions.childNode s
Dim strThisElementN ame as String
Dim strThisElementV alue as String

strThisElementN ame = xe_CurrentCondi tionsChild.Name ' Should yield country this 1st time thru your loop
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText ' Should Albania 1st time thru
Next

5. You can cycle through your FiveDayForecast by doing the same thing by
using a nested For Each and getting your

xe_FiveDayForec ast =

myXMLDoc.Select SingleNode("wea therFeed/CurrentConditio ns/fiveDayForecast ")
For Each xe_FiveDayForec astDay in xe_xe_FiveDayFo recast.ChildNod es
' the elemnt name of xe_FiveDayForec astDay will be Day1 the

first
time thru, Day2 the 2nd time thru...
For Each xe_FiveDayForec astDayDetails in
xe_FiveDayForec astDay.ChildNod es
Dim strThisElementN ame as String
Dim strThisElementV alue as String

' This will let you cycle through each <day>
<highCelius><lo wCelius> elements You can use them as you see fit.
strThisElementN ame = xe_CurrentCondi tionsChild.Name '
element name is
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText
Next
Next

I hope this helps.

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:uP******** ******@tk2msftn gp13.phx.gbl...
hi there,

i have an xml file, but am not too sure how to read all these elements

using
vb.net code.

any help would be greatly appreciated:))
<---------CODE--------------->

<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<CurrentConditi ons>
<country>Albani a</country>
<city>Tirana</city>
<weatherImageUR L>cloudy.gif</weatherImageURL >
<celcius>14°C </celcius>
<farenheit>57°F </farenheit>
<description>Pa rtly Cloudy</description>
<relativeHumidi ty>61%</relativeHumidit y>
<wind>WSW at 10 mph (16 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>4:36 PM</sunset>
<barometricPres sure>26.1Hg (F)</barometricPress ure>
<lastUpdated> 15/01/2004 13:21:14</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Thursday </day>
<highCelcius>14 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 58°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day1>
<Day2>
<day>Friday</day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 4°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day2>
<Day3>
<day>Saturday </day>
<highCelcius>11 °C</highCelcius>
<lowCelcius>1°C </lowCelcius>
<highFarenheit> 51°F</highFarenheit>
<lowFarenheit>3 3°F</lowFarenheit>
<imageURL>cloud y.gif</imageURL>
</Day3>
<Day4>
<day>Sunday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-1°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>3 1°F</lowFarenheit>
<imageURL>rain. gif</imageURL>
</Day4>
<Day5>
<day>Monday</day>
<highCelcius>9° C</highCelcius>
<lowCelcius>-4°C</lowCelcius>
<highFarenheit> 49°F</highFarenheit>
<lowFarenheit>2 4°F</lowFarenheit>
<imageURL>snow. gif</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>
<---------CODE--------------->

thanks in advance,
PM



Nov 12 '05 #5
Larry,

i've added the external loop to loop through the cities in the XML file, and
in one example, it finds the nine cities but it displays the first one nine
times. I'm sure its something minor but i just cant seem to figure it out.

here is the XML, and source code below:

--------------------XML---------------------
<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<!--Current Weather Conditions - taken from CNN.com Weather website.
(16/01/2004 12:43:26)-->
<CurrentConditi ons>
<!--URL: http://weather.cnn.com/weather/forecast.jsp?lo cCode=TNCA-->
<country>Arub a</country>
<city>Oranjesta d</city>

<weatherImageUR L>http://i.cnn.net/cnn/.element/img/1..../lrg/partly.su
nny.gif</weatherImageURL >
<celcius>25°C </celcius>
<farenheit>77°F </farenheit>
<description>Pa rtly Sunny</description>
<relativeHumidi ty>88%</relativeHumidit y>
<wind>E at 2 mph (3 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>6:34 PM</sunset>
<barometricPres sure>29.89Hg (F)</barometricPress ure>
<lastUpdated> 16/01/2004 12:43:38</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Friday</day>
<highCelcius>30 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 86°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>htt p://i.cnn.net/cnn/.element/img/1.0/weather/med/showers.gif</ima
geURL>
</Day1>
<Day2>
<day>Saturday </day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day2>
<Day3>
<day>Sunday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day3>
<Day4>
<day>Monday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 6°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day4>
<Day5>
<day>Tuesday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
<CurrentConditi ons>
<!--URL: http://weather.cnn.com/weather/forecast.jsp?lo cCode=NUSN-->
<country>Arub a</country>
<city>St. Nicolaas</city>

<weatherImageUR L>http://i.cnn.net/cnn/.element/img/1..../lrg/partly.su
nny.gif</weatherImageURL >
<celcius>25°C </celcius>
<farenheit>77°F </farenheit>
<description>Pa rtly Sunny</description>
<relativeHumidi ty>88%</relativeHumidit y>
<wind>E at 2 mph (3 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>6:34 PM</sunset>
<barometricPres sure>29.89Hg (F)</barometricPress ure>
<lastUpdated> 16/01/2004 12:44:10</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Friday</day>
<highCelcius>30 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 86°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>htt p://i.cnn.net/cnn/.element/img/1.0/weather/med/showers.gif</ima
geURL>
</Day1>
<Day2>
<day>Saturday </day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day2>
<Day3>
<day>Sunday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day3>
<Day4>
<day>Monday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 6°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day4>
<Day5>
<day>Tuesday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>

----------------SOURCE CODE-----------------
Dim xDoc As New XmlDocument
Dim xe_weatherFeed As XmlElement
Dim xe_city As XmlNode
Dim xe_currentCondi tions As XmlElement
Dim xe_currentCondi tionsChild As XmlNode
Dim xe_fiveDayForec ast As XmlElement
Dim xe_fiveDayForec astDay As XmlElement
Dim xe_fiveDayForec astDayDetails As XmlNode

Try
Dim a() As String
Dim al As New ArrayList
Dim i As Integer

xDoc.Load(strBa seURL & "weather/" &
Request.QuerySt ring("countryID ") & ".xml")
xe_weatherFeed = xDoc.SelectSing leNode("/weatherFeed")
xe_city = xDoc.SelectSing leNode("/weatherFeed/city")
xe_currentCondi tions =
xDoc.SelectSing leNode("/weatherFeed/city/currentConditio ns")
xe_fiveDayForec ast =
xDoc.SelectSing leNode("/weatherFeed/city/fiveDayForecast ")

For Each xe_city In xe_weatherFeed. ChildNodes
If xe_city.NodeTyp e = XmlNodeType.Ele ment Then
ReDim Preserve a(41)
i = 0
For Each xe_currentCondi tionsChild In
xe_currentCondi tions.ChildNode s
If xe_currentCondi tionsChild.Node Type =
XmlNodeType.Ele ment Then
a(i) = xe_currentCondi tionsChild.Inne rText
i += 1
End If
Next

For Each xe_fiveDayForec astDay In xe_fiveDayForec ast
For Each xe_fiveDayForec astDayDetails In
xe_fiveDayForec astDay
If xe_fiveDayForec astDayDetails.N odeType =
XmlNodeType.Ele ment Then
a(i) =
xe_fiveDayForec astDayDetails.I nnerText
i += 1
End If
Next
Next
al.Add(a)
End If
Next
weatherRepeater .DataSource = al
weatherRepeater .DataBind()
Catch err As Exception
Response.Write( "<br><font color=red><b>" & err.Message &
"</b></font>")
Finally
xDoc = Nothing
End Try

thanks again for your help.

regards,
Paul.

"Larry Rubin" <ru****@aeltus. com> wrote in message
news:u0******** ******@tk2msftn gp13.phx.gbl...
Paul, I'm glad the example will be of help to you.

In the case of the <CurrentConditi ons> tag appearing multiple times, you
would establish a For Each loop on a xe_WeatherFeed element.

For example, xe_WeatherFeed = myXMLDoc.Select SingleNode("/weatherFeed")

' This loop would be the outermost loop in the code example below.
For Each xe_CurrentCondi tion in xeWeatherFeed.C hildNodes

' The 1st time through would be for your first city, the 2nd time
through would be your 2nd city... etc.

Next

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:eX******** ******@TK2MSFTN GP10.phx.gbl...
actually, just one more thing.

the CurrentConditio ns tag, may appear multiple times depending on how many
cities there are for that country.
Is this also easy to implement?

thanks again for your valuable help.

Paul.

"Larry Rubin" <ru****@aeltus. com> wrote in message
news:eA******** ******@TK2MSFTN GP11.phx.gbl...
Hi Paul,

The following is one way (of many ways) you can get at the elements in

your
document. I find this way easy to follow and I'm sure there are more
elegant ways of accomplishing the same end result.

1. You can use the xmldocument class to load in your xml document.

This class exists in system in the system.xml namespace.
e.g. Dim myXMLDoc as new xmldocument()

Try
myXMLDoc.load(< path and filename of your xml document>

Catch
....

2. Declare the following xmlelement types
Dim xe_CurrentCondi tions as XMLElement
Dim xe_CurrentCondi tionsChild As XMLElement
Dim xe_FiveDayForec ast as XMLElement
Dim xe_FiveDayForec astDay as XMLElement
Dim xe_FiveDayForec astDayDetails as XMLElement

3. Set your elements by doing the following

xe_CurrentCondi tions =
myXMLDoc.Select SingleNode("/weatherFeed/CurrentConditio ns") ' The

string
in the function is an xpath expression

' this is extremely important to get familiar with when working with

' xml documents ALSO XML and XPath ARE CASE SENSTIVE AS WELL
4. You can cycle through your xe_CurrentCondi tions by using the following loop

For Each xe_CurrentCondi tionsChild in xe_CurrentCondi tions.childNode s
Dim strThisElementN ame as String
Dim strThisElementV alue as String

strThisElementN ame = xe_CurrentCondi tionsChild.Name ' Should yield country this 1st time thru your loop
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText ' Should Albania 1st time thru
Next

5. You can cycle through your FiveDayForecast by doing the same thing by
using a nested For Each and getting your

xe_FiveDayForec ast =

myXMLDoc.Select SingleNode("wea therFeed/CurrentConditio ns/fiveDayForecast ")
For Each xe_FiveDayForec astDay in xe_xe_FiveDayFo recast.ChildNod es
' the elemnt name of xe_FiveDayForec astDay will be Day1 the

first
time thru, Day2 the 2nd time thru...
For Each xe_FiveDayForec astDayDetails in
xe_FiveDayForec astDay.ChildNod es
Dim strThisElementN ame as String
Dim strThisElementV alue as String

' This will let you cycle through each <day>
<highCelius><lo wCelius> elements You can use them as you see fit.
strThisElementN ame = xe_CurrentCondi tionsChild.Name '
element name is
strThisElementV alue = xe_CurrentCondi tionsChild.Inne rText
Next
Next

I hope this helps.

Larry R

"Paul M" <mi******@hotma il.com> wrote in message
news:uP******** ******@tk2msftn gp13.phx.gbl...
> hi there,
>
> i have an xml file, but am not too sure how to read all these elements using
> vb.net code.
>
> any help would be greatly appreciated:))
> <---------CODE--------------->
>
> <?xml version="1.0" encoding="utf-8"?>
> <weatherFeed>
> <CurrentConditi ons>
> <country>Albani a</country>
> <city>Tirana</city>
> <weatherImageUR L>cloudy.gif</weatherImageURL >
> <celcius>14°C </celcius>
> <farenheit>57°F </farenheit>
> <description>Pa rtly Cloudy</description>
> <relativeHumidi ty>61%</relativeHumidit y>
> <wind>WSW at 10 mph (16 km/h)</wind>
> <sunrise>7:05 AM</sunrise>
> <sunset>4:36 PM</sunset>
> <barometricPres sure>26.1Hg (F)</barometricPress ure>
> <lastUpdated> 15/01/2004 13:21:14</lastUpdated>
> <!--5 Day Weather Forecast-->
> <fiveDayForecas t>
> <Day1>
> <day>Thursday </day>
> <highCelcius>14 °C</highCelcius>
> <lowCelcius>1°C </lowCelcius>
> <highFarenheit> 58°F</highFarenheit>
> <lowFarenheit>3 3°F</lowFarenheit>
> <imageURL>cloud y.gif</imageURL>
> </Day1>
> <Day2>
> <day>Friday</day>
> <highCelcius>11 °C</highCelcius>
> <lowCelcius>1°C </lowCelcius>
> <highFarenheit> 51°F</highFarenheit>
> <lowFarenheit>3 4°F</lowFarenheit>
> <imageURL>cloud y.gif</imageURL>
> </Day2>
> <Day3>
> <day>Saturday </day>
> <highCelcius>11 °C</highCelcius>
> <lowCelcius>1°C </lowCelcius>
> <highFarenheit> 51°F</highFarenheit>
> <lowFarenheit>3 3°F</lowFarenheit>
> <imageURL>cloud y.gif</imageURL>
> </Day3>
> <Day4>
> <day>Sunday</day>
> <highCelcius>9° C</highCelcius>
> <lowCelcius>-1°C</lowCelcius>
> <highFarenheit> 49°F</highFarenheit>
> <lowFarenheit>3 1°F</lowFarenheit>
> <imageURL>rain. gif</imageURL>
> </Day4>
> <Day5>
> <day>Monday</day>
> <highCelcius>9° C</highCelcius>
> <lowCelcius>-4°C</lowCelcius>
> <highFarenheit> 49°F</highFarenheit>
> <lowFarenheit>2 4°F</lowFarenheit>
> <imageURL>snow. gif</imageURL>
> </Day5>
> </fiveDayForecast >
> </CurrentConditio ns>
> </weatherFeed>
> <---------CODE--------------->
>
> thanks in advance,
> PM
>
>



Nov 12 '05 #6
xe_currentCondi tions =
xDoc.SelectSing leNode("/weatherFeed/city/currentConditio ns")

is your problem, you need to create a NodeList for the list of
conditions, then you For Each through the NodeList, extracting every
XmlNode.

xnl_currentCond itions =
xDoc.SelectNode ("/weatherFeed/city/currentConditio ns")
foreach (XmlElement xe_condition in xnl_currentCond itions)
{
// do stuff here
}
Paul M wrote:
Larry,

i've added the external loop to loop through the cities in the XML file, and
in one example, it finds the nine cities but it displays the first one nine
times. I'm sure its something minor but i just cant seem to figure it out.

here is the XML, and source code below:

--------------------XML---------------------
<?xml version="1.0" encoding="utf-8"?>
<weatherFeed>
<!--Current Weather Conditions - taken from CNN.com Weather website.
(16/01/2004 12:43:26)-->
<CurrentConditi ons>
<!--URL: http://weather.cnn.com/weather/forecast.jsp?lo cCode=TNCA-->
<country>Arub a</country>
<city>Oranjesta d</city>

<weatherImageUR L>http://i.cnn.net/cnn/.element/img/1..../lrg/partly.su
nny.gif</weatherImageURL >
<celcius>25°C </celcius>
<farenheit>77°F </farenheit>
<description>Pa rtly Sunny</description>
<relativeHumidi ty>88%</relativeHumidit y>
<wind>E at 2 mph (3 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>6:34 PM</sunset>
<barometricPres sure>29.89Hg (F)</barometricPress ure>
<lastUpdated> 16/01/2004 12:43:38</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Friday</day>
<highCelcius>30 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 86°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>htt p://i.cnn.net/cnn/.element/img/1.0/weather/med/showers.gif</ima
geURL>
</Day1>
<Day2>
<day>Saturday </day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day2>
<Day3>
<day>Sunday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day3>
<Day4>
<day>Monday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 6°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day4>
<Day5>
<day>Tuesday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
<CurrentConditi ons>
<!--URL: http://weather.cnn.com/weather/forecast.jsp?lo cCode=NUSN-->
<country>Arub a</country>
<city>St. Nicolaas</city>

<weatherImageUR L>http://i.cnn.net/cnn/.element/img/1..../lrg/partly.su
nny.gif</weatherImageURL >
<celcius>25°C </celcius>
<farenheit>77°F </farenheit>
<description>Pa rtly Sunny</description>
<relativeHumidi ty>88%</relativeHumidit y>
<wind>E at 2 mph (3 km/h)</wind>
<sunrise>7:05 AM</sunrise>
<sunset>6:34 PM</sunset>
<barometricPres sure>29.89Hg (F)</barometricPress ure>
<lastUpdated> 16/01/2004 12:44:10</lastUpdated>
<!--5 Day Weather Forecast-->
<fiveDayForecas t>
<Day1>
<day>Friday</day>
<highCelcius>30 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 86°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>htt p://i.cnn.net/cnn/.element/img/1.0/weather/med/showers.gif</ima
geURL>
</Day1>
<Day2>
<day>Saturday </day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day2>
<Day3>
<day>Sunday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day3>
<Day4>
<day>Monday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 6°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day4>
<Day5>
<day>Tuesday</day>
<highCelcius>29 °C</highCelcius>
<lowCelcius>24° C</lowCelcius>
<highFarenheit> 85°F</highFarenheit>
<lowFarenheit>7 5°F</lowFarenheit>

<imageURL>http://i.cnn.net/cnn/.element/img/1....rtly.cloudy.gi
f</imageURL>
</Day5>
</fiveDayForecast >
</CurrentConditio ns>
</weatherFeed>

----------------SOURCE CODE-----------------
Dim xDoc As New XmlDocument
Dim xe_weatherFeed As XmlElement
Dim xe_city As XmlNode
Dim xe_currentCondi tions As XmlElement
Dim xe_currentCondi tionsChild As XmlNode
Dim xe_fiveDayForec ast As XmlElement
Dim xe_fiveDayForec astDay As XmlElement
Dim xe_fiveDayForec astDayDetails As XmlNode

Try
Dim a() As String
Dim al As New ArrayList
Dim i As Integer

xDoc.Load(strBa seURL & "weather/" &
Request.QuerySt ring("countryID ") & ".xml")
xe_weatherFeed = xDoc.SelectSing leNode("/weatherFeed")
xe_city = xDoc.SelectSing leNode("/weatherFeed/city")
xe_currentCondi tions =
xDoc.SelectSing leNode("/weatherFeed/city/currentConditio ns")
xe_fiveDayForec ast =
xDoc.SelectSing leNode("/weatherFeed/city/fiveDayForecast ")

For Each xe_city In xe_weatherFeed. ChildNodes
If xe_city.NodeTyp e = XmlNodeType.Ele ment Then
ReDim Preserve a(41)
i = 0
For Each xe_currentCondi tionsChild In
xe_currentCondi tions.ChildNode s
If xe_currentCondi tionsChild.Node Type =
XmlNodeType.Ele ment Then
a(i) = xe_currentCondi tionsChild.Inne rText
i += 1
End If
Next

For Each xe_fiveDayForec astDay In xe_fiveDayForec ast
For Each xe_fiveDayForec astDayDetails In
xe_fiveDayForec astDay
If xe_fiveDayForec astDayDetails.N odeType =
XmlNodeType.Ele ment Then
a(i) =
xe_fiveDayForec astDayDetails.I nnerText
i += 1
End If
Next
Next
al.Add(a)
End If
Next
weatherRepeater .DataSource = al
weatherRepeater .DataBind()
Catch err As Exception
Response.Write( "<br><font color=red><b>" & err.Message &
"</b></font>")
Finally
xDoc = Nothing
End Try

thanks again for your help.

regards,
Paul.

"Larry Rubin" <ru****@aeltus. com> wrote in message
news:u0******** ******@tk2msftn gp13.phx.gbl...


Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
8318
by: Raghu Gupta | last post by:
Hi, Actually i am facing some problem using quickbooks and presently i am not so expert in using it. I am using c# code to retrive the data from quickbooks. it doesn't matter which language we are using. So i have .iif file of employee list,so through code i have to read .iif file and get the data out of it and store that data in database. As i can use QuickBook only to import .iif file and from quickbook i can
1
1148
by: René Paschold | last post by:
Hello, i write a xml file with following code: Dim xWriter As New XmlTextWriter(SaveFileContent.FileName, _ Encoding.UTF8) With xWriter .Formatting = Formatting.Indented
9
1330
by: B-Dog | last post by:
I'm trying to read two nodes in an xml file that I'm using to store setting but I'm having a hard time trying to read the values of two nodes. Below I can read one node but I need to be able to grab both values and I can't seem to figure it out, just a bigginer. I'm able to grab aTime but can't get the aType value. Should I create a second routine or is there something I can stick in this to make it work for me. I just want those two...
4
7904
by: Pim75 | last post by:
Hello, I have to read a XML file in ASP and save the values in a database. I can get this work, but I cannot read some nested nodes of the xml file. This is a part of the XML file: <Interface> <Product> <CategoryFeatureGroup ID="622" No="1"> <FeatureGroup ID="0">
4
16699
by: Gerrit | last post by:
It must be simple, but I don't find how I can read a XmlFile in an ArrayList. Sample of my XmlFile: <?xml version="1.0" encoding="utf-8" ?> <Relations> <Person> <FirstName>John</FirstName> <LastName>Smith</LastName>
3
1679
by: Alan T | last post by:
This is my xml file content: <?xml version="1.0"?> <server> <mssqlChicago> <host>www.chicagoserver.com</host> <user>managerA</user> <password>ceoman</password> <db>dbCEO</db> </mssqlChicago>
6
7276
by: | last post by:
Hi, I'm steel trying to read and update my XML file with Visual Basic Express but i am unable to find the right way to read my xml file and update it if neccessary... Here is my problem : evry day, i store the number of children in my classroom in my XML file. For exemple, on monday, my app ask me something like this : msgbox ("Are the 28 children here today ?",vbyesno)
0
1737
by: Kavitha Sudhershan | last post by:
hi, i wanna read the node values from xml. As per my code i can read the node values in first child node and for the next node am not able to read the node values. pls help me. i'll paste the code below: Sub readfile() objxmldom.async = False objxmldom.Load ("D:\CRT\rules\AQUA.xml")
6
3218
by: =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post by:
Hi, can someone please let me know how I can read xml elements using object oriented program. I created a class to use the get and set properties however I dont know how I can pass the values from xml file to the class and use the values in my form. Thanks -- Nejadian
12
18323
by: blackirish | last post by:
Hi all, I am trying to merge 2 XML files that first of all i need to compare nodes of both files according to 2 attributes in the nodes. If those 3 attributes are equal, i need to replace the existing node with the new one. For example first xml file will be like; <Root> <Node Id ="1" FormId="form1" Value="value1"/> <Node Id ="2" FormId="form1" Value="value2"/> <Node Id ="3" FormId="form1" Value="value3"/>...
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9544
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10259
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7570
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5467
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4145
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.