Enes Kabacaoglu

Hi :
I am developing a smartphone 2003 application by VS2005. I need to read xml from URL. I can do that, but i read the whole XML document. But i only want to read the tittle, or description or both from the XML document. Any ideas

Thanks for your helps for now.
Best Regards



Re: Smart Devices VB and C# Projects XML reading from URL

Ilya Tumanov

You can't seek in XML files and you can't seek in web stream so you have to read it all till you have what you need. After that you can discontinue reading.

The procedure for reading stuff from the web (anything, not just XML) has been discussed many times, please search.






Re: Smart Devices VB and C# Projects XML reading from URL

Enes Kabacaoglu

I have solved the problem. The trick was "reader.readinnerxml()"

Below, the code fills the first 5 tittle (by counter) in treeview1 and all description to treeview2

To help others who is seeking for the solution, the code is :

Code Snippet

Dim reader As XmlReader = New XmlTextReader("http://www.xxxxxxxxxxxx/RSS.XML")

Dim counter As Integer

counter = 0

Dim tittle As String

Dim description As String

While reader.Read()

Select Case reader.NodeType

Case XmlNodeType.Element

If reader.Name = "title" Then

If counter <> 5 Then

tittle = reader.ReadInnerXml()

counter = counter + 1

TreeView1.Nodes.Add(tittle)

End If

ElseIf reader.Name = "description" Then

description = reader.ReadInnerXml()

TreeView2.Nodes.Add(description)

End If

Exit Select

End Select

End While