PHP Classes

File: test.php

Recommend this page to a friend!
  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: 13 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();