cvs: peardoc /scripts cdataify.php

[email protected] ("Christian Weiske")
Newsgroups php.pear.doc
Message-ID <cvscweiske1241546699@cvsserver>
cweiske		Tue May  5 18:04:59 2009 UTC

  Added files:                 
    /peardoc/scripts	cdataify.php 
  Log:
  add script to convert entityfied programlistings to cdata sections
  
  

http://cvs.php.net/viewvc.cgi/peardoc/scripts/cdataify.php?view=markup&rev=1.1
Index: peardoc/scripts/cdataify.php
+++ peardoc/scripts/cdataify.php
<?php
/**
* Encapsulates <programlisting> and <screen> tags CDATA sections if not done yet.
*
* @author Christian Weiske <[email protected]>
*/
array_shift($argv);
$files = $argv;

foreach ($files as $file) {
    $doc = new DOMDocument();
    $doc->load($file);
    $prl = $doc->getElementsByTagName('programlisting');
    foreach ($prl as $node) {
        $cd = $doc->createCDATASection($node->nodeValue);
        $node->nodeValue = null;
        $node->appendChild($cd);
    }
    echo $doc->saveXML();
}

?>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.