MENU
PHP Integration
PHP's primary XML API is the DOM extension, built on libxml2 3,427 . This chapter covers PHP's DOM classes and their use for reading, writing, validating, querying (XPath), and transforming (XSLT) XML documents.Other PHP extensions also handle XML: SimpleXML and XMLReader offer lighter-weight alternatives to DOM. For XQuery support in PHP, a third-party option is Zorba.
Subtopics:
- DOM Reference – PHP's DOMNode, DOMDocument, DOMElement, and related classes.
- Reading – loading an XML document, including XInclude processing, with DOMDocument.
- Writing – building and saving an XML document with DOMDocument.
- PHP Validation – validating a loaded document against RelaxNG or XSD.
- PHP XPath – evaluating XPath expressions with DOMXPath.
- PHP XSLT – applying an XSLT stylesheet with XSLTProcessor.