Interface XmlPositioner
-
- All Known Implementing Classes:
FullFilePositioner,PartialFilePositioner
public interface XmlPositionerAssociates XML nodes with a position. This is a low-level utility, created by this library (seeXmlErrorUtils::parse). It's meant as a back-end for a validation helper, likeXmlMessageReporter.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable ContextLinesgetLinesAround(XmlPosition position, int numContextLines)Enrich the given message with the context of the position.static XmlPositionernoPositioner(@Nullable java.lang.String systemId)A positioner that returns undefined positions.XmlPositionstartPositionOf(@Nullable org.w3c.dom.Node node)Returns an object describing the position in the file of the given XML node.
-
-
-
Method Detail
-
startPositionOf
XmlPosition startPositionOf(@Nullable org.w3c.dom.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 errornumContextLines- Number of lines to include before and after- Returns:
- The full message
-
noPositioner
static XmlPositioner noPositioner(@Nullable java.lang.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
-
-