Interface XmlPositioner

All Known Implementing Classes:
FullFilePositioner, PartialFilePositioner

public interface XmlPositioner
Associates XML nodes with a position. This is a low-level utility, created by this library (see XmlErrorUtils::parse). It's meant as a back-end for a validation helper, like XmlMessageReporter.
  • Method Details

    • startPositionOf

      XmlPosition startPositionOf(@Nullable Node node)
      Returns an object describing the position in the file of the given XML node. If no position is available, or if the parameter is null, returns an undefined position.
      Parameters:
      node - XML node
      Returns:
      A position
    • getLinesAround

      @Nullable ContextLines getLinesAround(XmlPosition position, int numContextLines)
      Enrich the given message with the context of the position. Typically this adds the source lines of the source file around the error message.
      Parameters:
      position - Position of the error
      numContextLines - Number of lines to include before and after
      Returns:
      The full message
    • noPositioner

      static XmlPositioner noPositioner(@Nullable String systemId)
      A positioner that returns undefined positions.
      Parameters:
      systemId - Optional system id, if it is known (but not line/columns)
      Returns:
      A new positioner