Get the <code>&lt;glob:HashValue&gt;</code> Node. If the Node does not
exist, create one and add it to the Document.

@return A DOM Node representing the <code>&lt;glob:HashValue&gt;</code>
tag in the XML document.
509711
public Node getHashNode()
        throws TransformerException
    {
        Node hashNode = getExecutor().getNode(HASH_XPATH);
        if (hashNode == null)
        {
            hashNode = getExecutor().getDoc().createElementNS(GLOBAL_NS,
                HASHVALUE);
            Attr algorithm = getExecutor().getDoc().createAttributeNS(GLOBAL_NS, HASH_ALGORITHM);
            algorithm.setValue(SHA_1);
            ((Element) hashNode).setAttributeNodeNS(algorithm);
            hashNode.appendChild(getExecutor().getDoc().createTextNode(""));
            Node header = getHeaderNode();
            header.insertBefore(hashNode, header.getFirstChild());
        }
        return hashNode;
    }
708832
function(tag) {
		if (!tag) {
			// create a document fragment to hold multiple-root elements
			if (document.createDocumentFragment) {
				return document.createDocumentFragment();
			}

			tag = '';

		} else if (tag.charAt(0) === '!') {
			return document.createComment(tag === '!' ? '' : tag.substr(1)+' ');
		}

		return document.createElement(tag);
	}
811318
private String getElementValue(Element parent, String elementName) {
        String value = null;
        NodeList nodes = parent.getElementsByTagName(elementName);
        if (nodes.getLength() > 0) {
            value = nodes.item(0).getChildNodes().item(0).getNodeValue();
        }
        return value;
    }
417907
public final Element getDocumentElement()
  {
		int dochandle=dtm.getDocument();
		int elementhandle=DTM.NULL;
		for(int kidhandle=dtm.getFirstChild(dochandle);
				kidhandle!=DTM.NULL;
				kidhandle=dtm.getNextSibling(kidhandle))
		{
			switch(dtm.getNodeType(kidhandle))
			{
			case Node.ELEMENT_NODE:
				if(elementhandle!=DTM.NULL) 
				{
					elementhandle=DTM.NULL; // More than one; ill-formed.
					kidhandle=dtm.getLastChild(dochandle); // End loop
				}
				else
					elementhandle=kidhandle;
				break;
				
			// These are harmless; document is still wellformed
			case Node.COMMENT_NODE:
			case Node.PROCESSING_INSTRUCTION_NODE:
			case Node.DOCUMENT_TYPE_NODE:
				break;
					
			default:
				elementhandle=DTM.NULL; // ill-formed
				kidhandle=dtm.getLastChild(dochandle); // End loop
				break;
			}
		}
		if(elementhandle==DTM.NULL)
			throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
		else
			return (Element)(dtm.getNode(elementhandle));
  }
23729
function elementValue(element, tag)
{
    var children = element.getElementsByTagName(tag);
    if (children.length > 0 && children[0].firstChild) {
        var c = children[0];
        if (c.childNodes.length == 1) {
            return c.firstChild.nodeValue;
        } else {
            var s = '';
            for (var ni = 0; ni < c.childNodes.length; ++ni) {
                s += c.childNodes[ni].nodeValue;
            }
            return s;
        }

    } else {
        return null;
    }
}
912310
private Object getObjectValue(Node node, String fieldName) {
        // we have to take into account the fact that fieldName will be in the lower case
        if (node != null) {
            String name = node.getLocalName();
            switch (node.getNodeType()) {
                case Node.ATTRIBUTE_NODE:
                    return name.equalsIgnoreCase(fieldName) ? node : null;
                case Node.ELEMENT_NODE: {
                    if (name.equalsIgnoreCase(fieldName)) {
                        return new NodeArray(node.getChildNodes());
                    } else {
                        NamedNodeMap namedNodeMap = node.getAttributes();
                        for (int attributeIndex = 0; attributeIndex < namedNodeMap.getLength(); ++attributeIndex) {
                            Node attribute = namedNodeMap.item(attributeIndex);
                            if (attribute.getLocalName().equalsIgnoreCase(fieldName)) {
                                return attribute;
                            }
                        }
                        return null;
                    }
                }
                default:
                    return null;
            }
        }
        return null;
    }
469246
public static String getAttributeValue(final Node elementNode, final String attrName, final String defValue)
    {
        final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName);

        if (attrNode == null)
        {
            return defValue;
        }

        return attrNode.getNodeValue();
    }
812036
public boolean getXmlStandalone() {
	// dynamic load to support jre 1.4 and 1.5
	try {
	    Method m = doc.getClass().getMethod("getXmlStandalone", new Class[] {});
	    return Caster.toBooleanValue(m.invoke(doc, ArrayUtil.OBJECT_EMPTY));
	}
	catch (Exception e) {
	    throw new PageRuntimeException(Caster.toPageException(e));
	}
    }
734369
public Document getSchema() {

        Document result;

        if (m_schemaDocument == null) {
            result = DocumentHelper.createDocument();
            Element root = result.addElement(XSD_NODE_SCHEMA);
            root.addAttribute(XSD_ATTRIBUTE_ELEMENT_FORM_DEFAULT, XSD_ATTRIBUTE_VALUE_QUALIFIED);

            Element include = root.addElement(XSD_NODE_INCLUDE);
            include.addAttribute(XSD_ATTRIBUTE_SCHEMA_LOCATION, XSD_INCLUDE_OPENCMS);

            if (m_includes.size() > 0) {
                Iterator<CmsXmlContentDefinition> i = m_includes.iterator();
                while (i.hasNext()) {
                    CmsXmlContentDefinition definition = i.next();
                    root.addElement(XSD_NODE_INCLUDE).addAttribute(
                        XSD_ATTRIBUTE_SCHEMA_LOCATION,
                        definition.m_schemaLocation);
                }
            }

            String outerTypeName = createTypeName(getOuterName());
            String innerTypeName = createTypeName(getInnerName());

            Element content = root.addElement(XSD_NODE_ELEMENT);
            content.addAttribute(XSD_ATTRIBUTE_NAME, getOuterName());
            content.addAttribute(XSD_ATTRIBUTE_TYPE, outerTypeName);

            Element list = root.addElement(XSD_NODE_COMPLEXTYPE);
            list.addAttribute(XSD_ATTRIBUTE_NAME, outerTypeName);

            Element listSequence = list.addElement(XSD_NODE_SEQUENCE);
            Element listElement = listSequence.addElement(XSD_NODE_ELEMENT);
            listElement.addAttribute(XSD_ATTRIBUTE_NAME, getInnerName());
            listElement.addAttribute(XSD_ATTRIBUTE_TYPE, innerTypeName);
            listElement.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO);
            listElement.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_UNBOUNDED);

            Element main = root.addElement(XSD_NODE_COMPLEXTYPE);
            main.addAttribute(XSD_ATTRIBUTE_NAME, innerTypeName);

            Element mainSequence;
            if (m_sequenceType == SequenceType.SEQUENCE) {
                mainSequence = main.addElement(XSD_NODE_SEQUENCE);
            } else {
                mainSequence = main.addElement(XSD_NODE_CHOICE);
                if (getChoiceMaxOccurs() > 1) {
                    mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, String.valueOf(getChoiceMaxOccurs()));
                } else {
                    mainSequence.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO);
                    mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_ONE);
                }
            }

            Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator();
            while (i.hasNext()) {
                I_CmsXmlSchemaType schemaType = i.next();
                schemaType.appendXmlSchema(mainSequence);
            }

            Element language = main.addElement(XSD_NODE_ATTRIBUTE);
            language.addAttribute(XSD_ATTRIBUTE_NAME, XSD_ATTRIBUTE_VALUE_LANGUAGE);
            language.addAttribute(XSD_ATTRIBUTE_TYPE, CmsXmlLocaleValue.TYPE_NAME);
            language.addAttribute(XSD_ATTRIBUTE_USE, XSD_ATTRIBUTE_VALUE_OPTIONAL);
        } else {
            result = (Document)m_schemaDocument.clone();
        }
        return result;
    }
28340
function(s) {
				var e = document.createElement("div");
				e.innerHTML = s;
				return e.childNodes.length === 0
					? ""
					: e.childNodes[0].nodeValue;
			}
1112759
public Node getNode() {
        if (node == null) {
            if (resource != null) {
                node = resource.adaptTo(Node.class);
            }
        }
        return node;
    }
1181747
function(node) {
        var data = {}

        var key = null
        for (var i = 0, len = node.childNodes.length; i < len; i++) {
            var child = node.childNodes[i]
            if (child.nodeType != ELEMENT_NODE) {
                continue
            }

            // Grab the key, next noe should be the value
            if (child.tagName == 'key') {
                key = child.firstChild.nodeValue
            } else {
                // Parse the value node
                data[key] = this._parseNode(child)
            }
        }


        return data
    }
1282172
public UNode toDoc() {
        // Root node is a MAP and its name is the field name. Set its tag name to "field"
        // for XML.
        UNode fieldNode = UNode.createMapNode(m_name, "field");
        
        // Groups and non-groups are handled differently.
        if (m_type != FieldType.GROUP) {
            // Non-group: Add a "type" attribute, marked as an XML attribute.
            fieldNode.addValueNode("type", m_type.toString(), true);
            
            // Add 'collection', marked as an XML attribute.
            if (m_type.isLinkType() || m_bIsCollection) {
                fieldNode.addValueNode("collection", Boolean.toString(m_bIsCollection), true);
            }
            
            // Add 'analyzer' attribute, if specified, marked as an XML attribute.
            if (m_analyzerName != null) {
                fieldNode.addValueNode("analyzer", m_analyzerName, true);
            }
            
            // Add 'encoding' if applicable, marked as an XML attribute.
            if (m_type == FieldType.BINARY) {
                fieldNode.addValueNode("encoding", m_encoding.toString(), true);
            }
            
            // If this field is a link, add the 'inverse' and 'table' attributes, each
            // marked as XML attributes. Add the link field number only if it is being used.
            if (m_type.isLinkType()) {
                fieldNode.addValueNode("inverse", m_linkInverse, true);
                fieldNode.addValueNode("table", m_linkExtent, true);
            }
                
            // Add 'sharded' for link if true.
            if (m_type == FieldType.LINK && m_bIsSharded) {
                fieldNode.addValueNode("sharded", Boolean.toString(m_bIsSharded), true);
            }
            
            // Add 'junction' for xlink.
            if (m_type == FieldType.XLINK) {
                fieldNode.addValueNode("junction", m_junctionField, true);
            }
        } else {
            // Create a MAP node called "fields".
            assert m_nestedFieldMap.size() > 0;
            UNode fieldsNode = fieldNode.addMapNode("fields");
            
            // Recursing to nested fields, adding them as child nodes.
            for (FieldDefinition nestedFieldDef : getNestedFields()) {
                fieldsNode.addChildNode(nestedFieldDef.toDoc());
            }
        }
        return fieldNode;
    }
1154522
@Pure
	public static Document getDocumentFor(Node node) {
		Node localnode = node;
		while (localnode != null) {
			if (localnode instanceof Document) {
				return (Document) localnode;
			}
			localnode = localnode.getParentNode();
		}
		return null;
	}
538577
public static DocumentNode toDocumentNode(List<Object> documentNodeParams)
    {
        DocumentNode node = new DocumentNode((String) documentNodeParams.get(NODE_TITLE_INDEX));
        node.setIsExecutable((Boolean) documentNodeParams.get(NODE_EXECUTABLE_INDEX));
        node.setCanBeImplemented((Boolean) documentNodeParams.get(NODE_CAN_BE_IMPLEMENTED_INDEX));
        if (documentNodeParams.size() == 5) {
            node.setURL((String) documentNodeParams.get(NODE_URL_INDEX));
        }

        Hashtable children = (Hashtable) documentNodeParams.get(NODE_CHILDREN_INDEX);
        @SuppressWarnings("unchecked")
        Collection<Vector<Object>> values = children.values();
        for (Vector<Object> nodeParams : values) {

            if(nodeParams.size() > 5 ) {
                node.addChildren(ReferenceNode.toReferenceNode(nodeParams));
            } else {
                node.addChildren(toDocumentNode(nodeParams));
            }
        }

        return node;
    }
35016
public static boolean hasHtmlNodes(Node node) {
    return hasNodesOfType(
        node,
        HtmlOpenTagNode.class,
        HtmlCloseTagNode.class,
        HtmlCommentNode.class,
        HtmlAttributeNode.class,
        HtmlAttributeValueNode.class);
  }
23168
private SearchNode getSearchNode()
    {
        Object x = _searchNode.get();
        SearchNode g = null;
        if (x != null)
        {
            g = (SearchNode) x;
            g.reset();
        }
        else
        {
            g = new SearchNode();
            x = (Object) g;
            _searchNode.set(x);
        }
        return g;
    }