I cannot use Element.raw(String) because although it returns an Element, the node it creates is a Raw node, not an Element node; the Element it returns is just the parent of the new Raw.
My situation is that I have an Element which contains a child Element, and I want to either replace the child Element with a new Element having different text, or just change the text of that child Element. F.ex., I have these two Elements <div id="parent"> <div> I'm the OLD child Element </div> </div> and I want to turn that into <div id="parent"> <div> I'm the NEW child Element </div> </div> where the parent div and the child div are both Element-s before and after, instead of being both Element-s before and then becoming an Element containing a Raw. So I still would like to know if it's possible to set the text of an Element (either an existing Element or one I create). I have been thinking that maybe Element-s don't let you set the text because they are just not supposed to contain text and if you want a node with text you should use another subclass of Node, like Text or Raw. But this doesn't seem to be the case, because the nodes I get from Tapestry are definitely two Elements, parent and child, and the child does contain text, exactly like my example above.