TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
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 ************************************************
[b]Attribute[/b]
[b]Value[/b]
************************************************ 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
Reply
Answers (
0
)
How to return multiple values from C# method?
DataTable row number