I am trying to parse some files that contain comments like this:
<html>
<body>
<!-- BEGIN ad_content -->
images, text, etc...
<!-- END ad_content -->
Interesting text of site here.
</body>
</html>
I am wondering how to go about extracting the data within the comments
block using Hpricot. I am not aware of a way to refer to commented HTML
through CSS or XPath selectors.
The XPath comment() selector will select all comments:
For example (xpath after -m flag):
keith@devel ~ $ xml sel -t -m '//comment()' -v '.' -n simple.xml
one comment
two comment
keith@devel ~ $ cat simple.xml
<simple>
<!-- one comment -->
<foo/>
<!-- two comment -->
<bar/>
</simple>
HTH,
Keith
···
On 11/20/06, Jerome --- <jerome@tut0r.com> wrote:
I am trying to parse some files that contain comments like this:
...
I am not aware of a way to refer to commented HTML
through CSS or XPath selectors.