Converts an OPML String to a Tree Menu List.
@access		public
@static
@param		string		$opml			OPML String
@param		string		$labelRoot		Label of Top Tree Menu List
@param		string		$rootClass		CSS Class of root node
@return		ADT_Tree_Menu_List
548706
public static function convertFromOpml( $opml, $labelRoot, $rootClass = NULL )
	{
		$parser		= new XML_OPML_Parser();
		$parser->parse( $opml );
		$lines		= $parser->getOutlines();
		$list		= new ADT_Tree_Menu_List( $labelRoot, array( 'class' => $rootClass ) );

		self::buildMenuListFromOutlines( $lines, $list );
		return $list;
	}
875010
public function toXhtml(\DOMDocument $document, \DOMElement $root)
    {
        $this->addLinksToTableOfContents();

        // if the hidden flag is set then this item should not be rendered but still processed (see above)
        if (isset($this->node->options['hidden'])) {
            return;
        }

        $list = $document->createElement('ol');
        $root->appendChild($list);

        foreach ($this->links as $link) {
            $list_item = $document->createElement('li');
            $list->appendChild($list_item);

            $link_element = $document->createElement('a');
            $list_item->appendChild($link_element);
            $link_element->appendChild($document->createTextNode($this->getCaption($link)));
            $link_element->setAttribute('href', str_replace('\\', '/', $link) . '.html');
        }
    }
1152537
public static Window showXML(Document document, BaseUIComponent parent) {
        Map<String, Object> args = Collections.singletonMap("document", document);
        boolean modal = parent == null;
        Window dialog = PopupDialog.show(XMLConstants.VIEW_DIALOG, args, modal, modal, modal, null);
        
        if (parent != null) {
            dialog.setParent(parent);
        }
        
        return dialog;
    }
463651
public static function getTreeByParentId($parentId, $condition = '', $params = [], $order = 'display_order asc')
    {
        $menuMode = static::find()
            ->findByParentId($parentId)
            ->andWhere($condition, $params)
            ->orderBy($order)
            ->all();
        $tree = [];
        if ($menuMode) {
            foreach ($menuMode as $itemModel) {
                $node = [
                    'menu_id' => $itemModel['menu_id'],
                    'parent_id' => $itemModel['parent_id'],
                    'tab_id' => 'tab_' . $itemModel['menu_id'],
                    'text' => $itemModel['text'],
                    'origin_text' => $itemModel['text'],
                    'title' => $itemModel['title'],
                    'url' => $itemModel['url'],
                    'view_package' => $itemModel['view_package'],
                    'expanded' => (bool) $itemModel['expanded'],
                    'closable' => (bool) $itemModel['closable'],
                    'is_folder' => (bool) $itemModel['is_folder'],
                    'is_expand' => (bool) $itemModel['expanded'],
                    'is_open_url' => (bool) $itemModel['is_open_url'],
                    'is_open_target' => (bool) $itemModel['is_open_target'],
                    'is_every_open' => (bool) $itemModel['is_every_open'],
                    'is_hide' => (bool) $itemModel['is_hide'],
                    'display_order' => $itemModel['display_order'],
                    'params' => $itemModel['params'],
                    'note' => $itemModel['note'],
                    'status' => intval($itemModel['status']),
                ];
                $children = static::getTreeByParentId($itemModel['menu_id'], $condition, $params, $order);
                if ($children) {
                    $node['leaf'] = false;
                    $node['children'] = $children;
                } else {
                    $node['leaf'] = true;
                }
                $tree[] = $node;
            }
        }

        return $tree;
    }
732126
private function treeOutput(TreeBase $tree, Menu $menu = null)
    {
        $items = [];

        foreach ($tree->getChildren() as $item) {
            $element = [];

            $input = [
                '#prefix'         => '<div class="tree-item clearfix">',
                '#type'           => 'textfield',
                '#attributes'     => ['class' => ['']],
                '#value'          => $item->getTitle(),
                '#theme_wrappers' => [],
                '#suffix'         => '<span class="fa fa-times"></span></div>',
            ];

            $element['data']            = drupal_render($input);
            $element['data-item-type']  = 'node';
            $element['data-item-id']    = $item->getNodeId();
            $element['data-mlid']       = $item->getId();

            if ($item->hasChildren()) {
                $elements = $this->treeOutput($item);
                $element['data'] .= drupal_render($elements);
            }

            $items[] = $element;
        }

        $build = [
            '#theme' => 'item_list',
            '#type'  => 'ol',
            '#items' => $items,
        ];

        if ($menu) {
            $build['#attributes'] = [
                'data-menu' => $menu->getName(),
                'class'     => ['sortable'],
            ];
            $build['#title'] = $menu->getTitle();

            // If tree has no children, add an empty element to allow drop.
            if (!$tree->hasChildren()) {
                $build['#items'] = [' '];
            }
        }

        return $build;
    }
981651
protected function createRootElement(Operation $operation)
    {
        static $defaultRoot = array('name' => 'Request');
        // If no root element was specified, then just wrap the XML in 'Request'
        $root = $operation->getData('xmlRoot') ?: $defaultRoot;
        // Allow the XML declaration to be customized with xmlEncoding
        $encoding = $operation->getData('xmlEncoding');

        $xmlWriter = $this->startDocument($encoding);

        $xmlWriter->startElement($root['name']);
        // Create the wrapping element with no namespaces if no namespaces were present
        if (!empty($root['namespaces'])) {
            // Create the wrapping element with an array of one or more namespaces
            foreach ((array) $root['namespaces'] as $prefix => $uri) {
                $nsLabel = 'xmlns';
                if (!is_numeric($prefix)) {
                    $nsLabel .= ':'.$prefix;
                }
                $xmlWriter->writeAttribute($nsLabel, $uri);
            }
        }
        return $xmlWriter;
    }
1164848
private RootElementInfo createRootElementInfo(org.jsoup.nodes.Element root, String subclass) {
        List<Attribute> attributes = root.attributes().asList().stream()
                .filter(attribute -> !attribute.getKey().equals("data-element"))
                .collect(Collectors.toList());

        ExpressionParser expressionParser = new ExpressionParser();
        String html = root.children().isEmpty() ? null : JAVA_STRING_ESCAPER.escape(root.html());
        Map<String, String> expressions = expressionParser.parse(html);
        expressions.putAll(expressionParser.parse(root.outerHtml()));

        return new RootElementInfo(root.tagName(), subclass.toLowerCase() + "_root_element",
                attributes, html, expressions);
    }
177622
function root(node, options = {}) {
  const {
    fragment,
    namespace: optionsNamespace,
  } = options;
  const { children = [] } = node;
  const { length: childrenLength } = children;

  let namespace = optionsNamespace;
  let rootIsDocument = childrenLength === 0;

  for (let i = 0; i < childrenLength; i += 1) {
    const {
      tagName,
      properties: {
        xmlns,
      } = {},
    } = children[i];
    if (tagName === 'html') {
      // If we have a root HTML node, we don't need to render as a fragment
      rootIsDocument = true;
      // Take namespace of first child
      if (typeof optionsNamespace === 'undefined') {
        if (xmlns) {
          namespace = xmlns;
        } else if (children[0].tagName === 'html') {
          namespace = 'http://www.w3.org/1999/xhtml';
        }
      }
    }
  }

  // The root node will be a Document, DocumentFragment, or HTMLElement
  let el;
  if (rootIsDocument) {
    el = document.implementation.createDocument(namespace, '', null);
  } else if (fragment) {
    el = document.createDocumentFragment();
  } else {
    el = document.createElement('html');
  }

  // Transform children
  const childOptions = Object.assign({ fragment, namespace }, options);
  for (let i = 0; i < childrenLength; i += 1) {
    const childEl = transform(children[i], childOptions);
    if (childEl) {
      el.appendChild(childEl);
    }
  }

  return el;
}
100082
static function processNodeTransformationRoot( $useComments, $php, $tpl, &$node, &$resourceData )
    {
        $nodeType = $node[0];
        if ( $nodeType == eZTemplate::NODE_ROOT )
        {
            $children = $node[1];
            $newNode = array( $nodeType,
                              false );
            if ( $children )
            {
                $newChildren = array();
                foreach ( $children as $childNode )
                {
                    $newChildNode = eZTemplateCompiler::processNodeTransformationChild( $useComments, $php, $tpl, $childNode, $resourceData );
                    if ( !$newChildNode )
                        $newChildren[] = $childNode;
                    else
                        $newChildren = array_merge( $newChildren, $newChildNode );
                }
                if ( count( $newChildren ) > 0 )
                    $newNode[1] = $newChildren;
            }
            return $newNode;
        }
        else
            $tpl->error( 'processNodeTransformation', "Unknown root type $nodeType, should be " . eZTemplate::NODE_ROOT );
        return false;
    }
718386
public function makeRoot($newRoot)
    {
        if($this->isRoot())
        {
            return;
        }

        if(!$this->hasManyRoots())
        {
            throw new \BadMethodCallException(sprintf('%s::%s is only supported on multiple root trees', __CLASS__, __METHOD__));
        }

        $em = $this->getManager()->getEntityManager();
        $lftField = $this->getLeftFieldName();
        $rgtField = $this->getRightFieldName();
        $rootField = $this->getRootFieldName();

        $oldRgt = $this->getRightValue();
        $oldLft = $this->getLeftValue();
        $oldRoot = $this->getRootValue();

        // beginTransaction
        $em->getConnection()->beginTransaction();
        try
        {
            // Update descendants lft/rgt/root values
           $diff = 1 - $oldLft;
            $qb = $em->createQueryBuilder()
                ->update(get_class($this->getNode()), 'n')
                ->set("n.$lftField", "n.$lftField + ?1")
                ->setParameter(1, $diff)
                ->set("n.$rgtField", "n.$rgtField + ?2")
                ->setParameter(2, $diff)
                ->set("n.$rootField", "?3")
                ->setParameter(3, $newRoot)
                ->where("n.$lftField > ?4")
                ->setParameter(4, $oldLft)
                ->andWhere("n.$rgtField < ?5")
                ->setParameter(5, $oldRgt)
                ->andWhere("n.$rootField = ?6")
                ->setParameter(6, $oldRoot);
            $qb->getQuery()->execute();
            $this->getManager()->updateValues($oldLft, $oldRgt, $diff, $oldRoot, $newRoot);

            // Close gap in old tree
            $first = $oldRgt + 1;
            $delta = $oldLft - $oldRgt - 1;
            $this->shiftRLRange($first, 0, $delta, $oldRoot);

            // Set new lft/rgt/root values for root node
            $this->setLeftValue(1);
            $this->setRightValue($oldRgt - $oldLft + 1);
            $this->setRootValue($newRoot);
            $em->persist($this->getNode());

            $em->flush();
            $em->getConnection()->commit();
        }
        catch (\Exception $e)
        {
            // @codeCoverageIgnoreStart
            $em->close();
            $em->getConnection()->rollback();
            throw $e;
            // @codeCoverageIgnoreEnd
        }
        // endTransaction
    }
281244
public function getMenu(Tree $tree): ?Menu
    {
        $menu = new Menu($this->title(), route('module', [
            'module' => $this->name(),
            'action' => 'ShowList',
            'ged'    => $tree->name(),
        ]), 'menu-story');

        return $menu;
    }
817573
protected function generateTreeView($collection, $treeClass)
    {
        $content = [];

        // Generate buttons - only if not in select mode!
        if (!$this->isSelectModeActive()) {
            (new ButtonRenderer($this->environment))->renderButtonsForCollection($collection);
        }

        foreach ($collection as $model) {
            /** @var ModelInterface $model */

            $toggleID = $model->getProviderName() . '_' . $treeClass . '_' . $model->getId();

            $content[] = $this->parseModel($model, $toggleID);

            if ($model->getMeta($model::HAS_CHILDREN) && $model->getMeta($model::SHOW_CHILDREN)) {
                $template = $this->getTemplate('dcbe_general_treeview_child');
                $subHtml  = '';

                foreach ($model->getMeta($model::CHILD_COLLECTIONS) as $childCollection) {
                    $subHtml .= $this->generateTreeView($childCollection, $treeClass);
                }

                $this
                    ->addToTemplate('select', $this->isSelectModeActive(), $template)
                    ->addToTemplate('objParentModel', $model, $template)
                    ->addToTemplate('strToggleID', $toggleID, $template)
                    ->addToTemplate('strHTML', $subHtml, $template)
                    ->addToTemplate('strTable', $model->getProviderName(), $template);

                $content[] = $template->parse();
            }
        }

        return \implode("\n", $content);
    }
938008
public ConfigBase fromXml(final Element rootEl,
                            final Class cl) throws ConfigException {
    try {
      final ConfigBase cb = (ConfigBase)getObject(rootEl, cl);

      if (cb == null) {
        // Can't do this
        return null;
      }

      for (final Element el: XmlUtil.getElementsArray(rootEl)) {
        populate(el, cb, null, null);
      }

      return cb;
    } catch (final ConfigException ce) {
      throw ce;
    } catch (final Throwable t) {
      throw new ConfigException(t);
    }
  }
214806
public static UIViewRoot getViewRoot(FaceletContext ctx, UIComponent parent)
    {
        UIComponent c = parent;
        do
        {
            if (c instanceof UIViewRoot)
            {
                return (UIViewRoot) c;
            }
            else
            {
                c = c.getParent();
            }
        } while (c != null);

        UIViewRoot root = ctx.getFacesContext().getViewRoot();
        if (root == null)
        {
            root = FaceletCompositionContext.getCurrentInstance(ctx).getViewRoot(ctx.getFacesContext());
        }
        return root;
    }
928392
public void addRootMenuItem(ContextMenuItemState rootItem, CmsContextMenuConnector connector) {

        CmsContextMenuItemWidget itemWidget = createEmptyItemWidget(
            rootItem.getId(),
            rootItem.getCaption(),
            rootItem.getDescription(),
            connector);
        itemWidget.setEnabled(rootItem.isEnabled());
        itemWidget.setSeparatorVisible(rootItem.isSeparator());

        setStyleNames(itemWidget, rootItem.getStyles());

        m_menuOverlay.addMenuItem(itemWidget);

        for (ContextMenuItemState childState : rootItem.getChildren()) {
            createSubMenu(itemWidget, childState, connector);
        }
    }
1132226
private function getTotalCount( $queryString, $rootClass = null )
    {
        return $rootClass->countInstances(
            array(
                OntologyRdfs::RDFS_LABEL => $queryString
            ),
            array(
                'recursive' => true,
                'like'      => true,
            )
        );
    }
488303
function ($currentRoot, data) {
      data.relationship = data.relationship || '001';
      var $table = $('<table>')
        .append($('<tr>').append($('<td colspan="2">').append(this.createNode(data))))
        .append('<tr class="lines"><td colspan="2"><div class="downLine"></div></td></tr>')
        .append('<tr class="lines"><td class="rightLine"></td><td class="leftLine"></td></tr>');
      this.$chart.prepend($table)
        .children('table:first').append('<tr class="nodes"><td colspan="2"></td></tr>')
        .children('tr:last').children().append(this.$chart.children('table').last());
    }