StevieD
StevieD

Reputation: 7443

Extracting text and HTML from the contents of an element using Web::Scraper

Given the following HTML snippet:

<span itemprop="streetAddress">59 Court St.<br>City Hall</span>

I want to extract the contents of the span including the <br> tag. I can extract the text with the following:

 process 'span[itemprop="streetAddress"]', address => 'TEXT';

But this leaves out the <br> tag.

Upvotes: 1

Views: 75

Answers (1)

StevieD
StevieD

Reputation: 7443

OK, I cracked open the source code Web::Scraper and saw that you can set the value of the second argument to 'RAW' like so:

process 'span[itemprop="streetAddress"]', address => 'RAW';

Upvotes: 2

Related Questions