On Thu, 10 Jul 2014 11:55:57 -0300, Davide Vecchi <d...@amc.dk> wrote:

As usual, thanks a lot for the great assistance, and in particular for pointing me to DOM rewriting.

List<Node> nodes = elementToModify.getChildren();

if (nodes.size() == 1)
{
        if (nodes.get(0) instanceof Text)
        {
                Text currentNode = (Text) nodes.get(0);
                
                Text newNode = elementToModify.text("pippo " + 
currentNode.toString());
                
                newNode.moveToTop(elementToModify);
                
                nodes = elementToModify.getChildren();
                
                nodes.get(1).remove();
        }
}

I think the code is ok, even if it could have some improvements.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to