//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Copyright (c) 2018 Saxonica Limited. // This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. // If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. // This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// package net.sf.saxon.event; import org.xml.sax.Locator; import java.util.Stack; /** * Implementation of the SAX Locator interface, used to supply location information to the ContentHandler. *
When the ContentHandler is used to receive the results of a query or stylesheet, * the information supplied by the standard methods such as {@link #getSystemId} and * {@link #getLineNumber} relates to the position of the expression/instruction in the stylesheet * or query that caused the relevant nodes to be output.
*If the ContentHandler is used in other contexts, for example as the destination of an * IdentityTransformer, the information reflects the position in the source document.
*If the output property saxon:supply-source-locator was set to the
* value "yes" (which in turn requires that tracing was enabled at compile time), the Locator will
* also contain information about the current location in the source document (specifically, the position
* of the context node). This will not always be 100% accurate, since there is some buffering of events
* in the output pipeline: it reflects the context node at the time the event reaches the ContentHandler,
* which may not be the same as the context node at the time the relevant instruction was executed;
* however, it still provides some information that may be useful for diagnostics.