XBRL.php
private function includeSchemas( $taxonomy_schema, $xmlDocument, $targetNamespace, $depth )
	{
		$includes = $xmlDocument->children( "http://www.w3.org/2001/XMLSchema" )->include;
		if ( ! $includes ) return false;

		$basenames = array();
		foreach ( $includes as $key => $include )
		{
			if ( ! property_exists( $include->attributes(), 'schemaLocation' ) ) continue;
			$basename = basename( (string) $include->attributes()->schemaLocation );
			$basenames[] = $basename;

			$includeFile = XBRL::resolve_path( $taxonomy_schema, (string) $include->attributes()->schemaLocation );
			$includeDocument = $this->getXml( $includeFile, $this->context );

			// Check the file exists
			if ( ! $includeDocument )
			{
				if ( XBRL::isValidating() )
				$this->log()->taxonomy_validation( "5.1", "The xml schema document referenced in the 'include' tag is not valid",
					array(
						'include' => "'$basename'",
					)
				);

				return null;
			}

			// Check the target namespace is the same if one is provided
			$namespace = (string) $includeDocument['targetNamespace'];
			if ( ! empty( $namespace ) && $namespace != $targetNamespace )
			{
				if ( XBRL::isValidating() )
				$this->log()->taxonomy_validation( "5.1", "The namespace of the schema file to include is not the same as that if the main schema file",
					array(
						'expected' => "'$targetNamespace'",
						'actual' => "'$namespace'",
					)
				);

				return null;
			}

			$this->includedFiles[] = $includeFile;
			$this->context->schemaFileToNamespace[ $includeFile ] = $targetNamespace;
			$this->context->schemaFileToNamespace[ basename( $includeFile ) ] = $targetNamespace;

			// Note the use of the schemaLocation variable of *$this* because the component of the
			// included file are really being added to the current schema.
			$this->including = true;
			// $taxonomy = $this->loadSchema( $this->schemaLocation, $includeDocument, $targetNamespace, $depth + 1 );
			$taxonomy = $this->loadSchema( $includeFile, $includeDocument, $targetNamespace, $depth + 1 );
			$this->including = false;
		}

		return true;
	}
private function includeSchemas( $taxonomy_schema, $xmlDocument, $targetNamespace, $depth )
	{
		$includes = $xmlDocument->children( "http://www.w3.org/2001/XMLSchema" )->include;
		if ( ! $includes ) return false;

		$basenames = array();
		foreach ( $includes as $key => $include )
		{
			if ( ! property_exists( $include->attributes(), 'schemaLocation' ) ) continue;
			$basename = basename( (string) $include->attributes()->schemaLocation );
			$basenames[] = $basename;

			$includeFile = XBRL::resolve_path( $taxonomy_schema, (string) $include->attributes()->schemaLocation );
			$includeDocument = $this->getXml( $includeFile, $this->context );

			// Check the file exists
			if ( ! $includeDocument )
			{
				if ( XBRL::isValidating() )
				$this->log()->taxonomy_validation( "5.1", "The xml schema document referenced in the 'include' tag is not valid",
					array(
						'include' => "'$basename'",
					)
				);

				return null;
			}

			// Check the target namespace is the same if one is provided
			$namespace = (string) $includeDocument['targetNamespace'];
			if ( ! empty( $namespace ) && $namespace != $targetNamespace )
			{
				if ( XBRL::isValidating() )
				$this->log()->taxonomy_validation( "5.1", "The namespace of the schema file to include is not the same as that if the main schema file",
					array(
						'expected' => "'$targetNamespace'",
						'actual' => "'$namespace'",
					)
				);

				return null;
			}

			$this->includedFiles[] = $includeFile;
			$this->context->schemaFileToNamespace[ $includeFile ] = $targetNamespace;
			$this->context->schemaFileToNamespace[ basename( $includeFile ) ] = $targetNamespace;

			// Note the use of the schemaLocation variable of *$this* because the component of the
			// included file are really being added to the current schema.
			$this->including = true;
			// $taxonomy = $this->loadSchema( $this->schemaLocation, $includeDocument, $targetNamespace, $depth + 1 );
			$taxonomy = $this->loadSchema( $includeFile, $includeDocument, $targetNamespace, $depth + 1 );
			$this->including = false;
		}

		return true;
	}
private function includeSchemas ( $ taxonomy_schema , $ xmlDocument , $ targetNamespace , $ depth ) { $ includes = $ xmlDocument -> children ( "http://www.w3.org/2001/XMLSchema" ) -> include ; if ( ! $ includes ) return false ; $ basenames = array ( ) ; foreach ( $ includes as $ key => $ include ) { if ( ! property_exists ( $ include -> attributes ( ) , 'schemaLocation' ) ) continue ; $ basename = basename ( ( string ) $ include -> attributes ( ) -> schemaLocation ) ; $ basenames [ ] = $ basename ; $ includeFile = XBRL :: resolve_path ( $ taxonomy_schema , ( string ) $ include -> attributes ( ) -> schemaLocation ) ; $ includeDocument = $ this -> getXml ( $ includeFile , $ this -> context ) ; // Check the file exists
 if ( ! $ includeDocument ) { if ( XBRL :: isValidating ( ) ) $ this -> log ( ) -> taxonomy_validation ( "5.1" , "The xml schema document referenced in the 'include' tag is not valid" , array ( 'include' => "'$basename'" , ) ) ; return null ; } // Check the target namespace is the same if one is provided
 $ namespace = ( string ) $ includeDocument [ 'targetNamespace' ] ; if ( ! empty ( $ namespace ) && $ namespace != $ targetNamespace ) { if ( XBRL :: isValidating ( ) ) $ this -> log ( ) -> taxonomy_validation ( "5.1" , "The namespace of the schema file to include is not the same as that if the main schema file" , array ( 'expected' => "'$targetNamespace'" , 'actual' => "'$namespace'" , ) ) ; return null ; } $ this -> includedFiles [ ] = $ includeFile ; $ this -> context -> schemaFileToNamespace [ $ includeFile ] = $ targetNamespace ; $ this -> context -> schemaFileToNamespace [ basename ( $ includeFile ) ] = $ targetNamespace ; // Note the use of the schemaLocation variable of *$this* because the component of the
 // included file are really being added to the current schema.
 $ this -> including = true ; // $taxonomy = $this->loadSchema( $this->schemaLocation, $includeDocument, $targetNamespace, $depth + 1 );
 $ taxonomy = $ this -> loadSchema ( $ includeFile , $ includeDocument , $ targetNamespace , $ depth + 1 ) ; $ this -> including = false ; } return true ; }
Includes the content of one schema inside another.  Really the included file is
an addition to the parent schema so the file name will be the same and the
target namespace MUST be the same

@param string $taxonomy_schema The file containing the taxonomy xsd
@param SimpleXMLElement $xmlDocument
@param string $targetNamespace The namespace of the taxonomy being loaded
@param int $depth The nesting level of this call.  Used to indent any echo'd output
@return SimpleXMLElement|null
Includes the content of one schema inside another . Really the included file is an addition to the parent schema so the file name will be the same and the target namespace MUST be the same