Get a DOM document root from a message.

@param childNodeList
@return
@throws BadMessageFormatMatchingException
496029
public Object getDocumentRoot(MatchSpaceKey msg) 
    throws BadMessageFormatMatchingException
  {
    if (tc.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.entry(cclass, "getDocumentRoot", msg);

    Object docRoot = null;
    
    if (tc.isAnyTracingEnabled() && tc.isEntryEnabled())
      tc.exit(cclass, "getDocumentRoot", docRoot);    
    return docRoot;
  }
721290
public Node getDOM()
    {
        if (m_message != null)
        {
        	BaseMessage message = m_message.getMessage();
        	return message.getDOM();
        }
        return super.getDOM();	// Null
    }
741478
public static Document getSoapBody(Document soapMessage) throws Exception {
        Element envelope = soapMessage.getDocumentElement();
        Element body = DomUtils.getChildElement(DomUtils.getElementByTagName(
                envelope, envelope.getPrefix() + ":Body"));
        Document content = DomUtils.createDocument(body);

        Element documentRoot = content.getDocumentElement();
        addNSdeclarations(envelope, documentRoot);
        addNSdeclarations(body, documentRoot);
        return content;
    }
300033
@Override
    public String getContextRoot() {
        if (delegate == null) {
            return this.contextRoot;
        } else {
            return this.contextRoot == null ? delegate.getContextRoot() : this.contextRoot;
        }
    }
1056225
public static String getChildText(Element parent, String childName) {
		Element child = getChild(parent, childName);
		if (child == null) return null;
		return getInnerText(child);
	}
59684
@Override
    public String getMessage() {
        // In case the immediate child has the same msgCode, it must be
        // duplicated
        if (childException != null) {
            if (msgKey.equals(childException.getMsgKey())) {
                return childException.getMessage();
            }
        }
        if (message == null && msgKey != null) {
            message = Tr.formatMessage(tc, msgKey, objs);
        }
        if (message != null) {
            return message;
        } else {
            return this.getClass().getName();
        }
    }
775681
protected function _buildNodeListUntil(\DOMNode $baseNode, string $property, $input = null, $selector = null, int $matchType = null): NodeList {
        $resultNodes = $this->newNodeList();

        // Get our first node
        $node = $baseNode->$property;

        // Keep looping until we are out of nodes.
        // Allow either FIRST to reach \DOMDocument. Others that return multiple should ignore it.
        while ($node instanceof \DOMNode && ($matchType === self::$MATCH_TYPE_FIRST || !($node instanceof \DOMDocument))) {
            // Filter nodes if not matching last
            if ($matchType != self::$MATCH_TYPE_LAST && (is_null($selector) || $node->is($selector))) {
                $resultNodes[] = $node;
            }

            // 'Until' check or first match only
            if ($matchType == self::$MATCH_TYPE_FIRST || (!is_null($input) && $node->is($input))) {
                // Set last match
                if ($matchType == self::$MATCH_TYPE_LAST) {
                    $resultNodes[] = $node;
                }

                break;
            }

            // Find the next node
            $node = $node->{$property};
        }

        return $resultNodes;
    }
816945
public void logDomNodeList (String msg, NodeList nodeList) {
		StackTraceElement caller = StackTraceUtils.getCallerStackTraceElement ();

		String toLog = (msg != null ? msg + "\n" : "DOM nodelist:\n");
		for (int i = 0; i < nodeList.getLength (); i++) {
			toLog += domNodeDescription (nodeList.item (i), 0) + "\n";
		}

		if (caller != null) {
			logger.logp (Level.FINER, caller.getClassName (), caller.getMethodName () + "():" + caller.getLineNumber (), toLog);
		} else {
			logger.logp (Level.FINER, "(UnknownSourceClass)", "(unknownSourceMethod)", toLog);
		}
	}
721008
public CallTreeNode getOrAddChild(String name) {
		CallTreeNode child = getChild(name);
		if (child == null) {
			child = addChild(name);
		}
		return child;
	}
465748
public static NodeList getNodeListByXPath(String expression, Object source) {
		return (NodeList) getByXPath(expression, source, XPathConstants.NODESET);
	}
1109107
public static function getChildText(DOMElement $parent, $childName)
    {
        $child = self::getChildElement($parent, $childName);

        if (null === $child) {
            return null;
        }

        return self::getText($child);
    }
998645
public static Node getOneTaggedNode(final Node el,
                                      final String name)
          throws SAXException {
    if (!el.hasChildNodes()) {
      return null;
    }

    final NodeList children = el.getChildNodes();

    for (int i = 0; i < children.getLength(); i++) {
      final Node n = children.item(i);

      if (name.equals(n.getNodeName())) {
        return n;
      }
    }

    return null;
  }
1039736
static String[] getChildElementTextArr(Element parent, String name) {
        // Get all the elements
        List children = getChildElementsByName(parent, name);

        String str[] = new String[children.size()];

        for (int i = 0; i < children.size(); i++) {
            Node child = (Node) children.get(i);

            StringBuffer buf = new StringBuffer();

            NodeList nodes = child.getChildNodes();
            for (int j = 0; j < nodes.getLength(); j++) {
                Node node = nodes.item(j);
                if (node.getNodeType() == Node.TEXT_NODE ||
                        node.getNodeType() == Node.CDATA_SECTION_NODE) {
                    Text text = (Text) node;
                    buf.append(text.getData().trim());
                }
            }

            str[i] = buf.toString();
        }

        return str;
    }
822735
static String getChildElementText(Element parent, String name) {
        // Get children
        List list = DomUtils.getChildElementsByName(parent, name);

        if (list.size() == 1) {
            Element child = (Element) list.get(0);

            StringBuffer buf = new StringBuffer();

            NodeList children = child.getChildNodes();
            for (int i = 0; i < children.getLength(); i++) {
                Node node = children.item(i);
                if (node.getNodeType() == Node.TEXT_NODE ||
                        node.getNodeType() == Node.CDATA_SECTION_NODE) {
                    Text text = (Text) node;
                    buf.append(text.getData().trim());
                }
            }

            return buf.toString();
        } else {
            return null;
        }
    }
586410
private Element findRootFolderElement( Document dom )
    {
        NodeList list = dom.getElementsByTagNameNS( "*", "folder" );

        final String localRootId = getRootId(); // cache it also in this method

        for ( int i = 0; i < list.getLength(); i++ ) {
            Element e = ( Element ) list.item( i );
            if ( e.getAttribute( "id" ).equals( localRootId ) ) {
                return e;
            }
        }
        throw new CStorageException( "Could not find root folder with id=" + localRootId );
    }
220139
public static String getRdfaAttributes(I_CmsXmlContentValue parentValue, String childNames) {

        String id = CmsContentDefinition.uuidToEntityId(
            parentValue.getDocument().getFile().getStructureId(),
            parentValue.getLocale().toString()) + "/" + parentValue.getPath();
        String path = "";
        String[] children = childNames.split("\\|");
        for (int i = 0; i < children.length; i++) {
            I_CmsXmlSchemaType schemaType = parentValue.getContentDefinition().getSchemaType(
                parentValue.getName() + "/" + children[i]);
            if (schemaType != null) {
                if (i > 0) {
                    path += " ";
                }
                String typePath = parentValue.getPath();
                path += "/" + removePathIndexes(typePath) + ":";
                path += getTypeUri(schemaType.getContentDefinition()) + "/" + children[i];
            }
        }
        return String.format(RDFA_ATTRIBUTES, id, path);
    }
709286
function findRootNode(document)
{
	var i;
	var rootNodes = document.childNodes;
	
	for (i=0; i<rootNodes.length; i++)
	{
		// Doctypes have no `childNodes` property
		if (rootNodes[i].childNodes != null)
		{
			return rootNodes[i];
		}
	}
}