I use PHP xmlreader to validate and parse XML data. This xml is checked using some xsd schema from the local file using the XMLReader :: setSchema function and the remote xsd schema from http: // via xsd: import / include. Eveything works fine, but it retrieves the xsd schema from the network and reads from disk every time it is called.
So my questions are:
Is there any way to cache the remote xsd scheme in local RAM? For local schema files, I think tmpfs on Linux will work fine, but is there any other way to cache local xsd schema files?
Decision
Thanks to VolkerK for pointing out the xmlcatalog system. It works great with libxml / php xmlreader. On Linux, just edit the / etc / xml / catalog file (it comes from xml-common when you are in Fedora) add some entries, for example (for example):
<rewriteURI uriStartString="http://schemas.xmlsoap.org/soap/envelope/" rewritePrefix="/etc/xml/SOAP-Envolope.xsd"/> <rewriteURI uriStartString="http://schemas.xmlsoap.org/soap/encoding/" rewritePrefix="/etc/xml/SOAP-Encoding.xsd"/>
and a manual loading scheme (for example, http://schemas.xmlsoap.org/soap/encoding/ โ /etc/xml/SOAP-Encoding.xsd), then the PHP xmlreader file works as expected when parsing SOAP messages.
source share