docs: protected boolean validateEntities(final ContentSpec contentSpec) {
          final String entities = contentSpec.getEntities();
          if (isNullOrEmpty(entities)) return true;
  
          boolean valid = true;
  
          // Make sure the input is valid XML.
          final String wrappedEntities = "<!DOCTYPE section [" + entities + "]><section></section>";
          Document doc = null;
          try {
              doc = XMLUtilities.convertStringToDocument(wrappedEntities);
          } catch (Exception e) {
              final String line = CommonConstants.CS_ENTITIES_TITLE + " = [" + entities + "]";
              log.error(String.format(ProcessorConstants.ERROR_INVALID_ENTITIES_MSG, e.getMessage(), line));
              valid = false;
          }
  
          // Check that no reserved entities are defined.
          if (doc != null) {
              final List<String> invalidEntities = new ArrayList<String>();
              final NamedNodeMap entityNodes = doc.getDoctype().getEntities();
              for (int i = 0; i < entityNodes.getLength(); i++) {
                  final org.w3c.dom.Node entityNode = entityNodes.item(i);
                  if (ProcessorConstants.RESERVED_ENTITIES.contains(entityNode.getNodeName())) {
                      invalidEntities.add(entityNode.getNodeName());
                  }
              }
  
              if (!invalidEntities.isEmpty()) {
                  final StringBuilder builder = new StringBuilder();
                  for (int i = 0; i < invalidEntities.size(); i++) {
                      if (i != 0) {
                          if (i == invalidEntities.size() - 1) {
                              builder.append(" and ");
                          } else {
                              builder.append(", ");
                          }
                      }
                      builder.append(invalidEntities.get(i));
                  }
  
                  final String line = CommonConstants.CS_ENTITIES_TITLE + " = [" + entities + "]";
                  if (invalidEntities.size() == 1) {
                      log.error(String.format(ProcessorConstants.ERROR_RESERVED_ENTITIES_SINGLE_DEFINED_MSG, builder.toString(), line));
                  } else {
                      log.error(String.format(ProcessorConstants.ERROR_RESERVED_ENTITIES_DEFINED_MSG, builder.toString(), line));
                  }
                  valid = false;
              }
          }
  
          return valid;
      }