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

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top