Jump to content

[SOLVED] XML validation in PHP4


chombium

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.