This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.
Last Updated: 2024-11-21
My XML validation test was failing for a component that wrapped every string in CDATA. The code was:
<?php
$jobNode = $xml->addChild('title', '<![CDATA[actual title]]>');
The confusing part was that it displayed exactly like that in the browser.
I inspected it on the command line with CURL and sure enough the entities had auto-escaping fromthe XML library.
<title><![CDATA[Standard full-time bookkeeper]]></title>
I needed to use special tools to skip the auto-escaping for inspection:
<?php
$node->appendChild($no->createCDATASection($value));
When generating output that uses special characters, inspect in a command line program instead of in the browser, since the browser will transform some entities and fool you.