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 Summary
Modifier and TypeMethodDescriptiongetLinesAround(XmlPosition position, int numContextLines) Enrich the given message with the context of the position.static XmlPositionernoPositioner(@Nullable String systemId) A positioner that returns undefined positions.startPositionOf(@Nullable Node node) Returns an object describing the position in the file of the given XML node.
-
Method Details
-
startPositionOf
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
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 errornumContextLines- Number of lines to include before and after- Returns:
- The full message
-
noPositioner
A positioner that returns undefined positions.- Parameters:
systemId- Optional system id, if it is known (but not line/columns)- Returns:
- A new positioner
-