PHP Classes

Saxophone: PHP stream handler to search XML with XPATH

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (6)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 350 All time: 6,996 This week: 488Up
Version License PHP version Categories
saxophone 1.0.9GNU General Publi...5.0HTML, XML, Searching, Parsers


This class is a PHP stream handler to search XML with XPATH or tag name.

It allows opening a XML document using fopen('sax:...').

The class can parses the XML document and search it using XPATH expressions to match the document data that is returned when the stream reading functions are called.

Innovation Award
PHP Programming Innovation award nominee
October 2013
Number 2

Prize: One downloadable copy of CodeLobster Professional
Some applications need to parse XML documents for extracting records of information that are stored in a certain structure.

This class can simplify the extraction of information from XML documents.

It uses the PHP streams support to open a virtual file with a name that includes the actual XML document file to parse, as well the format of the path of the XML elements to be extracting.

The XML elements path definition can be specified as a XPATH expression.

Using regular PHP file opening and reading functions it can return the XML elements that match the search expression.

Manuel Lemos
Picture of Juraj Puchký
  Performance   Level  
Name: Juraj Puchký is available for providing paid consulting. Contact Juraj Puchký .
Classes: 17 packages by
Country: Czech Republic Czech Republic
Age: 42
All time rank: 109211 in Czech Republic Czech Republic
Week rank: 42 Up1 in Czech Republic Czech Republic Up
Innovation award
Innovation award
Nominee: 6x


SaxOPHONE ========= 0OOOOON NNX00kdk0KXKdl0N cccllxKXX 0oxkxX OdkOO OdxdO KxookN kxloxN NdoldxX KK0KK0O0d kooclo0 0ldc;;coodkK oxloo:X OkX0dc;cok0K XoxcxocNk0X0OxoxN XddcxooxO0OkxoX Xxdloc,:kxollxK Oxoodc:lxc:clN Koxldd:;ooxxdlkN 0xocddxkk0Okok XddOOxxO0OxdO 0kodkOkxxkX dlkO0N * @author Juraj Puchký - Devtech <> * @license GPLv3 * @homepage * @copy (c) 2013 Juraj Puchký - Devtech Intro: Saxophone is simple stream xml parser with optional configuration support. You no need more than 1MB memory to process XML file. Is fast as possible and access interface is integrated into file stream support, that means you can access XML file from any where and process directly. Saxophone is licensed under GPLv3 any time you wish use in commercial application, kindly contact me and we will discuss commerce non exclusive developer license and conditions related with copyright rights. How to use: =========== At first you have to include Saxophone.php class file. Configure options global variable as well. $GLOBALS["xmlopt"] = array( "encoding" => "utf-8", "object" => "//*/SHOPITEM", "type" => "XPATH", // TAG,XPATH,TAGSLIST "fields" => array( "productName" => "//*/SHOPITEM/PRODUCT" ) ); Specify encoding ================ encoding - specify which encoding should be as target encoding for parsing XML file default is UTF-8. Specify object ============== object - specifies tag name or xpath of object which encapsule required fields. Types parser point of view ========================== TAG - Tags are separed and identified by TAG NAME only. XPATH - Tags are separed and identified by XPATH. TAGSLIST - Result object has filled public supportedTags variable with array of exisiting tags. Ignition of stream ================== /- File handler | /- Saxophone protocol | | /- global variable name of processed object accessor | | | /- function name to post process parsed object | | | | /- function name to post process tag | | | | | /- Url of XML File | | | | | | /- global variable of saxophone parser options | | | | | | | $fp = fopen("sax://xml;xprocess;xprocesstag;sample.xml;xmlopt","rb",true); // Load fuel till end by 4096 bytes while(!feof($fp)) { fread($fp,4096);} // Close fire fclose($fp); // Mision completed we are on the orbit

  • Sample-1.01.png
  • Saxophone.png
  Files folder image Files  
File Role Description
Accessible without login Plain text file README.TXT Doc. Singing song untill im on the orbit
Accessible without login Plain text file sample.php Example Saxophone sample
Accessible without login Plain text file sample.txt Output Saxophone sample results
Accessible without login Plain text file sample.xml Data Saxophone sample data
Plain text file Saxophone-1.0.9.php Class Saxophone 1.0.9 class file
Plain text file Saxophone-1.1.0.php Class New version support of parse method

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:6,996
This week:488Up
 User Ratings  
 All time