I'm trying to write my first XML parser and am running into problems with my character data handler function. The function should print one name per line, but whenever an & amp; (pretend the space doesn't exist between & and amp😉 is encountered a new line is started before and after the ampersand. Why isn't the data recognized as one value?
Example:
<name>T & amp; C Surf Designs</name>
Result:
T <br>
&<br>
C Surf Designs<br>
// process data between tags
function characterData($parser, $data) {
global $currentTag;
// format the data
switch ($currentTag) {
case "NAME":
print("$data<br>\n");
break;
default:
break;
}
}