controller/jobs/src/Controller/Jobs/Catalog/Import/Xml/Standard.php
protected function importTree( \XMLReader $xml, array $domains, $parentid = null, array $map = [] )
	{
		$total = 0;
		$childMap = [];
		$currentid = $parentid;

		while( $xml->read() === true )
		{
			if( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalogitem' )
			{
				if( ( $node = $xml->expand() ) === false )
				{
					$msg = sprintf( 'Expanding "%1$s" node failed', 'catalogitem' );
					throw new \Aimeos\Controller\Jobs\Exception( $msg );
				}

				if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) {
					unset( $map[$attr->nodeValue] );
				}

				$currentid = $this->importNode( $node, $domains, $parentid, $childMap );
				$total++;
			}
			elseif( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalog' )
			{
				$this->importTree( $xml, $domains, $currentid, $childMap );
				$childMap = [];
			}
			elseif( $xml->nodeType === \XMLReader::END_ELEMENT && $xml->name === 'catalog' )
			{
				\Aimeos\MShop::create( $this->getContext(), 'catalog' )->deleteItems( $map );
				break;
			}
		}
	}
protected function importTree( \XMLReader $xml, array $domains, $parentid = null, array $map = [] )
	{
		$total = 0;
		$childMap = [];
		$currentid = $parentid;

		while( $xml->read() === true )
		{
			if( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalogitem' )
			{
				if( ( $node = $xml->expand() ) === false )
				{
					$msg = sprintf( 'Expanding "%1$s" node failed', 'catalogitem' );
					throw new \Aimeos\Controller\Jobs\Exception( $msg );
				}

				if( ( $attr = $node->attributes->getNamedItem( 'ref' ) ) !== null ) {
					unset( $map[$attr->nodeValue] );
				}

				$currentid = $this->importNode( $node, $domains, $parentid, $childMap );
				$total++;
			}
			elseif( $xml->nodeType === \XMLReader::ELEMENT && $xml->name === 'catalog' )
			{
				$this->importTree( $xml, $domains, $currentid, $childMap );
				$childMap = [];
			}
			elseif( $xml->nodeType === \XMLReader::END_ELEMENT && $xml->name === 'catalog' )
			{
				\Aimeos\MShop::create( $this->getContext(), 'catalog' )->deleteItems( $map );
				break;
			}
		}
	}
protected function importTree ( \ XMLReader $ xml , array $ domains , $ parentid = null , array $ map = [ ] ) { $ total = 0 ; $ childMap = [ ] ; $ currentid = $ parentid ; while ( $ xml -> read ( ) === true ) { if ( $ xml -> nodeType === \ XMLReader :: ELEMENT && $ xml -> name === 'catalogitem' ) { if ( ( $ node = $ xml -> expand ( ) ) === false ) { $ msg = sprintf ( 'Expanding "%1$s" node failed' , 'catalogitem' ) ; throw new \ Aimeos \ Controller \ Jobs \ Exception ( $ msg ) ; } if ( ( $ attr = $ node -> attributes -> getNamedItem ( 'ref' ) ) !== null ) { unset ( $ map [ $ attr -> nodeValue ] ) ; } $ currentid = $ this -> importNode ( $ node , $ domains , $ parentid , $ childMap ) ; $ total ++ ; } elseif ( $ xml -> nodeType === \ XMLReader :: ELEMENT && $ xml -> name === 'catalog' ) { $ this -> importTree ( $ xml , $ domains , $ currentid , $ childMap ) ; $ childMap = [ ] ; } elseif ( $ xml -> nodeType === \ XMLReader :: END_ELEMENT && $ xml -> name === 'catalog' ) { \ Aimeos \ MShop :: create ( $ this -> getContext ( ) , 'catalog' ) -> deleteItems ( $ map ) ; break ; } } }
Imports the catalog document

@param \XMLReader $xml Catalog document to import
@param string[] $domains List of domain names whose referenced items will be updated in the catalog items
@param string|null $parentid ID of the parent catalog node
@param array $map Associative list of catalog code as keys and category ID as values
Imports the catalog document