PHP Libxml Functions
PHP Libxml Introduction
Libxml functions and constants are used together with the SimpleXML, XSLT and DOM functions.
Installation
These functions require the Libxml package. Download at xmlsoft.org
PHP Libxml Functions
PHP: indicates the earliest PHP version that supports this function.
| function | Description | PHP |
|---|---|---|
| libxml_clear_errors() | Clears the Libxml error buffer. | 5 |
| libxml_get_errors() | Retrieves an array of errors. | 5 |
| libxml_get_last_error() | Retrieves the last error from Libxml. | 5 |
| libxml_set_streams_context() | Sets the stream environment for the next Libxml document load or write. | 5 |
| libxml_use_internal_errors() | Disables Libxml errors, allowing the user to read error information on demand. | 5 |
PHP Libxml Constants
| function | Description | PHP |
|---|---|---|
| LIBXML_COMPACT | Sets small node allocation optimization. Improves application performance. | 5 |
| LIBXML_DTDATTR | Sets default DTD attributes. | 5 |
| LIBXML_DTDLOAD | Loads the external subset. | 5 |
| LIBXML_DTDVALID | Performs validation via DTD. | 5 |
| LIBXML_NOBLANKS | Removes empty nodes. | 5 |
| LIBXML_NOCDATA | Sets CDATA as text nodes. | 5 |
| LIBXML_NOEMPTYTAG | Changes empty tags (such as
to ). Only available in the DOMDocument->save() and DOMDocument->saveXML() functions. |
5 |
| LIBXML_NOENT | Substitutes entities. | 5 |
| LIBXML_NOERROR | Does not show error reports. | 5 |
| LIBXML_NONET | Stops network access when loading documents. | 5 |
| LIBXML_NOWARNING | Does not show warning reports. | 5 |
| LIBXML_NOXMLDECL | Omits the XML declaration when saving documents. | 5 |
| LIBXML_NSCLEAN | Removes extra namespace declarations. | 5 |
| LIBXML_XINCLUDE | Uses XInclude substitution. | 5 |
| LIBXML_ERR_ERROR | Gets a recoverable error. | 5 |
| LIBXML_ERR_FATAL | Gets a fatal error. | 5 |
| LIBXML_ERR_NONE | Gets no error. | 5 |
| LIBXML_ERR_WARNING | Gets a simple warning. | 5 |
| LIBXML_VERSION | Gets the Libxml version (e.g.: 20605 or 20617) | 5 |
| LIBXML_DOTTED_VERSION | Gets the Libxml version with dots (e.g.: 2.6.5 or 2.6.17). | 5 |