# jc-importer/2.7.12/class/Common/Importer/DataParser.php

Import WP – CSV &amp; XML Import Export for WordPress, version 2.7.12. 57 lines.

- Page: https://pluginprobe.com/plugins/jc-importer/2.7.12/code/class/Common/Importer/DataParser.php
- Raw: https://pluginprobe.com/plugins/jc-importer/2.7.12/raw/class/Common/Importer/DataParser.php
- Modified: 2020-09-22T19:27:48+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/jc-importer/2.7.12/code/class/Common/Importer/DataParser.php#L10-L20`.

```php
<?php

namespace ImportWP\Common\Importer;

/**
 * Class DataParser
 *
 * Run all template queries on xml record.
 *
 * @package ImportWP\Common\Importer
 */
class DataParser
{
    private $config_data;

    /**
     * @var ParserInterface $parser
     */
    private $parser;

    /**
     * @var MapperInterface $mapper
     */
    private $mapper;

    public function __construct(ParserInterface $parser, MapperInterface $mapper, $config_data)
    {
        $this->parser      = $parser;
        $this->config_data = $config_data;
        $this->mapper      = $mapper;
    }

    /**
     * Get record from parser matching the template
     *
     * @param int $index
     *
     * @return ParsedData
     */
    public function get($index)
    {

        $parsed_data = new ParsedData($this->mapper);

        if ($this->config_data) {
            foreach ($this->config_data as $group) {
                $data = $this->parser->getRecord($index)
                    ->queryGroup($group);

                $parsed_data->add($data, $group);
            }
        }

        return $parsed_data;
    }
}

```
