|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-02-07 17:16 UTC] gordon at onlinehome dot de
Description: ------------ Libxml can use catalog files to provide a local cache mechanism allowing to load the entities associated to public identifiers or remote resources. There is currently no way to configure the catalog file path from PHP. Configuring the path in libxml itself seems possible: > The user can change the default catalog behaviour by redirecting queries to its own set of catalogs. This can be done by setting the XML_CATALOG_FILES environment variable to a list of catalogs, an empty one should deactivate loading the default /etc/xml/catalog default catalog. It would be nice if PHP's libxml extension would provide a way to set the path somehow. This could be helpful when validating documents with remote System Identifiers, like any HTML DTD. Or simply to bundle files with an application. Related Resources: - http://xmlsoft.org/catalog.html - http://www.w3.org/blog/systeam/2008/02/08/w3c_s_excessive_dtd_traffic - http://bugs.php.net/48080 - http://bugs.php.net/32426 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 18:00:01 2025 UTC |
> The user can change the default catalog behaviour by redirecting queries to its own set of catalogs. This can be done by setting the XML_CATALOG_FILES environment variable to a list of catalogs, an empty one should deactivate loading the default /etc/xml/catalog default catalog. If I understand this right, you can use this code to set your own catalog: setenv("XML_CATALOG_FILES=/path/to/catalog.xml"); I tried that, because I have to use xml catalog somehow, without overwriting the http stream wrapper, which is a non-threadsafe way to do this. However, the catalog.xml I specified using setenv seems not to be used by libxml2.setenv("XML_CATALOG_FILES=/path/to/catalog.xml"); should normally work (depending which dialect that as) if it's set before PHP starts and loads the extension and the path to the catalog XML file does not contain any spaces (which has a special meaning). See as well: http://www.cafeconleche.org/books/effectivexml/chapters/47.html http://www.chlab.ch/blog/archives/php/soap/cache-soap-envelope-schema-schema- validation http://wp.me/pLEEp-nlj To change things at runtime, make use of libxml_set_external_entity_loader and implement a catalog parser your own. You then can use catalogs as you wish at runtime.