Parse particular text from an XML string
Posted
by
Dan Sewell
on Stack Overflow
See other posts from Stack Overflow
or by Dan Sewell
Published on 2010-12-03T13:36:17Z
Indexed on
2010/12/24
17:54 UTC
Read the original article
Hit count: 161
Hi all, Im writing an app which reads an RSS feed and places items on a map. I need to read the lat and long numbers only from this string: http://www.xxxxxxxxxxxxxx.co.uk/map.aspx?isTrafficAlert=true&lat=53.647351&lon=-1.933506 .This is contained in link tags
Im a bit of a programming noob but im writing this in C#/Silverlight using Linq to XML.
Shold this text be extrated when parsing or after parsing and sent to a class to do this? Many thanks for your assistance.
EDIT. Im going to try and do a regex on this
this is where I need to integrate the regex somewhere in this code. I need to take the lat and long from the Link element and seperate it into two variables I can use (the results are part of a foreach loop that creates a list.)
var events = from ev in document.Descendants("item")
select new
{
Title = (ev.Element("title").Value),
Description = (ev.Element("description").Value),
Link = (ev.Element("link").Value),
};
Question is im not quite ure where to put the regex (once I work out how to use the regex properly! :-) )
© Stack Overflow or respective owner