barry

barry

  • NA
  • 1
  • 0

Getting an attribute value from HTML

Apr 5 2007 5:31 PM
Hi, I've just completed some code that sends a post request to a servlet. This servlet then generates a link to a page where there is further information. e.g. The link looks like this http://localhost:80/info?id=1234567&type=slir This is the page source of the page that the link takes you to. **********************************************************
[b]Attribute[/b] [b]Value[/b]
MSISDN 1234567
Time 2007-04-05 20:51:00
[b]X coordinate[/b] 49 21 09N
Y coordinate 6 56 34W
Inner radius 825
Arc width 1100
Start angle 270
Extent angle 120
**************************************************** The info on the page is in the format of Attribute Value. I want to get the values out of the page for just the"X coordinate" attribute and put it in a variable. I've been looking on the net about parsing html in c#. Most of what I've found seems very over complicated for what I want (just getting one attribute whose name I know). I'm not even sure if "parsing" is what I should be investigating. I tried to access the page using a httpWebRequest get method Again im not sure if this is the right way to go about it. ************************************************ using (HttpWebResponse response = (HttpWebResponse) request.GetResponse()) { using (Stream responseStream = response.GetResponseStream()) { using (StreamReader readStream = new StreamReader (responseStream, Encoding.UTF8)) { result = readStream.ReadToEnd(); } ********************************************** but the source that that code returns is is missing all of the attributes and values. e.g. the source is ************************************************
************************************************ You can see that it says Attribute and Value but the information is not there. Could somebody tell me the correct way to get the value from the page where the attribute I want is known? Thanks Dub
[b]Attribute[/b] [b]Value[/b]