Ejemplo n.º 1
0
 /**
  * Проверка по схеме
  */
 public function validate($schemaPath)
 {
     $xr = new XMLReader();
     $xr->XML($this->toXmlStr());
     $xr->setSchema($schemaPath);
     while ($xr->read()) {
     }
 }
Ejemplo n.º 2
0
 public static function validate($uri, $only_well_formedness = false)
 {
     if (!$uri) {
         return false;
     }
     // try to find the XSD and fail if it cannot
     if ($xsd = self::get_schema_location($uri)) {
         $schema_location = $xsd;
     } else {
         return array("There was no XSD defined in this XML file");
     }
     // we have had problems in the past with Services being unavailable, so
     // instead of checking there just use the local schemas which are the same
     if ($schema_location == 'http://services.eol.org/schema/content_0_1.xsd') {
         $schema_location = WEB_ROOT . 'applications/schema/content_0_1.xsd';
     }
     if ($schema_location == 'http://services.eol.org/schema/content_0_2.xsd') {
         $schema_location = WEB_ROOT . 'applications/schema/content_0_2.xsd';
     }
     if ($schema_location == 'http://services.eol.org/schema/content_0_3.xsd') {
         $schema_location = WEB_ROOT . 'applications/schema/content_0_3.xsd';
     }
     if ($schema_location == 'http://services.eol.org/schema/content_0_3_18.xsd') {
         $schema_location = WEB_ROOT . 'applications/schema/content_0_3_18.xsd';
     }
     if ($schema_location == 'http://services.eol.org/schema/content_0_4.xsd') {
         $schema_location = WEB_ROOT . 'applications/schema/content_0_4.xsd';
     }
     if ($schema_location == 'http://services.eol.org/schema/content_1_0.xsd') {
         $schema_location = WEB_ROOT . 'applications/schema/content_1_0.xsd';
     }
     libxml_use_internal_errors(true);
     libxml_clear_errors();
     $reader = new \XMLReader();
     $reader->open($uri, 'utf8');
     if (!$only_well_formedness) {
         if (@(!$reader->setSchema($schema_location))) {
             write_to_resource_harvesting_log("The specified schema could not be loaded or contained errors: {$schema_location}");
             return array("The specified schema could not be loaded or contained errors: {$schema_location}");
         }
     }
     libxml_clear_errors();
     while (@$reader->read()) {
         // empty loop to load errors into libxml error cache
         //if($reader->name == "#text") echo $reader->name .":". $reader->value."\n";
         // if(libxml_get_errors())
         // {
         //     echo libxml_get_last_error()->message."\n";
         //     libxml_clear_errors();
         // }
     }
     if ($errors = self::get_errors()) {
         write_to_resource_harvesting_log(implode(",", $errors));
         return $errors;
     }
     return true;
 }
Ejemplo n.º 3
0
 public function setSchema($filename)
 {
     if (!@parent::setSchema($filename)) {
         if (false !== ($error = libxml_get_last_error())) {
             libxml_clear_errors();
             $ex = new XmlParseException('Unable to load XML schema from "' . $filename . '"');
             $ex->addError(new XmlError($error->level, $error->message));
             throw $ex;
         }
         throw new XmlParseException('Unable to load XML schema from "' . $filename . '"');
     }
     $this->validateXmlSchema = true;
     return true;
 }
Ejemplo n.º 4
0
 public function parse($subject)
 {
     $classes = new IoCClasses();
     $xmlReader = new XMLReader();
     $xmlReader->XML($subject);
     $xmlReader->setSchema(dirname(__FILE__) . '/xmlValidator.xsd');
     while ($xmlReader->read()) {
         if ($xmlReader->nodeType == XMLReader::ELEMENT) {
             while ($xmlReader->name == 'classes') {
                 $classes->merge($this->readIoCStructure($xmlReader));
                 $xmlReader->next();
             }
         }
     }
     $xmlReader->close();
     return $classes;
 }
Ejemplo n.º 5
0
 /**
  * Sanity checks the XML input file, creates the XMLReader object.
  * 
  * @param string $path The XML file to parse.
  * @return \XMLReader
  * @throws XMLStreamItemExtractorException
  */
 private function getReader($path)
 {
     $this->file = $path;
     $this->reader = new XMLReader();
     if (!file_exists($this->file)) {
         throw new XMLStreamItemExtractorException("File {$this->file} does not exist.");
     } elseif (!is_readable($this->file)) {
         throw new XMLStreamItemExtractorException("File {$this->file} is not readable.");
     } elseif (!$this->reader->open($this->file)) {
         throw new XMLStreamItemExtractorException("File {$this->file} could not be opened by XMLReader.");
     }
     $this->reader->setSchema($this->schema);
     if (!$this->reader->read()) {
         throw new XMLStreamItemExtractorException("File {$this->file} is not valid or could not be read.");
     }
     return $this->reader;
 }
 protected function readDataBlock()
 {
     $v4b43b0aee35624cd95b910189b3dc231 = new XMLReader();
     $v4b43b0aee35624cd95b910189b3dc231->open($this->file_path);
     $v2245023265ae4cf87d02c8b6ba991139 = mainConfiguration::getInstance();
     $vf7c163939469a0b7becb4e4e6a94efac = $v2245023265ae4cf87d02c8b6ba991139->includeParam('system.kernel') . 'subsystems/import/schemes/' . $this->type . '.xsd';
     if (is_file($vf7c163939469a0b7becb4e4e6a94efac)) {
         $v4b43b0aee35624cd95b910189b3dc231->setSchema($vf7c163939469a0b7becb4e4e6a94efac);
     }
     $v9a09b4dfda82e3e665e31092d1c3ec8d = new DomDocument("1.0", "utf-8");
     $v07214c6750d983a32e0a33da225c4efd = array("Группа", "Товар", "Предложение");
     $vc00d122cde678a9551cae41dc45a40b7 = array('ОписаниеГрупп');
     $v95723b5e620e47cf613462b9f293282a = 0;
     $v4757fe07fd492a8be0ea6a760d683d6e = 0;
     $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v9a09b4dfda82e3e665e31092d1c3ec8d;
     $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->read();
     while ($v7aa28ed115707345d0274032757e8991) {
         switch ($v4b43b0aee35624cd95b910189b3dc231->nodeType) {
             case XMLReader::ELEMENT:
                 if (in_array($v4b43b0aee35624cd95b910189b3dc231->name, $vc00d122cde678a9551cae41dc45a40b7)) {
                     $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->next();
                     continue;
                 }
                 if (in_array($v4b43b0aee35624cd95b910189b3dc231->name, $v07214c6750d983a32e0a33da225c4efd)) {
                     if ($v4757fe07fd492a8be0ea6a760d683d6e++ < $this->offset) {
                         $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->next();
                         continue 2;
                     }
                     if ($v95723b5e620e47cf613462b9f293282a + 1 > $this->block_size) {
                         if ($v4b43b0aee35624cd95b910189b3dc231->name == "Предложение") {
                             $vd60db28d94d538bbb249dcc7f2273ab1 = DOMDocument::loadXML($v4b43b0aee35624cd95b910189b3dc231->readOuterXML());
                             if ($this->__getOffersCompare($v9a09b4dfda82e3e665e31092d1c3ec8d, $vd60db28d94d538bbb249dcc7f2273ab1, $v95723b5e620e47cf613462b9f293282a)) {
                                 break 2;
                             }
                         } else {
                             break 2;
                         }
                     }
                     $v95723b5e620e47cf613462b9f293282a++;
                 }
                 $v65c10911d8b8591219a21ebacf46da01 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createElement($v4b43b0aee35624cd95b910189b3dc231->name, $v4b43b0aee35624cd95b910189b3dc231->value);
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($v65c10911d8b8591219a21ebacf46da01);
                 if (!$v4b43b0aee35624cd95b910189b3dc231->isEmptyElement) {
                     $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v65c10911d8b8591219a21ebacf46da01;
                 }
                 if ($v4b43b0aee35624cd95b910189b3dc231->attributeCount) {
                     while ($v4b43b0aee35624cd95b910189b3dc231->moveToNextAttribute()) {
                         $v815be97df65d6c4b510cd07189c5347a = $v9a09b4dfda82e3e665e31092d1c3ec8d->createAttribute($v4b43b0aee35624cd95b910189b3dc231->name);
                         $v815be97df65d6c4b510cd07189c5347a->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createTextNode($v4b43b0aee35624cd95b910189b3dc231->value));
                         $v65c10911d8b8591219a21ebacf46da01->appendChild($v815be97df65d6c4b510cd07189c5347a);
                     }
                 }
                 $v3f02ab347aeca12e013036ce82046c38 = $this->__getNodePath($v5f0b6ebc4bea10285ba2b8a6ce78b863);
                 if ($v3f02ab347aeca12e013036ce82046c38 == "КоммерческаяИнформация/Классификатор/Группы") {
                     $v556216bbe3169f8132fe2b1683164988 = $v4b43b0aee35624cd95b910189b3dc231->readOuterXML();
                     $v1471e4e05a4db95d353cc867fe317314 = new DOMDocument('1.0', 'utf-8');
                     $v1471e4e05a4db95d353cc867fe317314->loadXML($v556216bbe3169f8132fe2b1683164988);
                     $v076933917d4df1df9aeaf50e0d25297b = $v1471e4e05a4db95d353cc867fe317314->getElementsByTagName('Группа');
                     foreach ($v076933917d4df1df9aeaf50e0d25297b as $vdb0f6f37ebeb6ea09489124345af2a45) {
                         if ($v4757fe07fd492a8be0ea6a760d683d6e++ < $this->offset) {
                             continue;
                         }
                         if ($v95723b5e620e47cf613462b9f293282a + 1 > $this->block_size) {
                             break;
                         }
                         $this->__collectGroup($v9a09b4dfda82e3e665e31092d1c3ec8d, $v65c10911d8b8591219a21ebacf46da01, $vdb0f6f37ebeb6ea09489124345af2a45);
                         $v95723b5e620e47cf613462b9f293282a++;
                     }
                     $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v5f0b6ebc4bea10285ba2b8a6ce78b863->parentNode;
                     $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->next();
                     continue 2;
                 }
                 break;
             case XMLReader::END_ELEMENT:
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v5f0b6ebc4bea10285ba2b8a6ce78b863->parentNode;
                 break;
             case XMLReader::ATTRIBUTE:
                 $v815be97df65d6c4b510cd07189c5347a = $v9a09b4dfda82e3e665e31092d1c3ec8d->createAttribute($v4b43b0aee35624cd95b910189b3dc231->name);
                 $v815be97df65d6c4b510cd07189c5347a->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createTextNode($v4b43b0aee35624cd95b910189b3dc231->value));
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($v815be97df65d6c4b510cd07189c5347a);
                 break;
             case XMLReader::TEXT:
                 $vc7824f3d4d5f7b2f22d034758c1e9454 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createTextNode($v4b43b0aee35624cd95b910189b3dc231->value);
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($vc7824f3d4d5f7b2f22d034758c1e9454);
                 break;
             case XMLReader::CDATA:
                 $vd9ef6bda8fb69f1c7e277bd1c2cd21d1 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createCDATASection($v4b43b0aee35624cd95b910189b3dc231->value);
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($vd9ef6bda8fb69f1c7e277bd1c2cd21d1);
                 break;
             case XMLReader::NONE:
             default:
         }
         $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->read();
     }
     $this->offset += $v95723b5e620e47cf613462b9f293282a;
     if (!$v7aa28ed115707345d0274032757e8991) {
         $this->complete = true;
     }
     return $v9a09b4dfda82e3e665e31092d1c3ec8d;
 }
Ejemplo n.º 7
0
 function ImportTemplate($file)
 {
     $result = array();
     $result["status"] = "";
     $result["log"] = array();
     $ierror = 0;
     //validate xml template file with openDCIMdevicetemplate.xsd
     libxml_use_internal_errors(true);
     $xml = new XMLReader();
     $xml->open($file);
     $resp = $xml->setSchema("openDCIMdevicetemplate.xsd");
     while (@$xml->read()) {
     }
     // empty loop
     $errors = libxml_get_errors();
     if (count($errors) > 0) {
         $result["status"] = __("No valid file");
         foreach ($errors as $error) {
             $result["log"][$ierror++] = $error->message;
         }
         return $result;
     }
     libxml_clear_errors();
     $xml->close();
     //read xml template file
     $xmltemplate = simplexml_load_file($file);
     //manufacturer
     $manufacturer = new Manufacturer();
     $manufacturer->Name = transform($xmltemplate->ManufacturerName);
     if (!$manufacturer->GetManufacturerByName()) {
         //New Manufacturer
         $manufacturer->CreateManufacturer();
     }
     $template = new DeviceTemplate();
     $template->ManufacturerID = $manufacturer->ManufacturerID;
     $template->Model = transform($xmltemplate->TemplateReg->Model);
     $template->Height = $xmltemplate->TemplateReg->Height;
     $template->Weight = $xmltemplate->TemplateReg->Weight;
     $template->Wattage = $xmltemplate->TemplateReg->Wattage;
     $template->DeviceType = $xmltemplate->TemplateReg->DeviceType;
     $template->PSCount = $xmltemplate->TemplateReg->PSCount;
     $template->NumPorts = $xmltemplate->TemplateReg->NumPorts;
     $template->Notes = trim($xmltemplate->TemplateReg->Notes);
     $template->Notes = $template->Notes == "<br>" ? "" : $template->Notes;
     $template->FrontPictureFile = $xmltemplate->TemplateReg->FrontPictureFile;
     $template->RearPictureFile = $xmltemplate->TemplateReg->RearPictureFile;
     $template->SNMPVersion = $xmltemplate->TemplateReg->SNMPVersion;
     $template->ChassisSlots = $template->DeviceType == "Chassis" ? $xmltemplate->TemplateReg->ChassisSlots : 0;
     $template->RearChassisSlots = $template->DeviceType == "Chassis" ? $xmltemplate->TemplateReg->RearChassisSlots : 0;
     //Check if picture files exist
     if ($template->FrontPictureFile != "" && file_exists("pictures/" . $template->FrontPictureFile)) {
         $result["status"] = __("Import Error");
         $result["log"][0] = __("Front picture file already exists");
         return $result;
     }
     if ($template->RearPictureFile != "" && file_exists("pictures/" . $template->RearPictureFile)) {
         $result["status"] = __("Import Error");
         $result["log"][0] = __("Rear picture file already exists");
         return $result;
     }
     //create the template
     if (!$template->CreateTemplate()) {
         $result["status"] = __("Import Error");
         $result["log"][0] = __("An error has occurred creating the template.<br>Possibly there is already a template of the same manufacturer and model");
         return $result;
     }
     //get template to this object
     $this->TemplateID = $template->TemplateID;
     $this->GetTemplateByID();
     //slots
     foreach ($xmltemplate->SlotReg as $xmlslot) {
         $slot = new Slot();
         $slot->TemplateID = $this->TemplateID;
         $slot->Position = intval($xmlslot->Position);
         $slot->BackSide = intval($xmlslot->BackSide);
         $slot->X = intval($xmlslot->X);
         $slot->Y = intval($xmlslot->Y);
         $slot->W = intval($xmlslot->W);
         $slot->H = intval($xmlslot->H);
         if ($slot->Position <= $this->ChassisSlots && !$slot->BackSide || $slot->Position <= $this->RearChassisSlots && $slot->BackSide) {
             if (!$slot->CreateSlot()) {
                 $result["status"] = __("Import Warning");
                 $result["log"][$ierror++] = sprintf(__("An error has occurred creating the slot %s"), $slot->Position . "-" . $slot->BackSide ? __("Rear") : __("Front"));
             }
         } else {
             $result["status"] = __("Import Warning");
             $result["log"][$ierror++] = sprintf(__("Ignored slot %s"), $slot->Position . "-" . $slot->BackSide ? __("Rear") : __("Front"));
         }
     }
     //ports
     foreach ($xmltemplate->PortReg as $xmlport) {
         //media type
         $mt = new MediaTypes();
         $mt->MediaType = transform($xmlport->PortMedia);
         if (!$mt->GetTypeByName()) {
             //New media type
             $mt->CreateType();
         }
         //color
         $cc = new ColorCoding();
         $cc->Name = transform($xmlport->PortColor);
         if (!$cc->GetCodeByName()) {
             //New color
             $cc->CreateCode();
         }
         $tport = new TemplatePorts();
         $tport->TemplateID = $this->TemplateID;
         $tport->PortNumber = intval($xmlport->PortNumber);
         $tport->Label = $xmlport->Label;
         $tport->MediaID = $mt->MediaID;
         $tport->ColorID = $cc->ColorID;
         $tport->PortNotes = $xmlport->PortNotes;
         if ($tport->PortNumber <= $this->NumPorts) {
             if (!$tport->CreatePort()) {
                 $result["status"] = __("Import Warning");
                 $result["log"][$ierror++] = sprintf(__("An error has occurred creating the port %s"), $tport->PortNumber);
             }
         } else {
             $result["status"] = __("Import Warning");
             $result["log"][$ierror++] = sprintf(__("Ignored port %s"), $tport->PortNumber);
         }
     }
     //files
     if ($this->FrontPictureFile != "") {
         $im = base64_decode($xmltemplate->FrontPicture);
         file_put_contents("pictures/" . $this->FrontPictureFile, $im);
     }
     if ($this->RearPictureFile != "" && $this->RearPictureFile != $this->FrontPictureFile) {
         $im = base64_decode($xmltemplate->RearPicture);
         file_put_contents("pictures/" . $this->RearPictureFile, $im);
     }
     return $result;
 }
Ejemplo n.º 8
0
<items>
  <item>123</item>
  <item>456</item>
</items>
EOF;
$reader = new XMLReader();
$reader->XML($xml);
$reader->setSchema(dirname(__FILE__) . '/013.xsd');
while ($reader->read()) {
    if ($reader->nodeType == XMLReader::ELEMENT && $reader->name == 'item') {
        $reader->read();
        var_dump($reader->value);
    }
}
$reader->close();
?>
===FAIL===
<?php 
$xml = <<<EOF
<?xml version="1.0" encoding="UTF-8" ?>
<foo/>
EOF;
$reader = new XMLReader();
$reader->XML($xml);
$reader->setSchema(dirname(__FILE__) . '/013.xsd');
while ($reader->read() && $reader->nodeType != XMLReader::ELEMENT) {
}
$reader->close();
?>
===DONE===
 protected function readDataBlock()
 {
     $v4b43b0aee35624cd95b910189b3dc231 = new XMLReader();
     $v4b43b0aee35624cd95b910189b3dc231->open($this->file_path);
     $v2245023265ae4cf87d02c8b6ba991139 = mainConfiguration::getInstance();
     $vf7c163939469a0b7becb4e4e6a94efac = $v2245023265ae4cf87d02c8b6ba991139->includeParam('system.kernel') . 'subsystems/import/schemes/' . $this->type . '.xsd';
     if (is_file($vf7c163939469a0b7becb4e4e6a94efac)) {
         $v4b43b0aee35624cd95b910189b3dc231->setSchema($vf7c163939469a0b7becb4e4e6a94efac);
     }
     $v9a09b4dfda82e3e665e31092d1c3ec8d = new DomDocument("1.0", "utf-8");
     $v07214c6750d983a32e0a33da225c4efd = array('umidump/registry/key', 'umidump/files/file', 'umidump/directories/directory', 'umidump/langs/lang', 'umidump/domains/domain', 'umidump/templates/template', 'umidump/datatypes/datatype', 'umidump/types/type', 'umidump/pages/page', 'umidump/objects/object', 'umidump/relations/relation', 'umidump/options/entity', 'umidump/restrictions/restriction', 'umidump/permissions/permission', 'umidump/hierarchy/relation');
     $v95723b5e620e47cf613462b9f293282a = 0;
     $v4757fe07fd492a8be0ea6a760d683d6e = 0;
     $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v9a09b4dfda82e3e665e31092d1c3ec8d;
     $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->read();
     while ($v7aa28ed115707345d0274032757e8991 && $v95723b5e620e47cf613462b9f293282a <= $this->block_size) {
         switch ($v4b43b0aee35624cd95b910189b3dc231->nodeType) {
             case XMLReader::ELEMENT:
                 $v3f02ab347aeca12e013036ce82046c38 = $this->__getNodePath($v5f0b6ebc4bea10285ba2b8a6ce78b863);
                 if (in_array($v3f02ab347aeca12e013036ce82046c38 . "/" . $v4b43b0aee35624cd95b910189b3dc231->name, $v07214c6750d983a32e0a33da225c4efd)) {
                     if ($v4757fe07fd492a8be0ea6a760d683d6e++ < $this->offset) {
                         $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->next();
                         continue 2;
                     }
                     if ($v95723b5e620e47cf613462b9f293282a + 1 > $this->block_size) {
                         break 2;
                     }
                     $v95723b5e620e47cf613462b9f293282a++;
                 }
                 $v65c10911d8b8591219a21ebacf46da01 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createElement($v4b43b0aee35624cd95b910189b3dc231->name, $v4b43b0aee35624cd95b910189b3dc231->value);
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($v65c10911d8b8591219a21ebacf46da01);
                 if (!$v4b43b0aee35624cd95b910189b3dc231->isEmptyElement) {
                     $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v65c10911d8b8591219a21ebacf46da01;
                 }
                 if ($v4b43b0aee35624cd95b910189b3dc231->attributeCount) {
                     while ($v4b43b0aee35624cd95b910189b3dc231->moveToNextAttribute()) {
                         $v815be97df65d6c4b510cd07189c5347a = $v9a09b4dfda82e3e665e31092d1c3ec8d->createAttribute($v4b43b0aee35624cd95b910189b3dc231->name);
                         $v815be97df65d6c4b510cd07189c5347a->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createTextNode($v4b43b0aee35624cd95b910189b3dc231->value));
                         $v65c10911d8b8591219a21ebacf46da01->appendChild($v815be97df65d6c4b510cd07189c5347a);
                     }
                 }
                 break;
             case XMLReader::END_ELEMENT:
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863 = $v5f0b6ebc4bea10285ba2b8a6ce78b863->parentNode;
                 break;
             case XMLReader::ATTRIBUTE:
                 $v815be97df65d6c4b510cd07189c5347a = $v9a09b4dfda82e3e665e31092d1c3ec8d->createAttribute($v4b43b0aee35624cd95b910189b3dc231->name);
                 $v815be97df65d6c4b510cd07189c5347a->appendChild($v9a09b4dfda82e3e665e31092d1c3ec8d->createTextNode($v4b43b0aee35624cd95b910189b3dc231->value));
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($v815be97df65d6c4b510cd07189c5347a);
                 break;
             case XMLReader::TEXT:
                 $vc7824f3d4d5f7b2f22d034758c1e9454 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createTextNode($v4b43b0aee35624cd95b910189b3dc231->value);
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($vc7824f3d4d5f7b2f22d034758c1e9454);
                 break;
             case XMLReader::CDATA:
                 $vd9ef6bda8fb69f1c7e277bd1c2cd21d1 = $v9a09b4dfda82e3e665e31092d1c3ec8d->createCDATASection($v4b43b0aee35624cd95b910189b3dc231->value);
                 $v5f0b6ebc4bea10285ba2b8a6ce78b863->appendChild($vd9ef6bda8fb69f1c7e277bd1c2cd21d1);
                 break;
             case XMLReader::NONE:
             default:
         }
         $v7aa28ed115707345d0274032757e8991 = $v4b43b0aee35624cd95b910189b3dc231->read();
     }
     $this->offset += $v95723b5e620e47cf613462b9f293282a;
     if (!$v7aa28ed115707345d0274032757e8991) {
         $this->complete = true;
     }
     return $v9a09b4dfda82e3e665e31092d1c3ec8d;
 }
Ejemplo n.º 10
0
 public function setSchema($filename)
 {
     return parent::setSchema($filename);
 }
Ejemplo n.º 11
0
 public function isValidXML()
 {
     $xml = new \XMLReader();
     $xml->open($this->file);
     try {
         //Check if it is the right schema
         $xml->setSchema(__DIR__ . '/../gpx.xsd');
         $this->xml = $xml;
         //Read the file to GPX element and open it with simpleXML
         while ($xml->read() && $xml->name === 'gpx') {
             $this->xml = new SimpleXMLElement($xml->readOuterXml());
         }
     } catch (\Exception $e) {
         throw new InvalidFileException("ERROR invalid XML file!", InvalidFileException::FileXMLInvalid);
     }
     return TRUE;
 }