Exemple #1
0
 /**
  * register a namespace prefix for the document, it will be used in
  * createElement and setAttribute
  *
  * @param string $prefix
  * @param string $namespace
  * @throws \LogicException
  */
 public function registerNamespace($prefix, $namespace)
 {
     $prefix = $this->validatePrefix($prefix);
     if (isset($this->_reserved[$prefix])) {
         throw new \LogicException(sprintf('Can not register reserved namespace prefix "%s".', $prefix));
     }
     $this->_namespaces[$prefix] = $namespace;
     if (isset($this->_xpath) && $prefix !== '#default') {
         $this->_xpath->registerNamespace($prefix, $namespace);
     }
 }