PHP Classes

DOM Query: Retrieve and manipulate XML documents like jQuery

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 61%Total: 665 All time: 4,851 This week: 455Up
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: 38
All time rank: 109471 in Germany Germany
Week rank: 215 Up10 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 (2)  
File Role Description
Accessible without login Plain text file DomQuery.php Class Class
Accessible without login Plain text file test.php Example Test file

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:665
This week:0
All time:4,851
This week:455Up
User Ratings User Comments (3)
 All time
Utility:87%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:61%StarStarStarStar
Rank:1077
 
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