Example #1
0
 protected function readElement(dom\element $el)
 {
     if ($el->isComplex()) {
         $this->launchException('Cannot read complex element');
     }
     return $el->read();
 }
Example #2
0
 protected function parseID(dom\element $el)
 {
     if ($el->isComplex()) {
         if ($el->countChildren() > 1) {
             $this->throwException(sprintf('Only one child expected in %s', $el->asToken()));
         }
         $mResult = $this->parseElement($el->getFirst());
     } else {
         $mResult = $el->read();
     }
     $this->setID($mResult);
 }
Example #3
0
 protected function mergeElement(dom\element $current, dom\element $import, $bCheckNS = true)
 {
     if ($bCheckNS && $current->getNamespace() !== $import->getNamespace()) {
         $this->throwException(sprintf('Cannot merge elements with same name but different namespaces %s and %s', $current->asToken(), $import->asToken()));
     }
     if ($current->isComplex()) {
         if (!$import->isComplex()) {
             $this->throwException(sprintf('Cannot merge simple type %s on complex type %s', $import->asToken(), $current->asToken()));
         }
         $this->mergeElementComplex($current, $import);
     } else {
         if ($import->isComplex()) {
             $this->throwException(sprintf('Cannot merge complex type %s on simple type %s', $import->asToken(), $current->asToken()));
         }
         $this->mergeElementSimple($current, $import);
     }
 }