Vico Ervanda
Vico Ervanda

Reputation: 43

VB.NET : i need to get specific text from xml

Language version (VB.Net) Platform version (.NET 4) Operating system (Windows 7 Ultimate)

i need to create tumblr downloader. and i think i can grab the image url using this xml link http://fyeahsonnaeun.tumblr.com/api/read?start=1 i already using xelement / xmldocument to load the page but i dont know how to extract the image links

<photo-url max-width="1280">media.tumblr.com/1bbf0fd243f78727f51c6b79fe758ba8/tumblr_mw49olJwkB1qm4souo1_1280.jpg</photo-url>

i need to get the link between <photo-url max-width="1280">...</photo-url>

Upvotes: 1

Views: 131

Answers (1)

Szymon
Szymon

Reputation: 43023

There are many ways to do that. You can use the code below, this one uses System.Xml.XmlDocument class to read xml and assumes that what you want is the value of the root element.

Dim xml As String = "<photo-url max-width=""1280"">media.tumblr.com/1bbf0fd243f78727f51c6b79fe758ba8/tumblr_mw49olJwkB1qm4souo1_1280.jpg</photo-url>"

Dim doc As New System.Xml.XmlDocument
doc.LoadXml(xml)
Dim el As System.Xml.XmlElement = doc.DocumentElement
Dim url As String = el.InnerText

Upvotes: 1

Related Questions