/*
* reserved comment block
* DO NOT REMOVE OR ALTER!
*/
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: TemplatesHandlerImpl.java,v 1.2.4.1 2005/09/06 12:09:03 pvedula Exp $
*/
/**
* Implementation of a JAXP1.1 TemplatesHandler
* @author Morten Jorgensen
* @author Santiago Pericas-Geertsen
*/
public class TemplatesHandlerImpl
{
/**
* System ID for this stylesheet.
*/
/**
* Number of spaces to add for output indentation.
*/
private int _indentNumber;
/**
* This URIResolver is passed to all Transformers.
*/
/**
* A reference to the transformer factory that this templates
* object belongs to.
*/
/**
* A reference to XSLTC's parser object.
*/
/**
* The created Templates object.
*/
/**
* Default constructor
*/
{
// Instantiate XSLTC and get reference to parser object
xsltc.setSecureProcessing(true);
xsltc.setTemplateInlining(true);
else
xsltc.setTemplateInlining(false);
}
/**
* Implements javax.xml.transform.sax.TemplatesHandler.getSystemId()
* Get the base ID (URI or system ID) from where relative URLs will be
* resolved.
* @return The systemID that was set with setSystemId(String id)
*/
return _systemId;
}
/**
* Implements javax.xml.transform.sax.TemplatesHandler.setSystemId()
* Get the base ID (URI or system ID) from where relative URLs will be
* resolved.
* @param id Base URI for this stylesheet
*/
}
/**
* Store URIResolver needed for Transformers.
*/
}
/**
* 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 The Templates object that was created during the SAX event
* process, or null if no Templates object has been created.
*/
return _templates;
}
/**
* This method implements XSLTC's SourceLoader interface. It is used to
* glue a TrAX URIResolver to the XSLTC compiler's Input and Import classes.
*
* @param href The URI of the document to load
* @param context The URI of the currently loaded document
* @param xsltc The compiler that resuests the document
* @return An InputSource with the loaded document
*/
try {
// A _uriResolver must be set if this method is called
}
}
catch (TransformerException e) {
// Falls through
}
return null;
}
// -- ContentHandler --------------------------------------------------
/**
* Re-initialize parser and forward SAX2 event.
*/
public void startDocument() {
}
/**
* Just forward SAX2 event to parser object.
*/
// create the templates
try {
// Set the translet class name if not already set
}
else {
}
// Get java-legal class name from XSLTC module
// Compile the translet - this is where the work is done!
// Create a Stylesheet element from the root node
if (xsltc.getTemplateInlining())
stylesheet.setTemplateInlining(true);
else
stylesheet.setTemplateInlining(false);
if (_uriResolver != null) {
stylesheet.setSourceLoader(this);
}
// Set it as top-level in the XSLTC object
// Create AST under the Stylesheet element
}
// Generate the bytecodes and output the translet class(es)
// Class synchronization is needed for BCEL
}
}
if (!_parser.errorsFound()) {
// Check that the transformation went well before returning
// Set URIResolver on templates object
if (_uriResolver != null) {
}
}
}
else {
for (int i = 0; i < count; i++) {
}
throw new SAXException(ErrorMsg.JAXP_COMPILE_ERR, new TransformerException(errorMessage.toString()));
}
}
catch (CompilerException e) {
}
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Just forward SAX2 event to parser object.
*/
{
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Just forward SAX2 event to parser object.
*/
}
/**
* Set internal system Id and forward SAX2 event to parser object.
*/
}
}