chombium Posted October 17, 2007 Share Posted October 17, 2007 Hi, I need to write a client for a web service that sends XML file as a response which I gave to validate. Is there a way to validate a XML file against some .XSD schema in PHP4? Something similar to DomDocument class in PHP5 TIA, chombium Quote Link to comment https://forums.phpfreaks.com/topic/73689-solved-xml-validation-in-php4/ Share on other sites More sharing options...
chombium Posted October 25, 2007 Author Share Posted October 25, 2007 I've created a function that calls external program xmllinit which is a part of libxml2 here is the function: // validation of the xml via external call to xmllint // xml - full path to the xml file // schema - full path to the xml schema file // NOTE: // This method is used because there isn't way to validate xml against // xml schema in PHP4. For PHP5 you can use the DomDocument class function validateXML ($xml, $schema) { exec("xmllint --schema $schema $xml",$output, $return_var); return $return_var; } The return value is the returned value from the execution of xmllinit program. You can find the return values at http://xmlsoft.org/xmllint.html HTH, chombium Quote Link to comment https://forums.phpfreaks.com/topic/73689-solved-xml-validation-in-php4/#findComment-377761 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.