Example #1
0
 /**
  * An utility method that cleans the contents of the section node, by
  * moving the alternative section (opt:sectionelse etc. tags) code to the end
  * of the children list.
  *
  * In the parameters, we must specify the name and the namespace of the
  * tags that will be treated as the alternative content tags.
  *
  * @param Opt_Xml_Element $node The section node
  * @param String $ns The namespace
  * @param String $name The alternative section content tag name
  */
 protected function _sortSectionContents(Opt_Xml_Element $node, $ns, $name)
 {
     $else = $node->getElementsByTagNameNS($ns, $name, false);
     if (sizeof($else) == 1) {
         if (!$node->hasAttributes()) {
             throw new Opt_InstructionTooManyItems_Exception($ns . ':' . $name, $node->getXmlName(), 'Zero');
         }
         $node->bringToEnd($else[0]);
     } elseif (sizeof($else) > 1) {
         throw new Opt_InstructionTooManyItems_Exception($ns . ':' . $name, $node->getXmlName(), 'Zero or one');
     }
 }
Example #2
0
 /**
  * Postprocesses the opt:tree node.
  * @internal
  * @param Opt_Xml_Element $node The node found by the compiler.
  */
 protected function _postprocessTree(Opt_Xml_Element $node)
 {
     $section = $this->getSection($node->get('sectionName'));
     if ($node->hasAttributes()) {
         if (!$node->get('sectionElse')) {
             $this->_sortSectionContents($node, 'opt', 'treeelse');
         }
     }
     $this->_sectionEnd($node);
 }
Example #3
0
 /**
  * Finishes the processing of the opt:grid tag.
  * @internal
  * @param Opt_Xml_Element $node The recognized node.
  */
 protected function _postprocessGrid(Opt_Xml_Element $node)
 {
     $section = $node->get('priv:section');
     if ($node->hasAttributes()) {
         if (!$node->get('priv:alternative')) {
             $this->_sortSectionContents($node, 'opt', 'gridelse');
         }
     }
 }