Initializes and processes a stylesheet via SAX events.
This class acts as essentially a state machine, maintaining
a ContentHandler stack, and pushing appropriate content
handlers as parse events occur.
characters
public void characters(ch[] ,
int start,
int length)
throws org.xml.sax.SAXException
Receive notification of character data inside an element.
start
- The start position in the character array.length
- The number of characters to use from the
character array.
org.xml.sax.ContentHandler.characters
createXPath
public XPath createXPath(String str,
ElemTemplateElement owningTemplate)
throws javax.xml.transform.TransformerException
Process an expression string into an XPath.
Must be public for access by the AVT class.
str
- A non-null reference to a valid or invalid XPath expression string.
- A non-null reference to an XPath object that represents the string argument.
endDocument
public void endDocument()
throws org.xml.sax.SAXException
Receive notification of the end of the document.
org.xml.sax.ContentHandler.endDocument
endElement
public void endElement(String uri,
String localName,
String rawName)
throws org.xml.sax.SAXException
Receive notification of the end of an element.
uri
- The Namespace URI, or an empty string.localName
- The local name (without prefix), or empty string if not namespace processing.rawName
- The qualified name (with prefix).
org.xml.sax.ContentHandler.endElement
endPrefixMapping
public void endPrefixMapping(String prefix)
throws org.xml.sax.SAXException
Receive notification of the end of a Namespace mapping.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions at the start of
each element (such as allocating a new tree node or writing
output to a file).
prefix
- The Namespace prefix being declared.
org.xml.sax.ContentHandler.endPrefixMapping
error
public void error(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
Receive notification of a recoverable XSLT processing error.
e
- The error information encoded as an exception.
fatalError
public void fatalError(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
Report a fatal XSLT processing error.
e
- The error information encoded as an exception.
getBaseIdentifier
public String getBaseIdentifier()
Return the base identifier.
- getBaseIdentifier in interface PrefixResolver
- The base identifier of the current stylesheet.
getIncremental
public boolean getIncremental()
getLocator
public SAXSourceLocator getLocator()
Get the current stylesheet Locator object.
- non-null reference to the current locator object.
getNamespaceForPrefix
public String getNamespaceForPrefix(String prefix)
Given a namespace, get the corrisponding prefix from the current
namespace support context.
- getNamespaceForPrefix in interface PrefixResolver
prefix
- The prefix to look up, which may be an empty string ("") for the default Namespace.
- The associated Namespace URI, or null if the prefix
is undeclared in this context.
getNamespaceForPrefix
public String getNamespaceForPrefix(String prefix,
org.w3c.dom.Node context)
Given a namespace, get the corrisponding prefix. This is here only
to support the
PrefixResolver
interface,
and will throw an error if invoked on this object.
- getNamespaceForPrefix in interface PrefixResolver
prefix
- The prefix to look up, which may be an empty string ("") for the default Namespace.context
- The node context from which to look up the URI.
- The associated Namespace URI, or null if the prefix
is undeclared in this context.
getOptimize
public boolean getOptimize()
getOriginatingNode
public Node getOriginatingNode()
Set the node that is originating the SAX event.
- Reference to node that originated the current event.
getSchema
public XSLTSchema getSchema()
Get the root of the XSLT Schema, which tells us how to
transition content handlers, create elements, etc.
- The root XSLT Schema, which should never be null.
getSource_location
public boolean getSource_location()
getStylesheetProcessor
public TransformerFactoryImpl getStylesheetProcessor()
Get the XSLT TransformerFactoryImpl for needed services.
TODO: This method should be renamed.
- The TransformerFactoryImpl that owns this handler.
getStylesheetRoot
public StylesheetRoot getStylesheetRoot()
Return the stylesheet root that this handler is constructing.
- The root stylesheet of the stylesheets tree.
getSystemId
public String getSystemId()
Get the base ID (URI or system ID) from where relative
URLs will be resolved.
getTemplates
public Templates getTemplates()
When this object is used as a ContentHandler or ContentHandler, it will
create a Templates object, which the caller can get once
the SAX events have been completed.
- The stylesheet object that was created during
the SAX event process, or null if no stylesheet has
been created.
Author Scott Boag
ignorableWhitespace
public void ignorableWhitespace(ch[] ,
int start,
int length)
throws org.xml.sax.SAXException
Receive notification of ignorable whitespace in element content.
start
- The start position in the character array.length
- The number of characters to use from the
character array.
org.xml.sax.ContentHandler.ignorableWhitespace
isStylesheetParsingComplete
public boolean isStylesheetParsingComplete()
Test whether the _last_ endDocument() has been processed.
This is needed as guidance for stylesheet optimization
and compilation engines, which generally don't want to start
until all included and imported stylesheets have been fully
parsed.
- true iff the complete stylesheet tree has been built.
notationDecl
public void notationDecl(String name,
String publicId,
String systemId)
Receive notification of a notation declaration.
By default, do nothing. Application writers may override this
method in a subclass if they wish to keep track of the notations
declared in a document.
name
- The notation name.publicId
- The notation public identifier, or null if not
available.systemId
- The notation system identifier.
org.xml.sax.DTDHandler.notationDecl
processingInstruction
public void processingInstruction(String target,
String data)
throws org.xml.sax.SAXException
Receive notification of a processing instruction.
The Parser will invoke this method once for each processing
instruction found: note that processing instructions may occur
before or after the main document element.
A SAX parser should never report an XML declaration (XML 1.0,
section 2.8) or a text declaration (XML 1.0, section 4.3.1)
using this method.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions for each
processing instruction, such as setting status variables or
invoking other methods.
target
- The processing instruction target.data
- The processing instruction data, or null if
none is supplied.
org.xml.sax.ContentHandler.processingInstruction
pushStylesheet
public void pushStylesheet(Stylesheet s)
Push the current stylesheet being constructed. If no other stylesheets
have been pushed onto the stack, assume the argument is a stylesheet
root, and also set the stylesheet root member.
s
- non-null reference to a stylesheet.
resolveEntity
public InputSource resolveEntity(String publicId,
String systemId)
throws org.xml.sax.SAXException
Resolve an external entity.
publicId
- The public identifer, or null if none is
available.systemId
- The system identifier provided in the XML
document.
- The new input source, or null to require the
default behaviour.
setDocumentLocator
public void setDocumentLocator(Locator locator)
Receive a Locator object for document events.
This is called by the parser to push a locator for the
stylesheet being parsed. The stack needs to be popped
after the stylesheet has been parsed. We pop in
popStylesheet.
locator
- A locator for all SAX document events.
org.xml.sax.ContentHandler.setDocumentLocator
, org.xml.sax.Locator
setOriginatingNode
public void setOriginatingNode(Node n)
Set the node that is originating the SAX event.
- setOriginatingNode in interface NodeConsumer
n
- Reference to node that originated the current event.
setSystemId
public void setSystemId(String baseID)
Set the base ID (URL or system ID) for the stylesheet
created by this builder. This must be set in order to
resolve relative URLs in the stylesheet.
baseID
- Base URL for this stylesheet.
skippedEntity
public void skippedEntity(String name)
throws org.xml.sax.SAXException
Receive notification of a skipped entity.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions for each
processing instruction, such as setting status variables or
invoking other methods.
name
- The name of the skipped entity.
org.xml.sax.ContentHandler.processingInstruction
startDocument
public void startDocument()
throws org.xml.sax.SAXException
Receive notification of the beginning of the document.
org.xml.sax.ContentHandler.startDocument
startElement
public void startElement(String uri,
String localName,
String rawName,
Attributes attributes)
throws org.xml.sax.SAXException
Receive notification of the start of an element.
uri
- The Namespace URI, or an empty string.localName
- The local name (without prefix), or empty string if not namespace processing.rawName
- The qualified name (with prefix).attributes
- The specified or defaulted attributes.
startPrefixMapping
public void startPrefixMapping(String prefix,
String uri)
throws org.xml.sax.SAXException
Receive notification of the start of a Namespace mapping.
By default, do nothing. Application writers may override this
method in a subclass to take specific actions at the start of
each element (such as allocating a new tree node or writing
output to a file).
prefix
- The Namespace prefix being declared.uri
- The Namespace URI mapped to the prefix.
org.xml.sax.ContentHandler.startPrefixMapping
unparsedEntityDecl
public void unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Receive notification of an unparsed entity declaration.
name
- The entity name.publicId
- The entity public identifier, or null if not
available.systemId
- The entity system identifier.notationName
- The name of the associated notation.
org.xml.sax.DTDHandler.unparsedEntityDecl
warn
public void warn(String msg,
args[] )
throws org.xml.sax.SAXException
Warn the user of an problem.
msg
- An key into the XSLTErrorResources
table, that is one of the WG_ prefixed definitions.
warning
public void warning(org.xml.sax.SAXParseException e)
throws org.xml.sax.SAXException
Receive notification of a XSLT processing warning.
e
- The warning information encoded as an exception.