code: private boolean isAllowedInsideList(Node node)
      {
          return (node.getNodeType() != Node.ELEMENT_NODE || node.getNodeName().equalsIgnoreCase(TAG_LI))
              && (node.getNodeType() != Node.TEXT_NODE || node.getNodeValue().trim().length() == 0);
      }
docs: Checks if a given node is allowed or not as a child of a &lt;ul&gt; or &lt;ol&gt; element.
  
  @param node the node to be checked
  @return {@code true} if the given node is allowed inside an ordered or unordered list, {@code false} otherwise