PHP - libxml
These functions/constants are available as of PHP 5.1.0, and the following core extensions rely on this libxml extension: DOM, libxml, SimpleXML, SOAP, WDDX, XSL, XML, XMLReader, XMLRPC and XMLWriter.
Installation
There is no installation needed to use this extension. This extension is a part of the PHP core. This extension is enabled by default. It may be disabled by using the following option at compile time: --disable-libxml.
Runtime Configuration
This extension has no configuration directives defined in php.ini.
PHP libXMLError Class
Class | Description |
---|---|
libXMLError | Contains various information about errors thrown by libxml. |
PHP libxml Functions
Functions | Description |
---|---|
libxml_clear_errors() | Clears libxml error buffer. |
libxml_disable_entity_loader() | Disable the ability to load external entities. |
libxml_get_errors() | Retrieve array of errors. |
libxml_get_last_error() | Retrieve last error from libxml. |
libxml_set_external_entity_loader() | Changes the default external entity loader. |
libxml_set_streams_context() | Set the streams context for the next libxml document load or write. |
libxml_use_internal_errors() | Disables the standard libxml errors and enables user error handling. |
PHP libxml Predefined Constants
The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime.
Constants | Type | Description |
---|---|---|
LIBXML_BIGLINES | Integer | Allows line numbers greater than 65535 to be reported correctly. |
LIBXML_COMPACT | Integer | Activate small nodes allocation optimization. This may improve the application performance. |
LIBXML_DTDATTR | Integer | Default DTD attributes. |
LIBXML_DTDLOAD | Integer | Load the external subset. |
LIBXML_DTDVALID | Integer | Validate with the DTD. |
LIBXML_HTML_NOIMPLIED | Integer | Sets HTML_PARSE_NOIMPLIED flag, which turns off the automatic adding of implied html/body... elements. |
LIBXML_HTML_NODEFDTD | Integer | Sets HTML_PARSE_NODEFDTD flag, which prevents a default doctype being added when one is not found. |
LIBXML_NOBLANKS | Integer | Remove blank nodes. |
LIBXML_NOCDATA | Integer | Merge CDATA as text nodes. |
LIBXML_NOEMPTYTAG | Integer | Expand empty tags (e.g. <br/> to <br></br>). This option is currently available in the DOMDocument::save and DOMDocument::saveXML functions. |
LIBXML_NOENT | Integer | Substitute entities. Caution: Enabling entity substitution may facilitate XML External Entity (XXE) attacks. |
LIBXML_NOERROR | Integer | Suppress error reports. |
LIBXML_NONET | Integer | Disable network access when loading documents. |
LIBXML_NOWARNING | Integer | Suppress warning reports. |
LIBXML_NOXMLDECL | Integer | Drop the XML declaration when saving a document. |
LIBXML_NSCLEAN | Integer | Remove redundant namespace declarations. |
LIBXML_PARSEHUGE | Integer | Sets XML_PARSE_HUGE flag, which relaxes any hard-coded limit from the parser. This affects limits like maximum depth of a document or the entity recursion, as well as limits of the size of text nodes. |
LIBXML_PEDANTIC | Integer | Sets XML_PARSE_PEDANTIC flag, which enables pedantic error reporting. |
LIBXML_XINCLUDE | Integer | Implement XInclude substitution. |
LIBXML_ERR_ERROR | Integer | A recoverable error. |
LIBXML_ERR_FATAL | Integer | A fatal error. |
LIBXML_ERR_NONE | Integer | No errors. |
LIBXML_ERR_WARNING | Integer | A simple warning. |
LIBXML_VERSION | Integer | libxml version like 20605 or 20617. |
LIBXML_DOTTED_VERSION | String | ibxml version like 2.6.5 or 2.6.17. |
LIBXML_SCHEMA_CREATE | Integer | Create default/fixed value nodes during XSD schema validation. |