* @param locationId The locationId as supplied with an event such as startElement or attribute
* @param locationProvider The object that understands how to interpret the locationId
* @return a SaxonLocator containing the location information
*/
public static SaxonLocator getSourceLocator(long locationId, LocationProvider locationProvider) {
SaxonLocator locator;
if (locationProvider instanceof LocationMap && locationId != 0) {
// this is typically true when validating output documents
ExpressionLocation loc = new ExpressionLocation();
loc.setLineNumber(locationProvider.getLineNumber(locationId));
loc.setSystemId(locationProvider.getSystemId(locationId));