Inspect xml or html special char production on command line

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2022-12-01

My XML validation test was failing for a component that wrapped every string in CDATA. The code was:

  $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>&lt;![CDATA[Standard full-time bookkeeper]]&gt;</title>

I needed to use special tools to skip the auto-escaping for inspection:



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.