Section A.32. XML


A.32. XML

A.32.1. XML_Beautifier

Repository: PEAR - License: PHP License - By Stephan Schmidt (lead)

Class to format XML documents.

A.32.1.1 Description

XML_Beautifier will add indentation and linebreaks to you XML files, replace all entities, format your comments and makes your document easier to read. You can influence the way your document is beautified with several options.

A.32.2. XML_CSSML

Repository: PEAR - License: PHP License - By Daniel Allen (lead)

The PEAR::XML_CSSML package provides methods for creating cascading style sheets (CSS) from an XML standard called CSSML.

A.32.2.1 Description

The best way to describe this library is to classify it as a template system for generating cascading style sheets (CSS). It is ideal for storing all of the CSS in a single location and allowing it to be parsed as needed at runtime (or from cache) using both general and browser filters specified in the attribute for the style tags. It can be driven with either the libxslt pear extenstion (part of xmldom) or the xslt extension (part of the sablotron libraries).

You may see an example usage of this class at the follow url:

http://mojave.mojavelinux.com/forum/viewtopic.php?p=22#22

Users may post questions or comments about the class at this location. My hope is that such a system becomes the standard for the organization of stylesheet information in the future.

A.32.3. XML_DTD

Repository: PEAR - License: PHP 3.0 - By Tomas V.V.Cox (lead)

Parsing of DTD files and DTD validation of XML files

A.32.3.1 Description

Parsing of DTD files and DTD validation of XML files. The XML validation is done with the php sax parser, the xml extension, it does not use the domxml extension.

Currently supports most of the current XML spec, including entities, elements and attributes. Some uncommon parts of the spec may still be unsupported.

A.32.4. XML_fo2pdf

Repository: PEAR - License: PHP License - By Christian Stocker (lead)

Converts a xsl-fo file to pdf/ps/pcl/text/etc with the help of apache-fop

A.32.5. XML_FOAF

Repository: PEAR - License: PHP License - By Davey Shafik (lead)

Provides the ability to manipulate FOAF RDF/XML

A.32.5.1 Description

XML_FOAF Allows advanced creation and simple parsing of FOAF RDF/XML files.

A.32.6. XML_HTMLSax

Repository: - License: PHP -

A SAX based parser for HTML and other badly formed XML documents

A.32.6.1 Description

XML_HTMLSax is a SAX based XML parser for badly formed XML documents, such as HTML. The original code base was developed by Alexander Zhukov and published at http://sourceforge.net/projects/phpshelve/. Alexander kindly gave permission to modify the code and license for inclusion in PEAR.

PEAR::XML_HTMLSax provides an API very similar to the native PHP Expat extension, allowing handlers using one to be easily adapted to the other. The key difference is HTMLSax will not break on badly formed XML, allowing it to be used for parsing HTML documents. Otherwise HTMLSax supports all the handlers available from Expat except namespace and external entity handlers. Provides methods for handling XML escapes as well as JSP/ASP opening and close tags.

Version 2 has had it's internals completely overhauled to use a Lexer, delivering performance *approaching* that of the native XML extension, as well as a radically improved, modular design that makes adding further functionality easy.

The public API has remained the same as older versions, except for the set_option() method, the available options having been renamed. Additional options are now also available, which allow HTMLSax to behave almost exactly like the native Expat extension. For example if the contents of XML elements contain linefeeds, tabs and XML entities, HTMLSax can be instructed to trigger additional data handler calls.

A big thanks to Jeff Moore (lead developer of WACT: http://wact.sourceforge.net) who's largely responsible for new design, as well input from other members at Sitepoint's Advanced PHP forums: http://www.sitepointforums.com/showthread.php?threadid=121246.

Thanks also to Marcus Baker (lead developer of SimpleTest: http://www.lastcraft.com/simple_test.php) for sorting out the unit tests.

A.32.7. XML_image2svg

Repository: PEAR - License: PHP 2.02 - By Urs Gehrig (lead)

Image to SVG conversion

A.32.7.1 Description

The class converts images, such as of the format JPEG, PNG and GIF to a standalone SVG representation. The image is being encoded by the PHP native encode_base64() function. You can use it to get back a complete SVG file, which is based on a predefinded, easy adaptable template file, or you can take the encoded file as a return value, using the get() method. Due to the encoding by base64, the SVG files will increase approx. 30% in size compared to the conventional image.

A.32.8. XML_NITF

Repository: PEAR - License: PHP License - By Patrick O'Lone (lead)

Parse NITF documents.

A.32.8.1 Description

This package provides a NITF XML parser. The parser was designed with NITF version 3.1, but should be forward-compatible when new versions of the NITF DTD are produced. Various methods for accessing the major elements of the document, such as the hedline(s), byline, and lede are provided. This class was originally tested against the Associated Press's (AP) XML data feed.

A.32.9. XML_Parser

Repository: PEAR - License: PHP License - By Stig Sæther Bakken (developer) - Stephan Schmidt (lead) - Tomas V.V.Cox (developer)

XML parsing class based on PHP's bundled expat

A.32.9.1 Description

This is an XML parser based on PHPs built-in xml extension. It supports two basic modes of operation: "func" and "event". In "func" mode, it will look for a function named after each element (xmltag_ELEMENT for start tags and xmltag_ELEMENT_ for end tags), and in "event" mode it uses a set of generic callbacks.

A.32.10. XML_RDDL

Repository: PEAR - License: PHP License - By Stephan Schmidt (lead)

Class to read RDDL (Resource Directory Description Language) documents.

A.32.10.1 Description

XML_RDDL provides an easy-to-use interface to extract RDDL resources from XML documents. More on RDDL can be found at http://www.rddl.org/

A.32.11. XML_RSS

Repository: PEAR - License: PHP License - By Martin Jansen (lead)

RSS parser

A.32.11.1 Description

Parser for Resource Description Framework (RDF) Site Summary (RSS) documents.

A.32.12. XML_SaxFilters

Repository: - License: PHP -

A framework for building XML filters using the SAX API

A.32.12.1 Description

XML_SaxFilters provides a foundation for using Sax filters in PHP. The original code base was developed by Luis Argerich and published at phpxmlclasses.sourceforge.net/show_doc.php?class=class_sax_filters.html. Luis discussed how SaxFilters work, using the Sourceforge classes as an example, in Chapter 10 of Wrox "PHP 4 XML".

Luis kindly gave permission to modify the code and license for inclusion in PEAR.

This version of the Sax Filters makes significant changes to Luis's original code (backwards compatibility is definately broken), seperating abstract classes from interfaces, providing interfaces for data readers and writers and providing methods to help parse XML documents recursively with filters (for example AbstractFilter::setParent()) for documents where the structure can vary significantly.

Sax Filtering is an approach to making parsing XML documents with Sax modular and easy to maintain. The parser delegates events to a child filter which may in turn delegate events to another filter. In general it's possible to implement filters for a document which are as flexible and powerful as DOM.

For some discussions on Sax filtering try; http://www.cafeconleche.org/books/xmljava/chapters/ch08.html (Java)http://www-106.ibm.com/developerworks/xml/library/x-tipsaxflex.html (Python) http://www.xml.com/pub/a/2001/10/10/sax-filters.html (Perl)

The API provided by XML_SaxFilters is a little different from that commonly used in other languages, providing the concepts of "parent" and "child". A parent of the current filter is the filter (or parser) "upsteam" which receive XML event notifications before the current filter. A "child" is a filter "downstream" of the current filter (or parser) to which XML events are delegated.

The top of the "family tree" of filters is always the parser itself, which can have children but cannot have parents. Filters can have parents and children. The parsers themselves never handle any XML events personally but always delegate to a filter. The parser accepts an object implementing the reader interface from which it streams the XML. The filters can be given an object implementing the writer interface to write output to. For an example of SAX filters in action with PHP try; http://www.phppatterns.com/index.php/article/articleview/48/1/2/ (example uses Luis Argerich original Sax Filters).

A.32.13. XML_Serializer

Repository: PEAR - License: PHP License - By Stephan Schmidt (lead)

Swiss-army knive for reading and writing XML files. Creates XML files from data structures and vice versa.

A.32.13.1 Description

XML_Serializer serializes complex data structures like arrays or object as XML documents. This class helps you generating any XML document you require without the need for DOM. Furthermore this package can be used as a replacement to serialize() and unserialize() as it comes with a matching XML_Unserializer that is able to create PHP data strcutures (like arrays and objects) from XML documents, if type hints are available.

If you use the XML_Unserialzer on standard XML files, it will try to guess how it has to be unserialized. In most cases it does exactly what you expect it to do.

Try reading a RSS file with XML_Unserializer and you have the whole RSS file in a structured array or even a collection of objects, similar to XML_RSS.

Since version 0.8 the package is able to treat XML documents like the simplexml extension of PHP 5.

A.32.14. XML_sql2xml

Repository: PEAR - License: PHP License - By Christian Stocker (lead)

Returns XML from a SQL-Query.

A.32.14.1 Description

This class takes a PEAR::DB-Result Object, a sql-query-string, an array and/or an xml-string/file and returns a xml-representation of it. It relies on the DOMXML extension of PHP.

A.32.15. XML_Statistics

Repository: PEAR - License: PHP License - By Stephan Schmidt (lead)

Class to obtain statistical information from an XML documents.

A.32.15.1 Description

XML_Statistics is able to retrieve statistics about tags, attributes, entities, processing instructions and CDaata chunks in any XML document.

A.32.16. XML_SVG

Repository: - License: LGPL -

XML_SVG API

A.32.16.1 Description

This package provides an object-oriented API for building SVG documents.

A.32.17. XML_svg2image

Repository: PEAR - License: PHP License - By Christian Stocker (lead)

Converts a svg file to a png/jpeg image

A.32.17.1 Description

Converts a svg file to a png/jpeg image with the help of apache-batik (java-program), needs therefore a php with ext/java compiled-in and the batik files from http://xml.apache.org/batik

A.32.18. XML_Transformer

Repository: PEAR - License: PHP License - By Sebastian Bergmann (lead) - Kristian Köhntopp (developer)

XML Transformations in PHP

A.32.18.1 Description

With the XML/Transformer class one can easily bind PHP functionality to XML tags, thus transforming the input XML tree into an output XML tree without the need for XSLT.

A.32.19. XML_Tree

Repository: PEAR - License: PHP - By Bernd Römer (lead) - Tomas V.V.Cox (lead)

Represent XML data in a tree structure

A.32.19.1 Description

Allows for the building of XML data structures using a tree representation, without the need for an extension like DOMXML.

A.32.20. XML_Util

Repository: PEAR - License: PHP License - By Stephan Schmidt (lead)

XML utility class.

A.32.20.1 Description

Selection of methods that are often needed when working with XML documents. Functionality includes creating of attribute lists from arrays, creation of tags, validation of XML names and more.

A.32.21. XML_Wddx

Repository: PEAR - License: PHP License - By Alan Knowles (lead)

Wddx pretty serializer and deserializer

A.32.21.1 Description

XML_Wddx does 2 things:

  1. a drop in replacement for the XML_Wddx extension (if it's not built in)

  2. produce an editable wddx file (with indenting etc.) and uses CDATA, rather than char tags

This package contains 2 static method:

XML_Wddx:serialize($value)

XML_Wddx:deserialize($value)

should be 90% compatible with wddx_deserialize(), and the deserializer will use wddx_deserialize if it is built in. No support for recordsets is available at present in the PHP version of the deserializer.

A.32.22. XML_XPath

Repository: PEAR - License: PHP License - By Dan Allen (lead)

The PEAR::XML_XPath class provided an XPath/DOM XML manipulation, maneuvering and query interface.

A.32.22.1 Description

The PEAR::XML_XPath class provided an XPath/DOM XML manipulation, maneuvering and query interface.

The class allows for easy manipulation, maneuvering and querying of a domxml tree using both xpath queries and DOM walk functions. It uses an internal pointer for all methods on which the action is performed. Results from an dom/xpath query are returned as an XPath_Result object, which contains an internal array of DOM nodes and which extends the common DOM class and hence contains all the DOM functions from the main object to run on each of the elements in the internal array. This class tries to hold as close as possible to the DOM Recommendation. You MUST have the domxml extension to use this class. The XML_XPath class was inspired by a class maintained by Nigel Swinson called phpxpath. The phpxpath class does not rely on PHP xmldom functions and is therefore a sibling to this class: http://sourceforge.net/projects/phpxpath

A.32.23. XML_XSLT_Wrapper

Repository: PEAR - License: PHP License - By Pierre-Alain Joye (lead) - Arnaud Limbourg (contributor)

Provides a single interface to the different XSLT interface or commands

A.32.23.1 Description

This package was written to provide a simpler, cross-library and cross commands interface to doing XSL transformations.

It provides :

  • support for :

    • DOM XSLT php extension

    • XSLT php extension

    • XSLT command line tool (xsltproc)

    • MSXML using COM php extension

    • XT command line (http://www.blnz.com/xt/xt-20020426a-src/butorindex.html)

    • Sablotron command line (http://www.gingerall.com/charlie/ga/act/gadoc.act?pg=sablot#i__1940) Planned interface :

      • XT java interface

      • xml.apache.org java and C interface (http://xml.apache.org)

      • Instant Saxon (http://users.iclway.co.uk/mhkay/saxon/instant.html)

  • Batch mode

    • XML: multiple transformations of a single XML file

    • XSL: multiple transformations of multiple XML files using a single XSL

See http://www.pearfr.org/xslt_wrapper/ for samples and documentation

A.32.24. XML_XUL

Repository: PEAR - License: PHP License - By Stephan Schmidt (lead)

Class to build Mozilla XUL applications.

A.32.24.1 Description

The XML User Interface Language (XUL) is a markup language for describing user interfaces. With XUL you can create rich, sophisticated cross-platform web applications easily. XML_XUL provides a API similar to DOM to create XUL applications. There's a PHP object for each XUL element, and the more complex widgets like grids, trees and tabboxes can easily be created with these objects.



    PHP 5 Power Programming
    PHP 5 Power Programming
    ISBN: 013147149X
    EAN: 2147483647
    Year: 2003
    Pages: 240

    Similar book on Amazon

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net