/ Published in: PHP
For some reason tidy inserts new lines before/after <![CDATA[ content in XML files. Since I like the benefits of a reformatted, readable XML... ... i run tidy first, then remove the spaces before/after the CDATA block:
Expand |
Embed | Plain Text
# command line/exec(),etc. or use the php functions to tidy up your document tidy -indent -utf8 -xml -wrap 1000 input.xml > output.xml <?php /** * Replaces invalid: * <element> * <![CDATA[whatever content]]> * </element> * * With well-formed: * <element><![CDATA[whatever content]]></element> */ file_put_contents("final.xml", $out); ?>
You need to login to post a comment.
