Hello,
you could be using the class
XmlNode
see here:
XmlNode Class (System.Xml) | Microsoft Learn[
^]
Refactoring a bit your code like that:
While reader.Read
Dim lettura = reader.NodeType
Dim valueA As String
Dim attr_name As String = "none"
valueA = reader.Name
If reader.HasAttributes Then
Dim node As XmlNode = docXML.ReadNode(reader)
Console.Write("Node is: " & valueA)
If node.Attributes IsNot Nothing Then
For Each attribute As XmlAttribute In node.Attributes
Console.Write(" Attribute Name: {0}, Value: {1}.", attribute.Name, attribute.Value)
Next
End If
Console.WriteLine()
End If
End While
Console.Read()
gives you this output:
Node is: xml
Node is: body Attribute Name: surname, Value: Rott. Attribute Name: name, Value: Pig.
Node is: body Attribute Name: colorB, Value: White. Attribute Name: colorA, Value: Yellow.
Good luck!
Valery