Skip to content

Validate

bseddon edited this page Apr 19, 2017 · 2 revisions

Validate instance documents

Instance documents are validated using the instance call validate function. Here's an example:

$instance = XBRL_Instance::FromInstanceDocument( 'my_instance_document.xml' );
$instance->validate();
if ( XBRL_Log::getInstance()->hasConformanceIssueWarning() )
{
    echo "Validation error\n";
}

The validate function evaluates the instance and logs an errors through the default global logging instance (see How do I... Change the logging to learn how to change the default logging options). If there is an validation failure the hasConformanceIssueWarning function will return true.

Validate taxonomy

Unlike the instance validation, taxonomy validation is performed as the taxonomy is read if the validation flag is set. The flag is set by calling XBRL::setValidationState. When this function is called without a parameter logging is enabled. It can also be called passing a value of 'false' to disable validation. By default, validation is not enabled.

Once the taxonomy has been loaded the validation status can be accessed using the same technique as an instance document:

if ( XBRL_Log::getInstance()->hasConformanceIssueWarning() )
{
    echo "Validation error\n";
}
Clone this wiki locally