CC: | croberts [...] gilsongraphics.com |
Subject: | ERROR when data contains "<" or ">". |
Customer does not have an XML editor that validates data and there was a typo in XML data and I got this error:
"not well-formed (invalid token) at line 15, column 39, byte 616 at /usr/lib/perl5/XML/Parser.pm line 187.".
I was using XML::Simple 2.20 but the error actually came from XML::Parser. This was the XML data that had the error:
<StreetOne>221 <atteson Ct.</StreetOne>
Seems like there is no way for me, the programmer, to check the data because this is an error from the parsing step, before the data in the object is populated. Keep in mind that not every user has an XML editor that validates XML.
IDEA: If an opening tag "<" symbol appears and there is no tag close ">" on the same line, or there is the incorrect number of closing symbols ">", there's probably something wrong with that line.
For testing create a very simple XML file with that typo above, like:
<base>
<StreetOne>221 <atteson Ct.</StreetOne>
</base>