Link to home
Start Free TrialLog in
Avatar of pomorin
pomorin

asked on

How to get only Meta tags from URL ?

Hello !

I use HttpWebRequest to get HTML from URL. Then I get Meta tags from HTML.
Can I get only Meta tags from URL ?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Gary Davis
Gary Davis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pomorin
pomorin

ASKER

Thank you for the reply.
I do it now(receiving the entire Html from which I parse and extract the <META> tags).
May be is there the method to get only meta tags from URL ?
Avatar of pomorin

ASKER

Thank you for the reply.
I do it now(receiving the entire Html from which I parse and extract the <META> tags).
May be is there the method to get only meta tags from URL ?
If the HTML is a valid XML document, you could load it into an XmlDocument from the string and use an xpath query to easily locate the META tags. However, most HTML is full of bugs, mismatched tags, etc (due to forgiving browsers) so the way you are doing it is probably sufficient (scanning the response string for the META tags).

Gary.