XML parsing problem – HTML entity characters in XML

| By Webner


We had written a PHP program to parse large XML files and split each file into smaller chunks. Program was working fine for all the XML files except few. It was not splitting some XML files. After looking for the issue we found that ampersand character (&) was used in those XML files which parser was unable to split.

To solve this problem one solution is to use PHP function htmlspecialchars($str); to convert special characters contained in each value to equivalent html entity like & to &, < to <, > to > and so on.

The other solution is to replace special char manually in text editor.

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com

Leave a Reply

Your email address will not be published. Required fields are marked *