Location: PHPKode > scripts > DOM Query > test.php
<?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();
Return current item: DOM Query