PHP Classes

DOM Query: Retrieve and manipulate XML documents like jQuery

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 61%Total: 665 This week: 1All time: 4,850 This week: 560Up
Version License PHP version Categories
dom-query 1.0GNU General Publi...5.3HTML, XML, PHP 5
Description 

Author

This package can retrieve and manipulate XML documents like jQuery.

It can parse XML documents and search for given elements using XPath syntax.

The main class can perform several types of alterations to the matched elements similar to what you can do with jQuery. Currently it can remove attribute classes and extract the document elements XML.

Picture of Kai Dorschner
Name: Kai Dorschner is available for providing paid consulting. Contact Kai Dorschner .
Classes: 7 packages by
Country: Germany Germany
Age: 37
All time rank: 109271 in Germany Germany
Week rank: 411 Up15 in Germany Germany Up
Innovation award
Innovation award
Nominee: 1x

Example

<?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();


  Files folder image Files  
File Role Description
Accessible without login Plain text file DomQuery.php Class Class
Accessible without login Plain text file test.php Example Test file

 Version Control Unique User Downloads Download Rankings  
 0%
Total:665
This week:1
All time:4,850
This week:560Up
User Ratings User Comments (3)
 All time
Utility:87%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:61%StarStarStarStar
Rank:1072
 
This line of code is unecessary: if(version_compare(PHP_VERSI...
13 years ago (Artur Graniszewski)
67%StarStarStarStar
Beautiful class, very good, man!
13 years ago (Epsilon Alexey)
70%StarStarStarStar
its great
13 years ago (Jacek Lukasiewicz)
70%StarStarStarStar