I'm trying to use DOM rewriting for the purpose of modifying the content of
some grid cells. I modified GridCell class adding a
void afterRender(MarkupWriter writer)
method, and in it I can retrieve the Element (org.apache.tapestry5.dom.Element)
containing the value I want to modify. For ex. the toString() of one of these
Element-s returns:
<div id="cellId_xyz_123">Hello</div>
But I'm not sure how to change that "Hello" into something else. The Element
class doesn't seem to me to have methods for that.
If I do
Node node = element.getChildren().get(0);
I do get a org.apache.tapestry5.dom.Node representing the element's content
(its toString() just returns "Hello"), but even this Node object doesn't seem
to me to have methods to change its content.
Or maybe I should create a new Node instance containing the text I want and
then use this instance to replace the existing Node instance in the children
list, like
element.getChildren().set(0, newNode);
?