Вопрос

How do I force using of entities encoding in text nodes in XML::LibXML?

I have on toString() output

<test>&lt;text&gt;&amp;"&lt;/text&gt;</test>

and I need

<test>&lt;text&gt;&amp;&quot;&lt;/text&gt;</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 '.'.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top