[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pear-doc
Subject:    [PEAR-DOC] cvs: peardoc /scripts cdataify.php
From:       "Christian Weiske" <cweiske () php ! net>
Date:       2009-05-05 18:04:59
Message-ID: cvscweiske1241546699 () cvsserver
[Download RAW message or body]

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 <cweiske@php.net>
*/
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();
}

?>


-- 
PEAR Documentation List Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic