Login   Register  
PHP Classes
elePHPant
Icontem

File: test.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kai Dorschner  >  DOM Query  >  test.php  >  Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Test file
Class: DOM Query
Retrieve and manipulate XML documents like jQuery
Author: By
Last change:
Date: 3 years ago
Size: 397 bytes
 

Contents

Class file image Download
<?php
require_once('DomQuery.php');

$dom = new DomDocument('1.0''utf-8');
$dom->preserveWhiteSpace false;
$dom->formatOutput true;
$dom->loadXML
('
<html>
    <head>
        <title/>
    </head>
    <body>
        <div class="main">
            <menu class="menu"/>
        </div>
    </body>
</html>
'
);

DomQuery($dom)
    ->
find('//title')->val('Test case')
    ->
find('//*[@class]')
    ->
removeAttr('class')
    ;
echo 
$dom->saveXML();