Parse a boolean value from the first child of the given node.

@param node The node
@return The boolean value
@throws XmlException If the given node was <code>null</code>
433534
static boolean readBoolean(Node node)
    {
        if (node == null)
        {
            throw new XmlException(
                "Tried to read boolean value from null node");
        }
        String value = node.getFirstChild().getNodeValue();
        return Boolean.parseBoolean(value);
    }
79010
public static Optional<Node> getContainingNode(final Node node) {
        try {
            if (node.getDepth() == 0) {
                return empty();
            }

            // check ancestors recursively only either of the following two cases applies:
            // 1. the PARENT is a FEDORA_PAIRTREE
            // 2. the PARENT is FEDORA_NON_RDF_SOURCE_DESCRIPTION
            final Node parent = node.getParent();
            if (parent.isNodeType(FEDORA_PAIRTREE) || parent.isNodeType(FEDORA_NON_RDF_SOURCE_DESCRIPTION)) {
                return getContainingNode(parent);
            }
            return Optional.of(parent);
        } catch (final RepositoryException ex) {
            throw new RepositoryRuntimeException(ex);
        }
    }
204159
public boolean isAncestor(XMLNode node) {
		return node == parent || (parent != null && parent.isAncestor(node));
	}
1074790
public Node<T> getPrevious(Node<T> node) {
    	if (node.left != null) {
    		node = node.left;
    		while (node.right != null) node = node.right;
    		return node;
    	}
    	// nothing at left, it may be the parent node if the node is at the right
    	if (node == first) return null;
    	return getPrevious(root, node.value);
    }
380042
protected static final boolean isArray(Node node) {
		NodeList children = node.getChildNodes();
		if (children != null) {
			HashSet<String> names = new HashSet<String>();
			int max = children.getLength();
			for (int i = 0; i < max; i++) {
				Node child = children.item(i);
				if (child.getNodeType() == Node.ELEMENT_NODE) {
					String name = child.getNodeName();
					if (names.contains(name)) {
						return true;
					}
					names.add(name);
				}
			}
		}
		return false;
	}
691222
private String getStringValue(XmlNode node) {
        switch (node.getType()) {
            case XmlNode.ATTRIBUTE_NODE:
            case XmlNode.TEXT_NODE:
                return node.getValue();
            default: {
                StringBuilder builder = new StringBuilder();
                this.transformer.transform(node, builder);
                return builder.toString();
            }
        }
    }
1127545
@Override
  public XMLObject unmarshall(Element domElement) throws UnmarshallingException {

    Document newDocument = null;

    Node childNode = domElement.getFirstChild();
    while (childNode != null) {
      if (childNode.getNodeType() != Node.TEXT_NODE) {
        // We skip everything except for a text node.
        log.info("Ignoring node {} - it is not a text node", childNode.getNodeName());
      }
      else {
        newDocument = parseContents((Text) childNode, domElement);
        if (newDocument != null) {
          break;
        }
      }
      childNode = childNode.getNextSibling();
    }

    return super.unmarshall(newDocument != null ? newDocument.getDocumentElement() : domElement);
  }
1365484
Boolean getBooleanAttribute(org.w3c.dom.Node attribute)  {
    String s = getStringAttribute(attribute);

    if (s == null) {
      return null;
    }

    return Boolean.parseBoolean(s);
  }
391319
private Node getNode(boolean bDataRoot)
    {
        if (m_data == null)
        {
            DocumentBuilder db = Util.getDocumentBuilder();
            synchronized (db)
            {
                m_data = (Node)db.newDocument();
                String rootTag = ROOT_TAG;
                if (this.getMessageDataDesc(null) != null)
                	if (this.getMessageDataDesc(null).getKey() != null)
                		rootTag = this.getMessageDataDesc(null).getKey();
                ((Document)m_data).appendChild(((Document)m_data).createElement(rootTag));
            }
        }
        if (bDataRoot)
        	if (m_data instanceof Document)
        		return ((Document)m_data).getDocumentElement();
        return (Node)m_data;
    }
194968
public boolean matches(final Node node) {
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            return matches(((Element) node).getAttribute(ATTRIBUTE_NAME_CLASS));
        }
        return false;
    }
562390
function parseXMLNode(node) {
  const parsedNode = {
    attributes: {},
    children: {},
    value: {},
  };

  parsedNode.value = parseNodeValue(node);

  if (node.attributes) {
    [...node.attributes].forEach((nodeAttr) => {
      if (nodeAttr.nodeName && nodeAttr.nodeValue !== undefined && nodeAttr.nodeValue !== null) {
        parsedNode.attributes[nodeAttr.nodeName] = nodeAttr.nodeValue;
      }
    });
  }

  if (node.childNodes) {
    [...node.childNodes]
      .filter((childNode) => childNode.nodeName.substring(0, 1) !== '#')
      .forEach((childNode) => {
        parsedNode.children[childNode.nodeName] = parseXMLNode(childNode);
      });
  }

  return parsedNode;
}
696943
public boolean parse(final boolean fragment) throws FrameworkException {

		init();

		if (StringUtils.isNotBlank(code)) {

			if (!isDeployment) {
				logger.info("##### Start parsing code for page {} #####", new Object[]{name});
			} else {

				// a trailing slash to all void/self-closing tags so the XML parser can parse it correctly
				code = code.replaceAll("<(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)([^>]*)>", "<$1$2/>");
			}

			if (fragment) {

				if (isDeployment) {

					final List<Node> nodeList = Parser.parseXmlFragment(code, "");
					parsedDocument            = Document.createShell("");
					final Element body        = parsedDocument.body();
					final Node[] nodes        = nodeList.toArray(new Node[nodeList.size()]);

					for (int i = nodes.length - 1; i > 0; i--) {
					    nodes[i].remove();
					}

					for (Node node : nodes) {
					    body.appendChild(node);
					}

				} else {

					parsedDocument = Jsoup.parseBodyFragment(code);
				}

			} else {

				if (isDeployment) {

					parsedDocument = Jsoup.parse(code, "", Parser.xmlParser());

				} else {

					parsedDocument = Jsoup.parse(code);
				}

			}

		} else {

			if (!isDeployment) {
				logger.info("##### Start fetching {} for page {} #####", new Object[]{address, name});
			}

			code = HttpHelper.get(address);
			parsedDocument = Jsoup.parse(code);

		}

		return true;

	}
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
    }
433570
public static String child(String node) {
        final int index = node.lastIndexOf('/');
        if (index < 0 || index == node.length() - 1)
            return null;
        return node.substring(index + 1, node.length());
    }
293657
private boolean parseBoolean(String s) {
        if ( "1".equals(s) ) {
            return true;
        } else if ( "0".equals(s) ) {
            return false;
        } else {
            throw new IllegalArgumentException("Expected 1 or 0 for boolean value, was " + s);
        }
    }
153455
public synchronized Node parse(String xml) throws IOException, SAXException {
        ByteArrayInputStream is = new ByteArrayInputStream(xml.getBytes());
        return parse(is);
    }
618996
public static <T> T asValue(JsonNode node, Class<T> clazz) {
        return node != null ? ValueUtils.convertValue(node, clazz) : null;
    }