如何取消Perl中的XML特殊字符?

时间:2022-02-26 16:52:19

I'm processing some XML files (specifically .vcproj files) in Perl and I want to unescape the special characters. The escaped characters I've encountered so far are:

我正在用Perl处理一些XML文件(特别是.vcproj文件),我想取消对特殊字符的转义。到目前为止,我遇到的转义字符是:

  • "
  • “;
  • 
  • & # x0D;
  • 

  • & # x0A;

Obviously I can do this myself but it seems that there should be a standard (or CPAN) module to do this but a naive search brings up nothing relevant.

显然,我自己也可以这样做,但似乎应该有一个标准(或CPAN)模块来实现这一点,但天真的搜索不会带来任何相关内容。

Any ideas?

什么好主意吗?

1 个解决方案

#1


8  

XML::Entities or the older HTML::Entities. I've only used the latter.

XML::实体或旧的HTML::实体。我只使用了后者。

Searching probably would have been easier for you if you'd known that these things are called entities; I hate it when I'm in that position of not knowing the key information that would make a search possible.

如果你知道这些东西叫做实体,搜索可能会更容易;我讨厌在不知道关键信息的情况下进行搜索。

#1


8  

XML::Entities or the older HTML::Entities. I've only used the latter.

XML::实体或旧的HTML::实体。我只使用了后者。

Searching probably would have been easier for you if you'd known that these things are called entities; I hate it when I'm in that position of not knowing the key information that would make a search possible.

如果你知道这些东西叫做实体,搜索可能会更容易;我讨厌在不知道关键信息的情况下进行搜索。