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 66%Total: 664 All time: 4,847 This week: 423Up
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: 609 Up19 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:664
This week:0
All time:4,847
This week:423Up
User Ratings User Comments (3)
 All time
Utility:95%StarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:90%StarStarStarStarStar
Tests:-
Videos:-
Overall:66%StarStarStarStar
Rank:710
 
This line of code is unecessary: if(version_compare(PHP_VERSI...
12 years ago (Artur Graniszewski)
67%StarStarStarStar
Beautiful class, very good, man!
12 years ago (Epsilon Alexey)
70%StarStarStarStar
its great
12 years ago (Jacek Lukasiewicz)
70%StarStarStarStar