in reply to Avoiding escaped child elements with HTML::TreeBuilder::XPath or HTML::Element
~literal is HTML::Element stuff. as_XML_indented is HTML::TreeBuilder::XPath stuff. Try https://metacpan.org/pod/HTML::Element#as_XML.
In Section
Seekers of Perl Wisdom