Files
2026-07-01 16:44:17 +03:00

39 lines
706 B
PHP

<?php namespace ZN\XML;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
class Check
{
/**
* Controls whether an XML document is valid.
*
* @param string $xml
*
* @return bool
*/
public static function check(string $xml) : bool
{
if( empty($xml) )
{
return false;
}
libxml_use_internal_errors(true);
simplexml_load_string($xml);
$return = ! (bool) libxml_get_errors();
libxml_clear_errors();
return $return;
}
}