Section 8.8. Summary


8.8. Summary

XML was designed mainly for use in exchanging information across systems. XML has its own terminology that describes the structure of XML documents. The information is enclosed in tags that identify the information in a structured manner. To receive the actual information from XML documents in order to use it, you must parse the documents. PHP provides two mainstream parsers that you can use: SAX (Simple API for XML), which parses each element in the document as it comes to it, and DOM (Document Object Model), which creates a hierarchical tree in memory containing the structure of the entire document and then parses it all at once. PHP 5 also provides an easier extension for parsing simple XML documents: SimpleXML. PEAR provides packages useful for parsing in specific situations or for specific purposes.

Often, you want to convert the XML document into a document with a different format, such as an HTML document or a text file. The standard method for converting XML is XSLT. XSLT uses stylesheets to convert documents, with specific templates for converting each element in the XML document. XSLT translation in PHP is provided by the XSLT extension.

For applications on different systems to communicate, you need to use a protocol that both systems understand. XML files are ASCII files, which provide a standard format that systems understand. Two standard solutions for application communication are available in PHP: XML-RPC, which allows a client to execute methods on a server, and SOAP, which specifies a format for exchanging data across systems. Both are similar client-server protocols. However, SOAP is a more complex, broader protocol with more potential future applications.



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

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