code: protected void detectRecursiveInclusion(DataResource dataResource) throws XMLStreamException {
  
      if (this.resource.equals(dataResource)) {
        throw new XMLStreamException("Recursive inclusion: " + this.resource.getPath());
      }
      if (this.parent != null) {
        try {
          detectRecursiveInclusion(dataResource);
        } catch (RuntimeException e) {
          throw new XMLStreamException("Recursive inclusion: " + this.resource.getPath(), e);
        }
      }
    }
docs: This method detects if a recursive inclusion takes place. <br>
  
  TODO: Potentially the same resource could cause an inclusion cycle without causing an infinity loop by
  using different XPointer expressions.
  
  @param dataResource is the current data-resource to include.
  @throws XMLStreamException if the given {@code dataResource} has already been included causing an
  infinity loop.