Re: xml for retrieving the values of HTML tags

-----Original Message-----
From: Fiona Cameron <f.cameron@ulst.ac.uk>
To: www-dom@w3.org <www-dom@w3.org>
Date: Thursday, February 11, 1999 8:35 AM
Subject: xml for retrieving the values of HTML tags




>What I would like to do is use the XML DOM classes to do this more
>easily - for instance, get the value of the <title> tag.  Presumably
>this is what methods like getElementsByTagname do?  However, I
>cannot work out from the XML documentation how to get to the point
>where I can use this method - could anyone point me in the direction
>of some help?

getElementsByTagName could give you a collection of all "title" elements;
the value of any one of the title elements is formed by the set of child
nodes of that element.  In the simplest case, there is only a TextNode whose
value is the string you want, but if the title itself contains markup (such
as emphasis or entity references), you'll have to do some work to extract
the title as a simple string.

See some tutorial articles such as


http://www.webdeveloper.com/xml/xml_082198.html
http://www.hypermedic.com/style/dom/domindex.htm


I hope this helps,

Mike Champion

Received on Thursday, 11 February 1999 12:26:23 UTC