pasquale
08-09-2007, 05:22 PM
I have a XML file containing 10 images:
<?xml version="1.0" encoding="utf-8"?>
<Images>
<Image url="vote.aspx?id=1" id="1" src="images/PL_36881_1.jpg" thumb="images/thumbs/PL_36881_1.jpg" title="Vanashing" photographer="Lydia Polzer">
<description>
<p>paragraph 1</p>
<p>paragraph 2</p>
</description>
</Image>
.........................................................................................
</Images>
I need to load all the values of the attributes src in a dictionary, I know how to do it in classic ASP, but I have never done before in VB .NET.... I tried this code but it's not working :mad: :
Dim count As Integer = 0
Dim settings As New XmlReaderSettings()
settings.IgnoreComments = True
Dim xmlfile As String = Path.Combine(Request.PhysicalApplicationPath, "styles/xml/gallery.xml")
Using reader As XmlReader = XmlReader.Create(xmlfile, settings)
While (reader.Read())
If (reader.NodeType = XmlNodeType.Element And "Images/image" = reader.LocalName) Then
count += 1
m_Images.Add(count, reader.Item(0).ToString())
End If
End While
End Using
Somebidy has some idea :confused: how to parse a XML file in VB .NET.... I coudn't find any solution I think my question should be very elementar for a senior VB .NET developer :cool: .... Can you help me please?
Many thanks
Pasquale
<?xml version="1.0" encoding="utf-8"?>
<Images>
<Image url="vote.aspx?id=1" id="1" src="images/PL_36881_1.jpg" thumb="images/thumbs/PL_36881_1.jpg" title="Vanashing" photographer="Lydia Polzer">
<description>
<p>paragraph 1</p>
<p>paragraph 2</p>
</description>
</Image>
.........................................................................................
</Images>
I need to load all the values of the attributes src in a dictionary, I know how to do it in classic ASP, but I have never done before in VB .NET.... I tried this code but it's not working :mad: :
Dim count As Integer = 0
Dim settings As New XmlReaderSettings()
settings.IgnoreComments = True
Dim xmlfile As String = Path.Combine(Request.PhysicalApplicationPath, "styles/xml/gallery.xml")
Using reader As XmlReader = XmlReader.Create(xmlfile, settings)
While (reader.Read())
If (reader.NodeType = XmlNodeType.Element And "Images/image" = reader.LocalName) Then
count += 1
m_Images.Add(count, reader.Item(0).ToString())
End If
End While
End Using
Somebidy has some idea :confused: how to parse a XML file in VB .NET.... I coudn't find any solution I think my question should be very elementar for a senior VB .NET developer :cool: .... Can you help me please?
Many thanks
Pasquale