PHP Developer: Enrich your XML Toolbox _php

Source: Internet
Author: User
Keywords enrichment personnel development php xml use DOM one support
Tags php download soap client xml parser xslt web database
PHP's support for XML continues to increase with the popularity of PHP. You can find out the XML tools available for nearly a dozen PHP developers from this article. Tool Consultant Craig Knudsen also describes a way to access more Java tools from within PHP.
PHP 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, and for an overview of some of the tools I found in the recent survey of supply tools, see the table: PHP Developer's XML tool.

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. PHP 4 can use the DOM (Document Object model) API, unless you configure the PHP 4 package to use the DOM API (using the--with-dom configuration option) or use the Windows binary release to start the 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 later.

DOM and SAX use different schemas to parse the XML. When the SAX parser encounters a tag that you are interested in, it invokes a callback that has been specified. Instead, the DOM loads the entire document into a tree structure that you can examine and manipulate. PHP's DOM module also supports XPath since version 4.0.4.

Not everyone can control the server environment, so rebuilding PHP might not be feasible. Fortunately, there is another way to use the DOM in PHP. The project has developed a PHP class that supports DOM. Since it is all written in PHP, there is no need to make any modifications 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 release is that someone has already done a part of your work; you don't have to download any additional code to compile it, and it has built in many extensions, including DOM extensions.

If you are not using Windows, you may need to build PHP from your source code. By default, PHP's latest release will automatically include 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 on how to build PHP from source code, see Resources. Also, keep in mind that you need to add--with-dom as an option when you run PHP's configure script.

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

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-formatted 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 you build 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 to 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 for useful information company.

The 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 are using, there is another option: Java. Although the list of XML tools for PHP is growing, there are still more XML tools available in JAVA. PHP 4 includes support for accessing Java objects, which allows PHP developers to use a variety of Java XML tools.

While Java support for PHP is not entirely new, it will take 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 for the documentation that describes the installation and use. Remember that the installation process has a slight difference for each Java implementation.

XML Tools for PHP developers

Syntax parser:
PHP XML is based on the SAX parser, which is built in PHP based on the expat of Jim Clark.
PHP DOM builds the DOM support in PHP, which requires Sabloton.
Allows the DOM to use the PHP DOM module to access the XML document.
The Phpdom Phpdom provides a PHP4 class wrapper for the PHP DOM module.
Prax Prax is a PHP implementation of RAX, an alternative to SAX.
Agreement:
SOAPX4 Dietrich Ayala Development of SOAP client and server implementations
PHP's SOAP client and server Giga Ideas developed a SOAP client and server implementation
PHP's XML-PRC client and server XML-RPC client and server implementations developed by Useful Information Corporation
EZ Xmlrpc 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.



Resources

Do you have any comments about PHP tools? Please click on the discussion at the top or bottom of the article to participate in the forums related to this article.
You can download the PHP source code or the Windows binary release from the PHP download page.
The Document Object Model (DOM) provides a set of standard objects for representing 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.
XML's Simple API (SAX) is a standard interface for parsing event-based XML.
The XML record-oriented API (RAX) is an alternative to the two mainstream APIs (SAX and DOM).
Industrial strength or foam? SOAP, RPC, and RMI are profiled.
XML-RPC allows you to make process calls across the Internet for software that runs in different environments, in various operating systems.
Using the PHP scripting language to quickly write Web database scripts contains step-by-steps instructions for building PHP from source code, and a database-driven PHP application is described.
In order to enable DOM support when building PHP from source code, you need to install the Gnome XML C Library.
In order to use the PHP XSLT module, Sabloton must be installed before building PHP.
The PHP manual contains documentation on using expat-based XML functionality, DOM XML functionality, and XSLT functionality.
Phpbuilder's PHP & Java describes how to install and use PHP Java modules.
Php-xml Mailing list is run by O ' Reilly Network.
Find out how to compile PHP into a dynamically loaded Apache module with DB2 support in the article Dan Scott, DB2 Developer's Corner.
You can take a closer look at the following online tutorials to learn about code examples using PHP and XML.

Phpbuilder has a few masterpieces of parsing XML, including using the expat feature and the DOM Xml:expat alternatives.
A good article in Phpwizard.net is titled Parsing XML with PHP.
PHP Everywhere has tutorials on using XML-RPC.
A simple example of using XML-RPC can be obtained from linux.com.
The Solutions 2001 Developer Conference will be held in San Francisco from August 13 to 18th; Please search 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/Build great apps
XSL Example: Introduction to XML transformations
Use Java technology to parse and program XML documents.

Please participate in 17 surveys on development habits to help IBM improve the XML tools and services used to develop software applications.
  • 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: info-contact@alibabacloud.com 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.