code: public T loadXml(DataResource resource) {
  
      if (isXIncludeAware()) {
        XMLStreamReader streamReader = getStaxUtil().createXmlStreamReader(resource, true);
        try {
          Object unmarshalledObject = getOrCreateUnmarshaller().unmarshal(streamReader);
          T jaxbBean = this.xmlBeanClass.cast(unmarshalledObject);
          validate(jaxbBean);
          return jaxbBean;
        } catch (Exception e) {
          throw new XmlInvalidException(e, resource);
        } finally {
          try {
            streamReader.close();
          } catch (XMLStreamException e) {
            throw new IllegalStateException("Failed to close stream reader.", e);
          }
        }
      } else {
        InputStream inputStream = resource.openStream();
        try {
          return loadXml(inputStream, resource);
        } catch (RuntimeException e) {
          throw new XmlInvalidException(e, resource.getUri());
        } finally {
          try {
            inputStream.close();
          } catch (Exception e) {
            // ignore...
          }
        }
      }
    }
docs: This method loads the JAXB-bean as XML from the given {@code resource} .
  
  @param resource is the {@link DataResource} with the XML to parse.
  @return the parsed XML converted to the according JAXB-bean.