You need to use XML::Entities
to encode the string.
In this case you will have to decode the string first, otherwise you will end up with the entities that are already present being doubly-encoded.
Вопрос
How do I force using of entities encoding in text nodes in XML::LibXML?
I have on toString() output
<test><text>&"</text></test>
and I need
<test><text>&"</text></test>
Решение
You need to use XML::Entities
to encode the string.
In this case you will have to decode the string first, otherwise you will end up with the entities that are already present being doubly-encoded.
Другие советы
I don't know why you want that because those two XML snippets are 100% equivalent.
libxml doesn't needlessly use entities for '"
' anymore than it does for 't
' and '.
'.