public class StylesheetHandler extends org.xml.sax.helpers.DefaultHandler implements TemplatesHandler, PrefixResolver, NodeConsumer
| Modifier and Type | Field and Description |
|---|---|
static int |
STYPE_IMPORT
If getStylesheetType returns this value, the current stylesheet
is an imported stylesheet.
|
static int |
STYPE_INCLUDE
If getStylesheetType returns this value, the current stylesheet
is an included stylesheet.
|
static int |
STYPE_ROOT
If getStylesheetType returns this value, the current stylesheet
is a root stylesheet.
|
| Constructor and Description |
|---|
StylesheetHandler(TransformerFactoryImpl processor)
Create a StylesheetHandler object, creating a root stylesheet
as the target.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] ch,
int start,
int length)
Receive notification of character data inside an element.
|
XPath |
createXPath(String str,
ElemTemplateElement owningTemplate)
Process an expression string into an XPath.
|
void |
endDocument()
Receive notification of the end of the document.
|
void |
endElement(String uri,
String localName,
String rawName)
Receive notification of the end of an element.
|
void |
endPrefixMapping(String prefix)
Receive notification of the end of a Namespace mapping.
|
void |
error(SAXParseException e)
Receive notification of a recoverable XSLT processing error.
|
protected void |
error(String msg,
Exception e)
Tell the user of an error, and probably throw an
exception.
|
protected void |
error(String msg,
Object[] args,
Exception e)
Tell the user of an error, and probably throw an
exception.
|
void |
fatalError(SAXParseException e)
Report a fatal XSLT processing error.
|
String |
getBaseIdentifier()
Return the base identifier.
|
boolean |
getIncremental() |
SAXSourceLocator |
getLocator()
Get the current stylesheet Locator object.
|
String |
getNamespaceForPrefix(String prefix)
Given a namespace, get the corrisponding prefix from the current
namespace support context.
|
String |
getNamespaceForPrefix(String prefix,
Node context)
Given a namespace, get the corrisponding prefix.
|
boolean |
getOptimize() |
Node |
getOriginatingNode()
Set the node that is originating the SAX event.
|
XSLTSchema |
getSchema()
Get the root of the XSLT Schema, which tells us how to
transition content handlers, create elements, etc.
|
boolean |
getSource_location() |
TransformerFactoryImpl |
getStylesheetProcessor()
Get the XSLT TransformerFactoryImpl for needed services.
|
StylesheetRoot |
getStylesheetRoot()
Return the stylesheet root that this handler is constructing.
|
String |
getSystemId()
Get the base ID (URI or system ID) from where relative
URLs will be resolved.
|
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.
|
boolean |
handlesNullPrefixes() |
void |
ignorableWhitespace(char[] ch,
int start,
int length)
Receive notification of ignorable whitespace in element content.
|
boolean |
isStylesheetParsingComplete()
Test whether the _last_ endDocument() has been processed.
|
void |
notationDecl(String name,
String publicId,
String systemId)
Receive notification of a notation declaration.
|
void |
processingInstruction(String target,
String data)
Receive notification of a processing instruction.
|
void |
pushStylesheet(Stylesheet s)
Push the current stylesheet being constructed.
|
InputSource |
resolveEntity(String publicId,
String systemId)
Resolve an external entity.
|
void |
setDocumentLocator(Locator locator)
Receive a Locator object for document events.
|
void |
setOriginatingNode(Node n)
Set the node that is originating the SAX event.
|
void |
setSystemId(String baseID)
Set the base ID (URL or system ID) for the stylesheet
created by this builder.
|
void |
skippedEntity(String name)
Receive notification of a skipped entity.
|
void |
startDocument()
Receive notification of the beginning of the document.
|
void |
startElement(String uri,
String localName,
String rawName,
Attributes attributes)
Receive notification of the start of an element.
|
void |
startPrefixMapping(String prefix,
String uri)
Receive notification of the start of a Namespace mapping.
|
void |
unparsedEntityDecl(String name,
String publicId,
String systemId,
String notationName)
Receive notification of an unparsed entity declaration.
|
void |
warn(String msg,
Object[] args)
Warn the user of an problem.
|
void |
warning(SAXParseException e)
Receive notification of a XSLT processing warning.
|
public static final int STYPE_ROOT
public static final int STYPE_INCLUDE
public static final int STYPE_IMPORT
public StylesheetHandler(TransformerFactoryImpl processor) throws TransformerConfigurationException
processor - non-null reference to the transformer factory that owns this handler.TransformerConfigurationException - if a StylesheetRoot
can not be constructed for some reason.public XPath createXPath(String str, ElemTemplateElement owningTemplate) throws TransformerException
str - A non-null reference to a valid or invalid XPath expression string.TransformerException - if the expression can not be processed.public String getNamespaceForPrefix(String prefix)
getNamespaceForPrefix in interface PrefixResolverprefix - The prefix to look up, which may be an empty string ("") for the default Namespace.public String getNamespaceForPrefix(String prefix, Node context)
PrefixResolver interface,
and will throw an error if invoked on this object.getNamespaceForPrefix in interface PrefixResolverprefix - 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.public Templates getTemplates()
getTemplates in interface TemplatesHandlerpublic void setSystemId(String baseID)
setSystemId in interface TemplatesHandlerbaseID - Base URL for this stylesheet.public String getSystemId()
getSystemId in interface TemplatesHandlersetSystemId(java.lang.String).public InputSource resolveEntity(String publicId, String systemId) throws SAXException
resolveEntity in interface EntityResolverresolveEntity in class org.xml.sax.helpers.DefaultHandlerpublicId - The public identifer, or null if none is
available.systemId - The system identifier provided in the XML
document.SAXException - if the entity can not be resolved.public void notationDecl(String name, String publicId, String systemId)
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.
notationDecl in interface DTDHandlernotationDecl in class org.xml.sax.helpers.DefaultHandlername - The notation name.publicId - The notation public identifier, or null if not
available.systemId - The notation system identifier.DTDHandler.notationDecl(java.lang.String, java.lang.String, java.lang.String)public void unparsedEntityDecl(String name, String publicId, String systemId, String notationName)
unparsedEntityDecl in interface DTDHandlerunparsedEntityDecl in class org.xml.sax.helpers.DefaultHandlername - 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.DTDHandler.unparsedEntityDecl(java.lang.String, java.lang.String, java.lang.String, java.lang.String)public void setDocumentLocator(Locator locator)
setDocumentLocator in interface ContentHandlersetDocumentLocator in class org.xml.sax.helpers.DefaultHandlerlocator - A locator for all SAX document events.ContentHandler.setDocumentLocator(org.xml.sax.Locator),
Locatorpublic void startDocument()
throws SAXException
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerSAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.startDocument()public boolean isStylesheetParsingComplete()
public void endDocument()
throws SAXException
endDocument in interface ContentHandlerendDocument in class org.xml.sax.helpers.DefaultHandlerSAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.endDocument()public void startPrefixMapping(String prefix, String uri) throws SAXException
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).
startPrefixMapping in interface ContentHandlerstartPrefixMapping in class org.xml.sax.helpers.DefaultHandlerprefix - The Namespace prefix being declared.uri - The Namespace URI mapped to the prefix.SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.startPrefixMapping(java.lang.String, java.lang.String)public void endPrefixMapping(String prefix) throws SAXException
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).
endPrefixMapping in interface ContentHandlerendPrefixMapping in class org.xml.sax.helpers.DefaultHandlerprefix - The Namespace prefix being declared.SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.endPrefixMapping(java.lang.String)public void startElement(String uri, String localName, String rawName, Attributes attributes) throws SAXException
startElement in interface ContentHandlerstartElement in class org.xml.sax.helpers.DefaultHandleruri - 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.SAXExceptionpublic void endElement(String uri, String localName, String rawName) throws SAXException
endElement in interface ContentHandlerendElement in class org.xml.sax.helpers.DefaultHandleruri - 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).SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.endElement(java.lang.String, java.lang.String, java.lang.String)public void characters(char[] ch,
int start,
int length)
throws SAXException
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlerch - The characters.start - The start position in the character array.length - The number of characters to use from the
character array.SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.characters(char[], int, int)public void ignorableWhitespace(char[] ch,
int start,
int length)
throws SAXException
ignorableWhitespace in interface ContentHandlerignorableWhitespace in class org.xml.sax.helpers.DefaultHandlerch - The whitespace characters.start - The start position in the character array.length - The number of characters to use from the
character array.SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.ignorableWhitespace(char[], int, int)public void processingInstruction(String target, String data) throws SAXException
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.
processingInstruction in interface ContentHandlerprocessingInstruction in class org.xml.sax.helpers.DefaultHandlertarget - The processing instruction target.data - The processing instruction data, or null if
none is supplied.SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)public void skippedEntity(String name) throws SAXException
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.
skippedEntity in interface ContentHandlerskippedEntity in class org.xml.sax.helpers.DefaultHandlername - The name of the skipped entity.SAXException - Any SAX exception, possibly
wrapping another exception.ContentHandler.processingInstruction(java.lang.String, java.lang.String)public void warn(String msg, Object[] args) throws SAXException
msg - An key into the XSLTErrorResources
table, that is one of the WG_ prefixed definitions.args - An array of arguments for the given warning.SAXException - that wraps a
TransformerException if the current
ErrorListener.warning(javax.xml.transform.TransformerException)
method chooses to flag this condition as an error.protected void error(String msg, Exception e) throws SAXException
msg - An error message.e - An error which the SAXException should wrap.SAXException - that wraps a
TransformerException if the current
ErrorListener.error(javax.xml.transform.TransformerException)
method chooses to flag this condition as an error.protected void error(String msg, Object[] args, Exception e) throws SAXException
msg - A key into the XSLTErrorResources
table, that is one of the WG_ prefixed definitions.args - An array of arguments for the given warning.e - An error which the SAXException should wrap.SAXException - that wraps a
TransformerException if the current
ErrorListener.error(javax.xml.transform.TransformerException)
method chooses to flag this condition as an error.public void warning(SAXParseException e) throws SAXException
warning in interface ErrorHandlerwarning in class org.xml.sax.helpers.DefaultHandlere - The warning information encoded as an exception.SAXException - that wraps a
TransformerException if the current
ErrorListener.warning(javax.xml.transform.TransformerException)
method chooses to flag this condition as an error.public void error(SAXParseException e) throws SAXException
error in interface ErrorHandlererror in class org.xml.sax.helpers.DefaultHandlere - The error information encoded as an exception.SAXException - that wraps a
TransformerException if the current
ErrorListener.error(javax.xml.transform.TransformerException)
method chooses to flag this condition as an error.public void fatalError(SAXParseException e) throws SAXException
fatalError in interface ErrorHandlerfatalError in class org.xml.sax.helpers.DefaultHandlere - The error information encoded as an exception.SAXException - that wraps a
TransformerException if the current
ErrorListener.fatalError(javax.xml.transform.TransformerException)
method chooses to flag this condition as an error.public TransformerFactoryImpl getStylesheetProcessor()
public StylesheetRoot getStylesheetRoot()
public void pushStylesheet(Stylesheet s)
s - non-null reference to a stylesheet.public XSLTSchema getSchema()
public String getBaseIdentifier()
getBaseIdentifier in interface PrefixResolverpublic SAXSourceLocator getLocator()
public void setOriginatingNode(Node n)
setOriginatingNode in interface NodeConsumern - Reference to node that originated the current event.NodeConsumerpublic Node getOriginatingNode()
NodeConsumerpublic boolean handlesNullPrefixes()
handlesNullPrefixes in interface PrefixResolverPrefixResolver.handlesNullPrefixes()public boolean getOptimize()
public boolean getIncremental()
public boolean getSource_location()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.