eHi,
I'm not the most experienced person around here to answer this but I'll try.
First, I believe that the structure of you XML needs to looking into.
Do you expect more than 1 value in your ProductVariantAttributeValue element?
If not, then you could just leave out the Value element and put the real value in your ProductVariantAttributeValue element.
Otherwise, I'll have to adjust my code to accomodate.
But the following should do what you expect:
Imports System.Linq
Module Module1
Sub Main()
Dim query As IEnumerable(Of XElement) = From q In XML...<productvariantattribute> Select q
For Each el In query
Dim newAttr As New Attributes With {
.ID = el.@ID,
.Value = el...<value>.Value}
AttributesList.Add(newAttr)
Next
For Each el In AttributesList
Console.WriteLine("ID: " & el.ID)
Console.WriteLine("Value: " & el.Value)
Next
Console.ReadLine()
End Sub
Dim XML As XDocument =
<attributes>
<productvariantattribute id="6">
<productvariantattributevalue>
<value>12</value>
</productvariantattributevalue>
</productvariantattribute>
<productvariantattribute id="1">
<productvariantattributevalue>
<value>1</value>
</productvariantattributevalue>
</productvariantattribute>
<productvariantattribute id="3">
<productvariantattributevalue>
<value>6</value>
</productvariantattributevalue>
</productvariantattribute>
</attributes>
Dim AttributesList As New List(Of Attributes)
End Module
Public Class Attributes
Property ID As String
Property Value As String
End Class</value></productvariantattribute>
I create a class to hold your return values as I believe this is more inline with OOP.
Also, the XML read is done with linq because I'm a bit more familiar with it than using DOM elements.