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

Usage Examples: FluentDOM::children()

  1. <?php
  2. /**
  3. *
  4. @version $Id: children.php 322 2009-09-14 20:19:48Z subjective $
  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.   <div id="container">
  15.     <p>This <span>is the <em>way</em> we</span>
  16.     write <em>the</em> demo,</p>
  17.   </div>
  18. </body>
  19. </html>
  20. XML;
  21.  
  22. require_once('../FluentDOM.php');
  23. echo FluentDOM($xml)
  24.   ->find('//div[@id = "container"]/p')
  25.   ->children()
  26.   ->toggleClass('child');
  27.  
  28. echo "\n\n";
  29.  
  30. echo FluentDOM($xml)
  31.   ->find('//div[@id = "container"]/p')
  32.   ->children('name() = "em"')
  33.   ->toggleClass('child');
  34. ?>

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