Fixes the CPD report page.

@param root
element for the body of the report page
333074
private final void fixReportCpd(final Element root) {
        final Collection<Element> elements; // Found elements

        elements = root.getElementsByTag("h2");
        if (!elements.isEmpty()) {
            elements.iterator().next().tagName("h1");
        }
    }
434007
protected void relink(OutputElementBase parent)
    {
        mNsMapping = parent.mNsMapping;
        mNsMapShared = (mNsMapping != null);
        mDefaultNsURI = parent.mDefaultNsURI;
        mRootNsContext = parent.mRootNsContext;
    }
716976
private void addRootElement() {
        if (root instanceof Document) {
            // Get the single element child of the document node.
            // There could be a doctype node and comment nodes that we must skip.
            Element element = DOMHelper.getFirstChildElement(root);
            Assert.notNull(element, "there should be a root element!");
            result.add(element);
        } else {
            Assert.isTrue(root instanceof Element, "root must be a document or element node!");
            result.add(root);
        }
    }
585329
public void commit(Object root) {
		try {
			XChangesBatch xUpdateControl = (XChangesBatch) UnoRuntime
					.queryInterface(XChangesBatch.class, root);
			xUpdateControl.commitChanges();
		} catch (WrappedTargetException e) {
			e.printStackTrace();
		}
	}
711137
protected void updateReporting(Reporting value, String xmlTag, Counter counter, Element element)
   {
      boolean shouldExist = value != null;
      Element root = updateElement(counter, element, xmlTag, shouldExist);
      if (shouldExist)
      {
         Counter innerCount = new Counter(counter.getDepth() + 1);
         findAndReplaceSimpleElement(innerCount, root, "excludeDefaults",
                  (value.isExcludeDefaults() == false) ? null : String.valueOf(value.isExcludeDefaults()), "false");
         findAndReplaceSimpleElement(innerCount, root, "outputDirectory", value.getOutputDirectory(), null);
         iterateReportPlugin(innerCount, root, value.getPlugins(), "plugins", "plugin");
      }
   }
662277
public void showElementInfo(final CmsContainerPageElementPanel element) {

        CmsUUID structureId;
        if (element.isModelGroup() && !element.getModelGroupId().isNullUUID()) {
            structureId = element.getModelGroupId();
        } else {
            structureId = element.getStructureId();
        }
        I_CmsDropContainer dropContainer = element.getParentTarget();
        Map<String, String> contextParams = new HashMap<>();
        if (dropContainer instanceof CmsContainerPageContainer) {
            CmsContainerPageContainer cnt = (CmsContainerPageContainer)dropContainer;
            String containerId = cnt.getContainerId();
            String elemId = element.getId();
            contextParams.put(CmsGwtConstants.ATTR_ELEMENT_ID, elemId);
            contextParams.put(CmsGwtConstants.ATTR_CONTAINER_ID, containerId);
            String pageRootPath = CmsStringUtil.joinPaths(
                CmsCoreProvider.get().getSiteRoot(),
                CmsCoreProvider.get().getUri());
            contextParams.put(CmsGwtConstants.ATTR_PAGE_ROOT_PATH, pageRootPath);
        }
        CmsResourceInfoDialog.load(structureId, true, null, contextParams, new CloseHandler<PopupPanel>() {

            public void onClose(CloseEvent<PopupPanel> event) {

                reloadElements(element.getId());
            }
        });
    }
483902
@Override
    public void setParent(View parent)
    {
        super.setParent(parent);
        if (parent != null)
        {
            transform = new AffineTransform();
            setPropertiesFromAttributes(getElement().getAttributes());
            refreshAttributes = true;
            refreshProperties = false;
            container = getContainer();
            /*if (parent instanceof ElementBoxView)
            {
                // avoid a RootView or any other non-SwingBox views
                Anchor parentAnchor = ((ElementBoxView) parent).getAnchor();
                if (parentAnchor.isActive())
                {
                    // share elementAttributes
                    anchor.setActive(true);
                    anchor.getProperties().putAll(parentAnchor.getProperties());
                }
            }*/
        }
        else
        {
            anchor = null;
            transform = null;
            container = null;
        }
    }
512419
private void setFolderTitle(CmsResource res) {

        try {
            CmsProperty titleProperty = m_cms.readPropertyObject(res, CmsPropertyDefinition.PROPERTY_TITLE, false);
            if (!titleProperty.isNullProperty()) {
                titleProperty.setValue(m_site.getTitle(), CmsProperty.TYPE_INDIVIDUAL);
                m_cms.writePropertyObject(res.getRootPath(), titleProperty);
            } else {
                LOG.error("Editing title property of site root resource was not possible");
                getReport().println(
                    Messages.get().container(Messages.RPT_SITE_ERROR_TITLE_0),
                    I_CmsReport.FORMAT_ERROR);
            }
        } catch (CmsException e) {
            LOG.error("Editing title property of site root resource was not possible", e);
            getReport().println(Messages.get().container(Messages.RPT_SITE_ERROR_TITLE_0), I_CmsReport.FORMAT_ERROR);
            getReport().println(e);
        }

    }
835295
public function generateSegments(string $root = null): void
    {
        $path = rawurldecode($this->sourceData['path'] ?? '');
        if ($path && $path != '/') {
            // drop root if exists
            if ($root && $root != '/') {
                $root = '/'. trim($root, '/'). '/';
                // prevent wrong generate action
                if (strpos($path, $root) === false) {
                    throw new HttpException("Uri path '{$path}' has no root such '{$root}'");
                }

                $path = substr($path, strlen($root));

                // update segments root
                $this->segmentsRoot = $root;
            }

            $segments = array_map('trim', preg_split('~/+~', $path, -1, PREG_SPLIT_NO_EMPTY));
            if ($segments != null) {
                // push index next
                foreach ($segments as $i => $segment) {
                    $this->segments[$i + 1] = $segment;
                }
            }
        }
    }
803258
function fixRootPageScroll (shell, {sourcePageId, targetPageId} = {}) {
  let page = window.MIP.viewer.page
  if (sourcePageId === page.pageId) {
    document.documentElement.classList.add('mip-no-scroll')
    page.getElementsInRootPage().forEach(e => e.classList.add('mip-hide'))
  }
  if (targetPageId === page.pageId) {
    document.documentElement.classList.remove('mip-no-scroll')
    page.getElementsInRootPage().forEach(e => e.classList.remove('mip-hide'))
    shell.restoreScrollPosition()
  }
}
355911
protected void replaceWithChildren(Element element)
    {
        Element parent = (Element) element.getParentNode();
        while (element.getFirstChild() != null) {
            parent.insertBefore(element.removeChild(element.getFirstChild()), element);
        }
        parent.removeChild(element);
    }
507841
public void setHref(String url) {
        if (url == null)
            throw new RuntimeException("Cannot set URL to null. Call removeUrl() if you wanted to remove the URL");
        if (anchor == null) {
            if (controlGroupRoot != null) {
                //!!! following code is semi-working, it's not reconstructed item correctly
                remove(controlGroupRoot);
                anchor = Document.get().createAnchorElement();
                anchor.setAttribute("href", url);
                moveThisChildrenToAnchor();
                cleanUpLI();
                prepareAnchorForControlGroup();
                getElement().appendChild(anchor);
                checkAnchorPanel();
            } else {
                // need to make anchor and move children to it
                anchor = Document.get().createAnchorElement();
                moveThisChildrenToAnchor();
                getElement().appendChild(anchor);
            }
            addItemActivationHandlers();
        }
        anchor.setAttribute("href", url);
    }
1134029
private void chunkMap(final Element root) {
        // create the reference to the new file on root element.
        String newFilename = replaceExtension(new File(currentFile).getName(), FILE_EXTENSION_DITA);
        URI newFile = currentFile.resolve(newFilename);
        if (new File(newFile).exists()) {
            final URI oldFile = newFile;
            newFilename = chunkFilenameGenerator.generateFilename(CHUNK_PREFIX, FILE_EXTENSION_DITA);
            newFile = currentFile.resolve(newFilename);
            // Mark up the possible name changing, in case that references might be updated.
            conflictTable.put(newFile, oldFile.normalize());
        }
        changeTable.put(newFile, newFile);

        // change the class attribute to "topicref"
        final String origCls = root.getAttribute(ATTRIBUTE_NAME_CLASS);
        root.setAttribute(ATTRIBUTE_NAME_CLASS, origCls + MAP_TOPICREF.matcher);
        root.setAttribute(ATTRIBUTE_NAME_HREF, toURI(newFilename).toString());

        createTopicStump(newFile);

        // process chunk
        processTopicref(root);

        // restore original root element
        if (origCls != null) {
            root.setAttribute(ATTRIBUTE_NAME_CLASS, origCls);
        }
        root.removeAttribute(ATTRIBUTE_NAME_HREF);
    }
300597
@SuppressFBWarnings("RV_RETURN_VALUE_IGNORED_INFERRED")
    private void renderLeaf(final TreeNode root, final String name,
                            final Class<?> item, final List<String> markers) {
        root.child(String.format("%-10s ", name) + RenderUtils.renderClassLine(item, markers));
    }
960956
private void saveSummaryXml(SampleNode root) {

        root.sortTree();
        Document doc = DocumentHelper.createDocument();
        Element rootElem = doc.addElement("root");
        root.appendToXml(rootElem);
        OutputFormat outformat = OutputFormat.createPrettyPrint();
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
        outformat.setEncoding("UTF-8");
        try {
            XMLWriter writer = new XMLWriter(buffer, outformat);
            writer.write(doc);
            writer.flush();
            try (FileOutputStream fos = new FileOutputStream(m_summaryFilename)) {
                fos.write(buffer.toByteArray());
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
1213087
private function pageHeaderEndHandler(): void
    {
        $this->print_data      = array_pop($this->print_data_stack);
        $this->current_element = $this->wt_report;
        $this->wt_report       = array_pop($this->wt_report_stack);
        $this->wt_report->addElement($this->current_element);
    }
210772
public boolean startDoclet(RootDoc root) {
        configuration = configuration();
        configuration.root = root;
        utils = configuration.utils;
        if (!isValidDoclet()) {
            return false;
        }
        try {
            startGeneration(root);
        } catch (Configuration.Fault f) {
            root.printError(f.getMessage());
            return false;
        } catch (FatalError fe) {
            return false;
        } catch (DocletAbortException e) {
            e.printStackTrace();
            Throwable cause = e.getCause();
            if (cause != null) {
                if (cause.getLocalizedMessage() != null) {
                    root.printError(cause.getLocalizedMessage());
                } else {
                    root.printError(cause.toString());
                }
            }
            return false;
        } catch (Exception exc) {
            return false;
        }
        return true;
    }