HTML::ParseTree delete/modify child text

R

Richard Bell

Given an HTML::parseTree node $n. Given its content as returned by my
@content = $n->content_list(). @content potentially consists of text or
references to other nodes. Regarding those elements of @content
containing text:

How does one modify the content of a specific text child within the
containing node?

How does one delete a specific text child within the containing node?

Consider the HTML fragment:

<div> String 1 <h3> String 2 </h3> String 3 <h3> String 4 </h3> String 5
</div>

$n->content_list would contain ( 'String 1', ref to <h3> containing
String 2, 'String 3', ref to <h3> containing String 4, 'String 5' )

I can delete the child nodes with $ref->delete. But how do I mess with
the strings?

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top