FluentDOM
[ class tree: FluentDOM ] [ index: FluentDOM ] [ all elements ]

Usage Examples: FluentDOM::add()

  1. <?php
  2. /**
  3. *
  4. @version $Id: add.php 321 2009-09-14 20:17:23Z lapis $
  5. @license http://www.opensource.org/licenses/mit-license.php The MIT License
  6. @copyright Copyright (c) 2009 Bastian Feder, Thomas Weinert
  7. */
  8. header('Content-type: text/plain');
  9.  
  10. $xml = <<<XML
  11. <html>
  12. <head></head>
  13. <body>
  14.   <p>I would like to say: <b>HELLO</b></p>
  15.   <b>HELLO</b>
  16.  
  17.   <div>Another list of childNodes</div>
  18. </body>
  19. </html>
  20. XML;
  21.  
  22.  
  23. require_once('../FluentDOM.php');
  24. $dom FluentDOM($xml);
  25. echo $dom
  26.   ->find('//p')
  27.   ->add('//p/b')
  28.   ->toggleClass('inB');
  29.  
  30. echo "\n\n";
  31.  
  32. $dom FluentDOM($xml);
  33. echo $dom
  34.   ->find('//p')
  35.   ->add(
  36.     $dom->find('//div')
  37.   )
  38.   ->toggleClass('inB');
  39.  
  40. echo "\n\n";
  41.  
  42. $dom FluentDOM($xml);
  43. echo $dom
  44.   ->add(
  45.     $dom->find('//div')
  46.   )
  47.   ->toggleClass('inB');
  48.  
  49. echo "\n\n";
  50.  
  51. $dom FluentDOM($xml);
  52. echo $dom
  53.   ->add('//div')
  54.   ->toggleClass('inB');
  55.  
  56. ?>

Documentation generated on Sun, 26 Sep 2010 01:00:48 +0200 by phpDocumentor 1.4.3