Ejemplo n.º 1
0
 private function loadImport(Schema $schema, DOMElement $node)
 {
     $base = urldecode($node->ownerDocument->documentURI);
     $file = UrlUtils::resolveRelativeUrl($base, $node->getAttribute("schemaLocation"));
     if ($node->hasAttribute("namespace") && isset(self::$globalSchemaInfo[$node->getAttribute("namespace")]) && isset($this->loadedFiles[self::$globalSchemaInfo[$node->getAttribute("namespace")]])) {
         $schema->addSchema($this->loadedFiles[self::$globalSchemaInfo[$node->getAttribute("namespace")]]);
         return function () {
         };
     } elseif (isset($this->loadedFiles[$file])) {
         $schema->addSchema($this->loadedFiles[$file]);
         return function () {
         };
     }
     if (!$node->getAttribute("namespace")) {
         $this->loadedFiles[$file] = $newSchema = $schema;
     } else {
         $this->loadedFiles[$file] = $newSchema = new Schema();
         $newSchema->addSchema($this->getGlobalSchema());
     }
     $xml = $this->getDOM(isset($this->knowLocationSchemas[$file]) ? $this->knowLocationSchemas[$file] : $file);
     $callbacks = $this->schemaNode($newSchema, $xml->documentElement, $schema);
     if ($node->getAttribute("namespace")) {
         $schema->addSchema($newSchema);
     }
     return function () use($callbacks) {
         foreach ($callbacks as $callback) {
             call_user_func($callback);
         }
     };
 }
Ejemplo n.º 2
0
 public function testRegularPathsParent()
 {
     $this->assertEquals('/testing', UrlUtils::resolveRelativeUrl('/test/child', '../testing'));
 }