My Perl program is processing an XML file. Some entries may contain & symbols. And the parser breaks, saying: "Invalid name in entity".
How can I process the file and encode &-s in all the incorrect entities?
So, it will be something like this:
<words>text1 & text2</words> --> <words>text1 & text2</words>
It's not an XML file. If it were XML, the & would be written as &. Processing non-XML files is difficult because you can't use an XML parser. It's best to fix the program that created this file, changing it to produce proper well-formed XML.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With