PHP developers: Enrich your XML Toolbox

Source: Internet
Author: User
Tags object model php class php and php download soap client version web services access
XML PHP's support for XML has been increasing with the popularity of PHP. From this article, you can find the XML tools available for a dozen PHP developers. Tool Advisor Craig Knudsen also describes a way to access more Java tools from within PHP.
PHP's support for XML began with version 3.06, when James Clark's popular C-based expat parser was first integrated into that version as a PHP 3 module. Since then, many PHP modules and classes have been developed for XML; For an overview of some of the tools I found in the recent survey of current provisioning tools, see the table: PHP developers ' XML tools.

SAX or DOM parsing?
The default configuration for PHP 4 contains the expat XML parser, which is a SAX (XML simple api,simple API for XML) parser. The DOM (Document Object model) API can be used in PHP 4 unless you configure the PHP 4 package to use the DOM API (using the--with-dom configuration option) or use Windows binary distribution to start PH P 4 Package, otherwise it will not be built. To be able to use PHP's DOM module, you need to install the GNOME XML Library and use PHP 4.0.4 or newer versions.

DOM and SAX use different schemas for parsing XML. When the SAX parser encounters a tag that you are interested in, it invokes a callback that you have specified. The DOM, however, loads the entire document into a tree structure that you can check and manipulate. PHP's DOM module also supports XPath since version 4.0.4.

Not everyone can control the server environment, so rebuilding PHP may not be feasible. Thankfully, there is another way to use DOM in PHP. The <phpXML/> project has developed a PHP class that supports DOM. Since it's all written in PHP, there's no need to make any changes to the server.

Configuring PHP for XML
Windows users will find it easy to download a binary release of PHP. The advantage of a binary distribution is that someone has already done some work for you; you don't have to download any additional code to compile it, and it already has many extensions (including DOM extensions) built into it.

If you are not using Windows, you may need to build PHP from source code. By default, PHP's latest release will automatically contain XML support based on expat (SAX). If you want to include DOM support in your package, you must configure the PHP package to handle the DOM. For more information about how to build PHP from source code, see Resources. Also, keep in mind that when you run PHP's configure script, you need to add--with-dom as an option.

DOM support in PHP is still in the experimental phase (since version 4.0.5), which means that the API will be changed in future releases.

Using XSLT
PHP 4 also adds XSLT functionality. (XSLT allows you to transform an XML document into another format, such as a PDF or HTML document, and also allows you to make more changes to the program.) The XSLT module in PHP 4 can use both expat and Sabloton. Before building PHP, you must download and install Sabloton (see Resources), and you must use the--with-sablot option during the PHP package configuration.

WEB Services
If you are interested in using PHP to develop WEB services, you can use SOAP or XML-RPC for your own needs. The SOAPX4 package also provides clients and servers written in PHP. For XML-RPC, you can choose from a variety of XML-RPC implementations, including a good one developed by the useful information company.

SOAP and XML-RPC implementations are all written in PHP. If your server has XML support enabled for PHP (by default), you do not need to make any modifications to the server.

Options outside of PHP
If you have been unable to find the PHP interface for the tool you want to use, there is another option: Java. Although the list of XML tools in PHP is growing, there are still more XML tools available in JAVA. PHP 4 includes support for accessing Java objects, which enables PHP developers to use a variety of Java XML tools.

Although PHP's Java support is not entirely new, it still takes a while to figure out how to install and use the instructions for the Java module. These instructions are not in the PHP manual. However, you can view the "Readme file" in the PHP release Ext/java directory to learn about the documentation for installation and use. Remember that the installation process is slightly different for each Java implementation.

PHP developers ' XML tools

Syntax Analyzer:
PHP XML is based on the SAX parser, which is built into PHP based on Jim Clark's expat.
The PHP DOM builds DOM support in PHP, which requires Sabloton.
<phpXML/> <phpXML/> allows Dom to use the PHP DOM module to access XML documents.
Phpdom Phpdom provides a PHP4 class wrapper for the PHP DOM module.
Prax Prax is a PHP implementation of RAX, a substitute for SAX.
SOAPx4 Dietrich Ayala developed SOAP client and server implementations
PHP SOAP client and server Giga Ideas developed SOAP client and server implementations
XML-RPC client and server implementation of PHP XML-PRC client and server <//td> useful information company
EZ xmlrpc<//td> XML-RPC client and server implementations
Hail Stone XML-RPC Server
Xmlrpc-epi This is a simple and quick to use C-based PHP module, the implementation of the client and server XML-RPC.


Do you have any comments on the PHP tools? Please click on the discussion at the top or bottom of the article to participate in the forums associated with this article.
You can download the source code for PHP or the binary release of Windows from the PHP download page.
The Document Object Model (DOM) provides a set of standard objects to represent HTML and XML documents, and provides a standard interface for accessing and manipulating these documents.
XML Path Language (XPath) is a language that can be used by both XSLT and xpointer to locate parts of an XML document.
The simple XML API (SAX) is a standard interface for parsing the event-based XML.
The XML-oriented API (RAX) is an alternative to two mainstream APIs (SAX and DOM).
Industrial strength or foam? The SOAP, RPC, and RMI are parsed.
XML-RPC allows you to make process calls across the Internet for software that operates in different operating systems, in various environments.
Using the PHP scripting language to quickly write a Web database script contains step-by-step instructions for building PHP from source code, and describes building a database-driven PHP application.
To enable DOM support when building PHP from source code, you need to install the Gnome XML C Library.
In order to use PHP's XSLT module, you must install Sabloton before you build PHP.
The PHP manual contains documentation on using expat XML features, DOM XML functionality, and XSLT functionality.
Phpbuilder PHP & Java Describes how to install and use PHP Java modules.
The Php-xml mailing list is in the charge of O ' Reilly network.
Find out how to compile PHP to become a dynamically loaded Apache module with DB2 support in the DB2 Developer Garden article in Dan Scott.
You can take a closer look at the following online tutorials to learn about code examples that use PHP and XML.

Phpbuilder has some excellent work on parsing XML, including alternatives to using the expat feature and DOM Xml:expat. has a good article titled Using PHP for parsing XML.
PHP everywhere has a tutorial on using XML-RPC.
A simple example of using XML-RPC can be obtained from
The Solutions 2001 Developer Conference will be held in San Francisco from August 13 to 18th; Please search for or browse the description of more than 230 meetings in Agendabuilder. There are more than two dozen meetings focused on XML and its related technologies, including:

Practice: Integrating XML with DB2
Practice: Voice XML Tools/building an excellent application
XSL Example: Introduction to XML transformations
Use Java technology to parse and program XML documents.

Take part in 17 research on development habits issues to help IBM improve the XML tools and services used to develop software applications.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.