XMLin with strings containing invalid xml characters

366 views Asked by At

I am using XML::Simple in one of my perl scripts to extract some messages, problem is I am getting this error :

No semi-colon found after entity name [Ln: 1, Col: 151]

when I use XMLin( $msg ) and $msg contains an invalid character like '&'

I know I can use regex to remove them, but I don't want to. I can use replace & with &.

Is there a simple way in perl to deal with this kind of invalid characters in strings when I use XMLin( $msg ) ?

Example for $msg can be like : <Error>Exception Invalid address (&F5F5F5F5)</Error>

1

There are 1 answers

3
ikegami On

No.

XML::Simple doesn't actually parse XML. It uses one of many other parsers to do so. If it had such an option, it wouldn't always work, if ever.

XML::Simple, therefore, doesn't provide such an option.