Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML on pocket pc

Status
Not open for further replies.

Hokkie

MIS
Nov 21, 2001
77
NL
Hi,

I cannot figure out why there is an "ArgumentNullException" error for the following code. I get the error on the line that adds the first child's value to the listbox. The listbox is there.

Code:
        Dim objXMLDocument As New XmlDocument
        Dim objXMLRootElement As XmlElement
        Dim objXMLRecensieElement As XmlElement

      objXMLDocument.Load("\Program Files\XML Try for PPC\Recensies.xml")
	objXMLRootElement = objXMLDocument.DocumentElement
		For Each objXMLRecensieElement In objXMLRootElement
			ListBox1.Items.Add(objXMLRecensieElement.FirstChild.Value)
	Next

This is the XML file I'm trying to read:

Code:
<?xml version="1.0" encoding="utf-8" ?> 
<recensies>
	<recensie>
		<groep>Toneelschuur</groep>
		<stuk>De dag en de nacht en de dag na de dood</stuk>
		<locatie>LAK theater</locatie>
		<datum>10-10-2005</datum>
		<cijfer>9+</cijfer>
		<notitie>Boeiend verhaal, goede tekst, warm en inspannend gespeeld.</notitie>
	</recensie>
	<recensie>
		<groep>Riek Swarte</groep>
		<stuk>De Groote Storm</stuk>
		<locatie>LAK theater</locatie>
		<datum>09-10-2005</datum>
		<cijfer>7</cijfer>
		<notitie>vooral leuk voor de spelers.</notitie>
	</recensie>
</recensies>

Any help please?

__________________
code is enduring
 
The FirstChild.Value returns nothing. FirstChild.Value.ToString also returns nothing (and also raises the NullReference error).

The FirstChild.InnerText propery returns the value I was looking for.

What is the different between Value.ToString and InnerText?

__________________
code is enduring
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top