Esempio n. 1
0
 public function testGenericXinclude()
 {
     $type_schema_path = __DIR__ . DIRECTORY_SEPARATOR . 'Fixtures' . DIRECTORY_SEPARATOR . 'extensive_type_schema_include.xml';
     $document = new Document('1.0', 'utf-8');
     $document->load($type_schema_path);
     $document->xinclude();
     $xpath = new Xpath($document);
     $xml_base_nodes = $xpath->query('//@xml:base', $document);
     $this->assertEquals(0, $xml_base_nodes->length);
 }
Esempio n. 2
0
 public function xinclude($options = null)
 {
     $user_error_handling = $this->enableErrorHandling();
     $return = parent::xinclude($options);
     $this->handleErrors('Resolving XIncludes failed. Details are:' . PHP_EOL . PHP_EOL, PHP_EOL . 'Please fix the mentioned errors.', $user_error_handling);
     // Remove xml:base attribute, auto-appended when xincluding resources with different URI
     $xpath = new Xpath($this);
     $nodes = $xpath->query('//@xml:base', $this);
     foreach ($nodes as $node) {
         $node->ownerElement->removeAttribute($node->nodeName);
     }
     return $return;
 }
Esempio n. 3
0
 public function testAlreadyExistentNamespacePrefix()
 {
     // Document has already a namespace prefixed as 'dt' (the default Xpath prefix, if not specified in construtor)
     // 'Namespaced' value should not be retrieved; its prefix
     //      will be the same as the already defined in the parents
     // 'Conflicting' should not be retrieved as well
     //      cause 'dt' will corresponds to two namespaces
     $dom_document = new Document('1.0', 'utf-8');
     $dom_document->loadXML('<any_container
             xmlns="http://berlinonline.net/trellis/1.0/schema"
             xmlns:on="urn:other:namespace"
             xmlns:dt="urn:conflicting:prefix:namespace">
             <dt:option name="types">
                 <option>Namespaced</option>
                 <on:option>OtherNamespace</on:option>
                 <dt:option>Conflicting</dt:option>
                 <option xmlns="">NonNamespaced</option>
             </dt:option>
         </any_container>');
     $xpath = new Xpath($dom_document);
     $xpath->registerNamespace('dt', 'urn:conflicting:prefix:namespace');
     $options_nodelist = $xpath->query('/any_container/dt:option/option', $dom_document->documentElement);
     $this->assertEquals(0, $options_nodelist->length);
 }