Methods Summary |
---|
public void | characters(char[] ch, int start, int length)Just forward SAX2 event to parser object.
_parser.characters(ch, start, length);
|
public void | endDocument()Just forward SAX2 event to parser object.
_parser.endDocument();
// create the templates
try {
XSLTC xsltc = _parser.getXSLTC();
// Set the translet class name if not already set
String transletName = null;
if (_systemId != null) {
transletName = Util.baseName(_systemId);
}
else {
transletName = (String)_tfactory.getAttribute("translet-name");
}
xsltc.setClassName(transletName);
// Get java-legal class name from XSLTC module
transletName = xsltc.getClassName();
Stylesheet stylesheet = null;
SyntaxTreeNode root = _parser.getDocumentRoot();
// Compile the translet - this is where the work is done!
if (!_parser.errorsFound() && root != null) {
// Create a Stylesheet element from the root node
stylesheet = _parser.makeStylesheet(root);
stylesheet.setSystemId(_systemId);
stylesheet.setParentStylesheet(null);
// Set a document loader (for xsl:include/import) if defined
if (_uriResolver != null) {
stylesheet.setSourceLoader(this);
}
_parser.setCurrentStylesheet(stylesheet);
// Set it as top-level in the XSLTC object
xsltc.setStylesheet(stylesheet);
// Create AST under the Stylesheet element
_parser.createAST(stylesheet);
}
// Generate the bytecodes and output the translet class(es)
if (!_parser.errorsFound() && stylesheet != null) {
stylesheet.setMultiDocument(xsltc.isMultiDocument());
stylesheet.setHasIdCall(xsltc.hasIdCall());
// Class synchronization is needed for BCEL
synchronized (xsltc.getClass()) {
stylesheet.translate();
}
}
if (!_parser.errorsFound()) {
// Check that the transformation went well before returning
final byte[][] bytecodes = xsltc.getBytecodes();
if (bytecodes != null) {
_templates =
new TemplatesImpl(xsltc.getBytecodes(), transletName,
_parser.getOutputProperties(), _indentNumber, _tfactory);
// Set URIResolver on templates object
if (_uriResolver != null) {
_templates.setURIResolver(_uriResolver);
}
}
}
else {
StringBuffer errorMessage = new StringBuffer();
Vector errors = _parser.getErrors();
final int count = errors.size();
for (int i = 0; i < count; i++) {
if (errorMessage.length() > 0)
errorMessage.append('\n");
errorMessage.append(errors.elementAt(i).toString());
}
throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, new TransformerException(errorMessage.toString()));
}
}
catch (CompilerException e) {
throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, e);
}
|
public void | endElement(java.lang.String uri, java.lang.String localname, java.lang.String qname)Just forward SAX2 event to parser object.
_parser.endElement(uri, localname, qname);
|
public void | endPrefixMapping(java.lang.String prefix)Just forward SAX2 event to parser object.
_parser.endPrefixMapping(prefix);
|
public java.lang.String | getSystemId()Implements javax.xml.transform.sax.TemplatesHandler.getSystemId()
Get the base ID (URI or system ID) from where relative URLs will be
resolved.
return _systemId;
|
public javax.xml.transform.Templates | getTemplates()Implements javax.xml.transform.sax.TemplatesHandler.getTemplates()
When a TemplatesHandler object is used as a ContentHandler or
DocumentHandler for the parsing of transformation instructions, it
creates a Templates object, which the caller can get once the SAX
events have been completed.
return _templates;
|
public void | ignorableWhitespace(char[] ch, int start, int length)Just forward SAX2 event to parser object.
_parser.ignorableWhitespace(ch, start, length);
|
public org.xml.sax.InputSource | loadSource(java.lang.String href, java.lang.String context, com.sun.org.apache.xalan.internal.xsltc.compiler.XSLTC xsltc)This method implements XSLTC's SourceLoader interface. It is used to
glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
try {
// A _uriResolver must be set if this method is called
final Source source = _uriResolver.resolve(href, context);
if (source != null) {
return Util.getInputSource(xsltc, source);
}
}
catch (TransformerException e) {
// Falls through
}
return null;
|
public void | processingInstruction(java.lang.String name, java.lang.String value)Just forward SAX2 event to parser object.
_parser.processingInstruction(name, value);
|
public void | setDocumentLocator(org.xml.sax.Locator locator)Set internal system Id and forward SAX2 event to parser object.
setSystemId(locator.getSystemId());
_parser.setDocumentLocator(locator);
|
public void | setSystemId(java.lang.String id)Implements javax.xml.transform.sax.TemplatesHandler.setSystemId()
Get the base ID (URI or system ID) from where relative URLs will be
resolved.
_systemId = id;
|
public void | setURIResolver(javax.xml.transform.URIResolver resolver)Store URIResolver needed for Transformers.
_uriResolver = resolver;
|
public void | skippedEntity(java.lang.String name)Just forward SAX2 event to parser object.
_parser.skippedEntity(name);
|
public void | startDocument()Re-initialize parser and forward SAX2 event.
XSLTC xsltc = _parser.getXSLTC();
xsltc.init(); // calls _parser.init()
xsltc.setOutputType(XSLTC.BYTEARRAY_OUTPUT);
_parser.startDocument();
|
public void | startElement(java.lang.String uri, java.lang.String localname, java.lang.String qname, org.xml.sax.Attributes attributes)Just forward SAX2 event to parser object.
_parser.startElement(uri, localname, qname, attributes);
|
public void | startPrefixMapping(java.lang.String prefix, java.lang.String uri)Just forward SAX2 event to parser object.
_parser.startPrefixMapping(prefix, uri);
|