How to use XMLReader to read node values


I’ve stuck trying to use XMLReader to read node values, although the attributes can be read easily.

I’m trying to get node value like this:

[b][i]Smith, Joe[/i][/b]

If I use XMLReader.StarElement event handler, then can get attribute values although can’t read node values.

XML data:
<billingdata address =
7801 NW 37TH ST>
Empty node


Sub StartElement(name as String, attributeList as XmlAttributeList) Select Case name Case "billingdata" sD.Append = attributeList.Value("address") End Select End Sub

Any advice is welcome.


Before I tackle your question as asked, any reason you’re not using XMLDocument instead?

Thank you very much Kem.

Because I need to handle files greater than 150 Mb and read only certain sections of each file to extract useful data.

I used XMLDocument but performance is slightly better with XMLReader.

Last week, I have generated large XML files for testing, placing values inside properties instead of the node text and as I stated, the performance apparently is better with XMLReader.

Unfortunately, files that must finally be processed, are not created by me and come from different sources.

XMLReader can indeed handle enormous XML files that XMLDocument cannot
How is a section of this XML set up ?
The snippet isn’t clear to me.

However that attribute looks incorrect
It SHOULD be enclosed in quotes

ie. it should look like
Empty node

Thank you Norman.

It’s quite correct, attribute must be enclosed in quotes. My problem is how to read text node (in this case >Empty node<) using XMLReader.

The Characters Method reads anything between the start element & end element tag that is not part of another element