Nokogiri: to_s WITHOUT html surrounding's tags?

Hi all

n = Nokogiri::HTML(“

H1

”)

n.to_s

=> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

"http://www.w3.org/TR/REC-html40/loose.dtd">\n

H1

Is there a method that only outputs the stuff I’ve read, and not the

whole valid XHTML stuff?

Needed output:

H1

Thanks a lot

Josh

You can do the following:

Nokogiri::HTML(“

H1

”).css( ‘h1’ )

Good luck,

-Conrad

Hi all

n = Nokogiri::HTML(“

H1

”)

n.to_s

=> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"

"http://www.w3.org/TR/REC-html40/loose.dtd">\n

H1

Is there a method that only outputs the stuff I’ve read, and not the

whole valid XHTML stuff?

Needed output:

H1

Thanks a lot

Josh

You can do the following:

Nokogiri::HTML(“

H1

”).css( ‘h1’ )

The example above produces a node of the DOM and adding ‘to_s’ will give you the string.