Interface IDocumentLoader

All Superinterfaces:
IResourceResolver
All Known Subinterfaces:
IBoundLoader
All Known Implementing Classes:
DefaultBoundLoader

public interface IDocumentLoader extends IResourceResolver
Supports loading documents referenced in Metapath expressions.
  • Method Details

    • setUriResolver

      void setUriResolver(@NonNull IUriResolver resolver)
      Allows setting an IUriResolver, which will be used to map URIs prior to loading the resource.
      Parameters:
      resolver - the resolver to set
    • loadAsNodeItem

      @NonNull default IDocumentNodeItem loadAsNodeItem(@NonNull File file) throws IOException
      Load a Metaschema-based document from a file resource.
      Parameters:
      file - the file to load
      Returns:
      a document item representing the contents of the document.
      Throws:
      IOException - if an error occurred while parsing the file
    • loadAsNodeItem

      @NonNull default IDocumentNodeItem loadAsNodeItem(@NonNull Path path) throws IOException
      Load a Metaschema-based document from a file resource identified by a path.
      Parameters:
      path - the file to load
      Returns:
      a document item representing the contents of the document.
      Throws:
      IOException - if an error occurred while parsing the file
    • loadAsNodeItem

      @NonNull default IDocumentNodeItem loadAsNodeItem(@NonNull URL url) throws IOException, URISyntaxException
      Load a Metaschema-based document from a URL resource.
      Parameters:
      url - the resource to load
      Returns:
      a document item representing the contents of the document.
      Throws:
      IOException - if an error occurred while parsing the resource
      URISyntaxException - if the URL is not a valid URI
    • loadAsNodeItem

      @NonNull IDocumentNodeItem loadAsNodeItem(@NonNull URI uri) throws IOException
      Load a Metaschema-based document from a URI resource.

      This is the expected, primary entry point for implementations.

      Parameters:
      uri - the resource to load
      Returns:
      a document item representing the contents of the document.
      Throws:
      IOException - if an error occurred while parsing the resource