Colibrio Reader Framework API - Cloud license
    Preparing search index...

    Used for parsing Locators and for creating Locator ranges.

    Implements

    Constructors

    Methods

    • Parses the given data into a new Locator by:

      • parsing an absolute URL, URI, URN or IRI (referred to as URL from now on.)
      • parsing a relative URL together with a base URL.
      • parsing an object compatible with the ILocatorData type.

      The ILocatorData is modeled after the "Resource" and "SpecificResource" types defined by the Web Annotations specification: https://www.w3.org/TR/annotation-model

      Legacy Colibrio ILegacyAnnotationTarget objects are not valid with the "External Web Resource" or "Specific Resource" types due to using "id" instead of "source" while also specifying a "selector". For backwards compatibility, these object can still be used with this method. If the ILegacyAnnotationTarget does not have an "id", you must provide a baseUrl.

      NOTE: JSON-LD processing is NOT supported. Ensure that the data passed to this method is compatible with the IWebAnnotationResourceData or IWebAnnotationSpecificResourceData type.

      NOTE: Specifying both the 'selector' property AND a fragment part in 'source' is strongly discouraged as this behaviour is not fully defined in the Web Annotations spec. Colibrio's behavior is to treat 'selector' as refinement selectors on the fragment selector.

      Selectors that cannot be parsed by the selector factory will be dropped.

      Parameters

      • data: Locator | ILocatorData

        The data to parse into a Locator.

      • OptionalbaseUrl: string | URL

        The base URL to use if data is a relative URL, otherwise this parameter is unused.

      Returns ILocatorParseResult

      An object with a new Locator instance or the error that caused the parse to fail.