Returns the HTML content for the given resource and container.<p>

@param elementFile the element resource file
@param elementId the element id
@param container the container

@return the HTML content
544384
public String getContentByContainer(CmsFile elementFile, String elementId, CmsContainer container) {

        CmsContainerElementBean element = CmsADESessionCache.getCache(m_req, m_cms).getCacheContainerElement(elementId);
        element = element.clone();
        element.setTemporaryFile(elementFile);
        CmsFormatterConfiguration configs = getFormatterConfiguration(element.getResource());
        return getContentByContainer(element, container, configs);
    }
94605
public static List<CmsContainerElementBean> getInheritedContainerElements(
        CmsObject cms,
        CmsContainerElementBean element) {

        CmsResource resource = element.getResource();
        return CmsXmlInheritGroupContainerHandler.loadInheritContainerElements(cms, resource);
    }
1165916
function (elementId, containerId) {
            var container = this.$containers[containerId];
            if (!container) {
                // TODO: remove this shit
                container = this.createContainer({'class': containerId + "-container"});
                this.$containers[containerId] = container;
                this.addChild(container);
                if (this.$containerOrder[containerId]) {
                    container.setChildIndex(this.$containerOrder[containerId]);
                }
            }

            var element = this.$elements[containerId + "_" + elementId];
            if (!element) {
                element = this.createContainer({});
                container.addChild(element);
            }

            return element.$el;
        }
192191
public static org.w3c.dom.Element domElement(String xmlString) {
    org.w3c.dom.Element element = null;
    try {
      ByteArrayInputStream bais = new ByteArrayInputStream(
        xmlString.getBytes(Charset.forName("UTF-8")));
      element = getFactory().newDocumentBuilder().parse(bais)
        .getDocumentElement();
    } catch (SAXException e) {
      throw new MarkLogicIOException(
        "Could not make Element from xmlString" + xmlString, e);
    } catch (IOException e) {
      throw new MarkLogicIOException(
        "Could not make Element from xmlString" + xmlString, e);
    } catch (ParserConfigurationException e) {
      throw new MarkLogicIOException(
        "Could not make Element from xmlString" + xmlString, e);
    }
    return element;
  }
1146684
public void deleteElement(String elementId, final String relatedElementId) {

        elementId = getServerId(elementId);
        removeContainerElements(elementId);
        addToRecentList(elementId, null);
        reloadElements(new String[] {relatedElementId});
    }
960564
protected XmlElement findMatchedElementIn(Document document, org.dom4j.Element element) {
    org.dom4j.Attribute id = element.attribute("id");
    String idName = id.getName();
    String idValue = id.getValue();
    for (Element me : document.getRootElement().getElements()) {
      if (me instanceof XmlElement) {
        XmlElement xe = (XmlElement) me;
        for (Attribute ab : xe.getAttributes()) {
          if (StringUtils.equals(idName, ab.getName()) && StringUtils.equals(idValue, ab.getValue())) {
            return xe;
          }
        }
      }
    }
    return null;
  }
1148759
function(containerID) {
        if (!this.supported()) { 
            return; 
        }
        if (!document.namespaces.olv) {
            document.namespaces.add("olv", this.xmlns);
            var style = document.createStyleSheet();
            var shapes = ['shape','rect', 'oval', 'fill', 'stroke', 'imagedata', 'group','textbox']; 
            for (var i = 0, len = shapes.length; i < len; i++) {

                style.addRule('olv\\:' + shapes[i], "behavior: url(#default#VML); " +
                              "position: absolute; display: inline-block;");
            }                  
        }
        
        OpenLayers.Renderer.Elements.prototype.initialize.apply(this, 
                                                                arguments);
    }
251960
private CmsContainerElementBean buildContainerElementBean(ContainerInfo cnt, CmsResource resource) {

        I_CmsFormatterBean formatter = m_config.getFormatters(m_cms, resource).getDefaultFormatter(
            cnt.getEffectiveType(),
            cnt.getEffectiveWidth());
        CmsUUID formatterId = formatter.getJspStructureId();
        CmsContainerElementBean elementBean = new CmsContainerElementBean(
            resource.getStructureId(),
            formatterId,
            new HashMap<String, String>(),
            false);
        return elementBean;
    }
1219706
public AndroidElement get(String elementId) {
    AndroidElement element = cache.get(elementId);

    if (element instanceof AndroidNativeElement) {
      if (!ViewHierarchyAnalyzer.getDefaultInstance().isViewChieldOfCurrentRootView(
          ((AndroidNativeElement) element).getView())) {
        return null;
      }
    }
    return element;
  }
934038
protected void printElementWrapperTagEnd(boolean isGroupcontainer) throws IOException {

        if (m_editableRequest) {
            String result;
            if (isGroupcontainer) {
                result = "</div>";
            } else {
                result = "<div class=\""
                    + CmsContainerElement.CLASS_CONTAINER_ELEMENT_END_MARKER
                    + "\" style=\"display:none\"></div>";
            }
            pageContext.getOut().print(result);
        }
    }
100460
public void replaceElement(final CmsContainerPageElementPanel elementWidget, final String elementId) {

        final CmsRpcAction<CmsContainerElementData> action = new CmsRpcAction<CmsContainerElementData>() {

            @Override
            public void execute() {

                start(500, true);
                getContainerpageService().replaceElement(
                    getData().getRpcContext(),
                    getData().getDetailId(),
                    getRequestParams(),
                    elementWidget.getId(),
                    elementId,
                    getPageState(),
                    getLocale(),
                    this);
            }

            @Override
            protected void onResponse(CmsContainerElementData result) {

                stop(false);

                if (result != null) {
                    // cache the loaded element
                    m_elements.put(result.getClientId(), result);
                    try {
                        replaceContainerElement(elementWidget, result);
                        resetEditButtons();
                        addToRecentList(result.getClientId(), null);
                        setPageChanged(new Runnable() {

                            public void run() {

                                // nothing to do

                            }
                        });
                    } catch (Exception e) {
                        // should never happen
                        CmsDebugLog.getInstance().printLine(e.getLocalizedMessage());
                    }
                }
            }
        };

        if (!isGroupcontainerEditing()) {

            lockContainerpage(new I_CmsSimpleCallback<Boolean>() {

                public void execute(Boolean arg) {

                    if (arg.booleanValue()) {
                        action.execute();
                    }
                }
            });

        } else {
            action.execute();
        }
    }
531061
private static String getElementContent(Element element, String defaultStr)
    {
        if (element == null)
        {
            return defaultStr;
        }

        NodeList children = element.getChildNodes();
        StringBuilder result = new StringBuilder("");
        for (int i = 0; i < children.getLength(); i++)
        {
            if (children.item(i).getNodeType() == Node.TEXT_NODE
                    || children.item(i).getNodeType() == Node.CDATA_SECTION_NODE)
            {
                result.append(children.item(i).getNodeValue());
            }
        }
        return result.toString().trim();
    }
1360476
function (containerEl) {
    // Only a single child element
    if (
      containerEl.childNodes.length === 1
      && containerEl.childNodes[0].nodeType === NODE_TYPE.ELEMENT
    ) {
      return true;
    }
    // Only one element, and all other children are whitespace
    var foundElement = false;
    for (var i = 0, count = containerEl.childNodes.length; i < count; i++) {
      var child = containerEl.childNodes[i];
      if (child.nodeType === NODE_TYPE.ELEMENT) {
        if (foundElement) {
          // Encountered an element after already encountering another one
          // Therefore, more than one element at root level
          return false;
        } else {
          foundElement = true;
        }
      } else if (child.nodeType === NODE_TYPE.TEXT && !isEmpty(child.textContent)) {
        // Contains text content
        return false;
      }
    }
    return true;
  }
121224
public Result<String> convertToHtml(File file) throws IOException {
        return new InternalDocumentConverter(options).convertToHtml(file).toResult();
    }
638994
public String remove(String content, String selector) {

		Element body = parseContent(content);
		
		List<Element> elements = body.select(selector);
		if (elements.size() > 0) {
			for (Element element : elements) {
				element.remove();
			}
			
			return body.html();
		} else {
			// nothing changed
			return content;
		}
	}
732406
private void mergePageFile(String resourcename) throws CmsXmlException, CmsImportExportException {

        try {

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_START_MERGING_1, resourcename));
            }

            // in OpenCms versions <5 node names have not been case sensitive. thus, nodes are read both in upper
            // and lower case letters, or have to be tested for equality ignoring upper/lower case...

            // get the header file
            CmsFile pagefile = m_cms.readFile(resourcename, CmsResourceFilter.ALL);
            Document contentXml = CmsXmlUtils.unmarshalHelper(pagefile.getContents(), null);

            // get the <masterTemplate> node to check the content. this node contains the name of the template file.
            String masterTemplateNodeName = "//masterTemplate";
            Node masterTemplateNode = contentXml.selectSingleNode(masterTemplateNodeName);
            if (masterTemplateNode == null) {
                masterTemplateNode = contentXml.selectSingleNode(masterTemplateNodeName.toLowerCase());
            }
            if (masterTemplateNode == null) {
                masterTemplateNode = contentXml.selectSingleNode(masterTemplateNodeName.toUpperCase());
            }

            // there is only one <masterTemplate> allowed
            String mastertemplate = null;
            if (masterTemplateNode != null) {
                // get the name of the mastertemplate
                mastertemplate = masterTemplateNode.getText().trim();
            }

            // get the <ELEMENTDEF> nodes to check the content.
            // this node contains the information for the body element.
            String elementDefNodeName = "//ELEMENTDEF";
            Node bodyNode = contentXml.selectSingleNode(elementDefNodeName);
            if (bodyNode == null) {
                bodyNode = contentXml.selectSingleNode(elementDefNodeName.toLowerCase());
            }

            // there is only one <ELEMENTDEF> allowed
            if (bodyNode != null) {

                String bodyclass = null;
                String bodyname = null;
                Map<String, String> bodyparams = null;

                List<Element> nodes = ((Element)bodyNode).elements();
                for (int i = 0, n = nodes.size(); i < n; i++) {

                    Node node = nodes.get(i);

                    if ("CLASS".equalsIgnoreCase(node.getName())) {
                        bodyclass = node.getText().trim();
                    } else if ("TEMPLATE".equalsIgnoreCase(node.getName())) {
                        bodyname = node.getText().trim();
                        if (!bodyname.startsWith("/")) {
                            bodyname = CmsResource.getFolderPath(resourcename) + bodyname;
                        }
                    } else if ("PARAMETER".equalsIgnoreCase(node.getName())) {
                        Element paramElement = (Element)node;
                        if (bodyparams == null) {
                            bodyparams = new HashMap<String, String>();
                        }
                        bodyparams.put((paramElement.attribute("name")).getText(), paramElement.getTextTrim());
                    }
                }

                if ((mastertemplate == null) || (bodyname == null)) {

                    CmsMessageContainer message = Messages.get().container(
                        Messages.ERR_IMPORTEXPORT_ERROR_CANNOT_MERGE_PAGE_FILE_3,
                        resourcename,
                        mastertemplate,
                        bodyname);
                    if (LOG.isDebugEnabled()) {
                        LOG.debug(message.key());
                    }

                    throw new CmsImportExportException(message);
                }

                // lock the resource, so that it can be manipulated
                m_cms.lockResource(resourcename);

                // get all properties
                List<CmsProperty> properties = m_cms.readPropertyObjects(resourcename, false);

                // now get the content of the bodyfile and insert it into the control file
                CmsFile bodyfile = m_cms.readFile(bodyname, CmsResourceFilter.IGNORE_EXPIRATION);

                //get the encoding
                String encoding = CmsProperty.get(
                    CmsPropertyDefinition.PROPERTY_CONTENT_ENCODING,
                    properties).getValue();
                if (encoding == null) {
                    encoding = OpenCms.getSystemInfo().getDefaultEncoding();
                }

                if (m_convertToXmlPage) {
                    if (LOG.isDebugEnabled()) {
                        LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_START_CONVERTING_TO_XML_0));
                    }

                    CmsXmlPage xmlPage = CmsXmlPageConverter.convertToXmlPage(
                        m_cms,
                        bodyfile.getContents(),
                        getLocale(resourcename, properties),
                        encoding);

                    if (LOG.isDebugEnabled()) {
                        LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_END_CONVERTING_TO_XML_0));
                    }

                    if (xmlPage != null) {
                        pagefile.setContents(xmlPage.marshal());

                        // set the type to xml page
                        pagefile.setType(CmsResourceTypeXmlPage.getStaticTypeId());
                    }
                }

                // add the template and other required properties
                CmsProperty newProperty = new CmsProperty(
                    CmsPropertyDefinition.PROPERTY_TEMPLATE,
                    mastertemplate,
                    null);
                // property lists must not contain equal properties
                properties.remove(newProperty);
                properties.add(newProperty);

                // if set, add the bodyclass as property
                if (CmsStringUtil.isNotEmpty(bodyclass)) {
                    newProperty = new CmsProperty(CmsPropertyDefinition.PROPERTY_TEMPLATE, mastertemplate, null);
                    newProperty.setAutoCreatePropertyDefinition(true);
                    properties.remove(newProperty);
                    properties.add(newProperty);
                }
                // if set, add bodyparams as properties
                if (bodyparams != null) {
                    for (Iterator<Entry<String, String>> p = bodyparams.entrySet().iterator(); p.hasNext();) {
                        Entry<String, String> entry = p.next();
                        String key = entry.getKey();
                        String value = entry.getValue();
                        newProperty = new CmsProperty(key, value, null);
                        newProperty.setAutoCreatePropertyDefinition(true);
                        properties.remove(newProperty);
                        properties.add(newProperty);
                    }
                }

                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_START_IMPORTING_XML_PAGE_0));
                }

                // now import the resource
                m_cms.importResource(resourcename, pagefile, pagefile.getContents(), properties);

                // finally delete the old body file, it is not needed anymore
                m_cms.lockResource(bodyname);
                m_cms.deleteResource(bodyname, CmsResource.DELETE_PRESERVE_SIBLINGS);

                if (LOG.isDebugEnabled()) {
                    LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_END_IMPORTING_XML_PAGE_0));
                }

                m_report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                    I_CmsReport.FORMAT_OK);

            } else {

                // there are more than one template nodes in this control file
                // convert the resource into a plain text file
                // lock the resource, so that it can be manipulated
                m_cms.lockResource(resourcename);
                // set the type to plain
                pagefile.setType(CmsResourceTypePlain.getStaticTypeId());
                // write all changes
                m_cms.writeFile(pagefile);
                // done, unlock the resource
                m_cms.unlockResource(resourcename);

                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_IMPORTEXPORT_CANNOT_CONVERT_XML_STRUCTURE_1,
                            resourcename));
                }

                m_report.println(Messages.get().container(Messages.RPT_NOT_CONVERTED_0), I_CmsReport.FORMAT_OK);

            }

            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_IMPORTEXPORT_END_MERGING_1, resourcename));
            }
        } catch (CmsXmlException e) {

            throw e;
        } catch (CmsException e) {

            m_report.println(e);

            CmsMessageContainer message = Messages.get().container(
                Messages.ERR_IMPORTEXPORT_ERROR_MERGING_PAGE_FILE_1,
                resourcename);
            if (LOG.isDebugEnabled()) {
                LOG.debug(message.key(), e);
            }

            throw new CmsImportExportException(message, e);
        }

    }
1362477
public void createAndEditNewElement(
        final org.opencms.ade.containerpage.client.ui.CmsContainerPageElementPanel element,
        final boolean inline) {

        if (!element.isNew()) {
            return;
        }

        final CmsContainer container = m_containers.get(element.getParentTarget().getContainerId());

        m_handler.showPageOverlay();
        CmsRpcAction<CmsCreateElementData> action = new CmsRpcAction<CmsCreateElementData>() {

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute()
             */
            @Override
            public void execute() {

                getContainerpageService().checkCreateNewElement(
                    CmsCoreProvider.get().getStructureId(),
                    element.getId(),
                    element.getNewType(),
                    container,
                    getLocale(),
                    this);

            }

            /**
             * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object)
             */
            @Override
            protected void onResponse(CmsCreateElementData result) {

                if (result.needsModelSelection()) {
                    getHandler().openModelResourceSelect(element, result.getModelResources());
                } else {
                    openEditorForNewElement(element, result.getCreatedElement(), inline);
                }
            }
        };
        action.execute();
    }