/** * * @param type $path * @param \import\Schema $schema * @param \PDO $PDO */ public function __construct($xmlPath, \import\Document $document) { parent::__construct($xmlPath, $document); $this->PDO = $this->document->getPDO(); $this->id = $this->PDO->query("SELECT nextval('import_tmp_seq')")->fetchColumn(); $query = $this->PDO->prepare("INSERT INTO import_tmp VALUES (?, ?)"); $query->execute(array($this->id, preg_replace('/^[^<]*/', '', file_get_contents($this->xmlPath)))); }
/** * * @param \utils\readContent\ReadContentInterface $xml * @param \import\Document $document * @param type $export should an export() call be available * @throws \RuntimeException */ public function __construct($xmlPath, \import\Document $document, $export = false) { parent::__construct($xmlPath, $document); $this->reader = new \XMLReader(); $tokenXPath = $this->document->getSchema()->getTokenXPath(); if (!preg_match('|^//[a-zA-Z0-9_:.]+$|', $tokenXPath)) { throw new \RuntimeException('Token XPath is too complicated for XMLReader'); } $this->tokenXPath = mb_substr($tokenXPath, 2); $nsPrefixPos = mb_strpos($this->tokenXPath, ':'); if ($nsPrefixPos !== false) { $prefix = mb_substr($this->tokenXPath, 0, $nsPrefixPos); $ns = $this->document->getSchema()->getNs(); if (isset($ns[$prefix])) { $this->tokenXPath = $ns[$prefix] . mb_substr($this->tokenXPath, $nsPrefixPos); } } if ($export) { $filename = tempnam(sys_get_temp_dir(), ''); $this->outStream = new \SplFileObject($filename, 'w'); $this->outStream->fwrite('<?xml version="1.0" encoding="UTF-8" standalone="no"?>' . "\n"); } }
public function __construct($input = NULL) { parent::__construct(is_array($input) ? $input : $this->parse($input)); $this->ignored = array(self::T_COMMENT, self::T_WHITESPACE); }
/** * * @param type $path */ public function __construct($xmlPath, \import\Document $document) { parent::__construct($xmlPath, $document); }