bug244197 - All errors seem to be reported, there does seem to be keys and select statements that reference the, false errors are being report here.
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/XalanValidator.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/XalanValidator.java
index 24547e3..6d804d1 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/XalanValidator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/eclipse/XalanValidator.java
@@ -35,6 +35,7 @@
public ValidationReport validate(String uri, InputStream inputstream, NestedValidatorContext context) {
ValidationReport valreport = null;
try {
+ uri = org.eclipse.wst.common.uriresolver.internal.util.URIEncoder.encode(uri);
IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocationURI(new URI(uri));
if (files.length > 0) {
IFile xslFile = files[0];
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidationReport.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidationReport.java
index e65e263..435d166 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidationReport.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidationReport.java
@@ -108,6 +108,7 @@
public void fatalError(TransformerException exception)
throws TransformerException {
+ exception.printStackTrace();
addMessage(exception, ValidationMessage.SEV_HIGH);
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java
index 947784e..70e2161 100644
--- a/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java
+++ b/bundles/org.eclipse.wst.xsl.core/src/org/eclipse/wst/xsl/core/internal/validation/xalan/XSLValidator.java
@@ -19,6 +19,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.uriresolver.internal.URI;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
import org.eclipse.wst.xml.core.internal.validation.core.ValidationReport;
import org.eclipse.wst.xsl.core.internal.XSLCorePlugin;
import org.xml.sax.InputSource;
@@ -38,6 +40,7 @@
private static final byte[] XPATH_LOCK = new byte[0];
private XSLValidator() {
+
}
/**
@@ -49,6 +52,9 @@
* @throws CoreException
*/
public ValidationReport validate(String uri, IFile xslFile) throws CoreException {
+ // The string that is passed in for the URI needs to be encoded to be a valid
+ // URI otherwise on those systems where spaces are significant it can't find
+ // files that have spaces in the file name.
ErrorListener errorListener = new XSLValidationReport();
synchronized (XPATH_LOCK) {
@@ -60,13 +66,6 @@
{
// If so, we can safely cast.
SAXTransformerFactory saxfactory = ((SAXTransformerFactory) transformer);
-// // Create factory for SAX parser
-// SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
-// saxParserFactory.setNamespaceAware(true);
-//
-// // Get a SAX parser
-// XMLReader xmlparser = saxParserFactory.newSAXParser().getXMLReader();
-// xmlparser.setErrorHandler(new DefaultErrorHandler());
Templates compiled = saxfactory.newTemplates(new SAXSource(new InputSource(uri)));
}
} catch (Exception ex) {
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/Messages.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/Messages.java
index da3de42..80a2869 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/Messages.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/Messages.java
@@ -1,9 +1,6 @@
package org.eclipse.wst.xsl.core.compiler.xslt10.res;
import java.util.ListResourceBundle;
-import java.util.ResourceBundle;
-
-import org.apache.xpath.res.XPATHErrorResources;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
@@ -440,15 +437,15 @@
* @return The formatted message string.
*/
public static final String createMessage(String msgKey, Object args[]) // throws
- // Exception
+ // Exception
{
String fmsg = null;
boolean throwex = false;
-
+
ListResourceBundle resource = new XSLTErrorResources();
-
- String msg = resource.getString(msgKey);
+
+ String msg = resource.getString(msgKey);
if (args != null) {
try {
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/XSLTErrorResources.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/XSLTErrorResources.java
index 93c0ca5..8ec9069 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/XSLTErrorResources.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/compiler/xslt10/res/XSLTErrorResources.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
/*
- * $Id: XSLTErrorResources.java,v 1.1 2008/03/27 22:45:11 dacarver Exp $
+ * $Id: XSLTErrorResources.java,v 1.2 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.compiler.xslt10.res;
@@ -24,1486 +24,1405 @@
import java.util.ResourceBundle;
/**
- * Set up error messages.
- * We build a two dimensional array of message keys and
- * message strings. In order to add a new message here,
- * you need to first add a String constant. And
- * you need to enter key , value pair as part of contents
- * Array. You also need to update MAX_CODE for error strings
- * and MAX_WARNING for warnings ( Needed for only information
- * purpose )
+ * Set up error messages. We build a two dimensional array of message keys and
+ * message strings. In order to add a new message here, you need to first add a
+ * String constant. And you need to enter key , value pair as part of contents
+ * Array. You also need to update MAX_CODE for error strings and MAX_WARNING for
+ * warnings ( Needed for only information purpose )
*/
-public class XSLTErrorResources extends ListResourceBundle
-{
+public class XSLTErrorResources extends ListResourceBundle {
-/*
- * This file contains error and warning messages related to Xalan Error
- * Handling.
- *
- * General notes to translators:
- *
- * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of
- * components.
- * XSLT is an acronym for "XML Stylesheet Language: Transformations".
- * XSLTC is an acronym for XSLT Compiler.
- *
- * 2) A stylesheet is a description of how to transform an input XML document
- * into a resultant XML document (or HTML document or text). The
- * stylesheet itself is described in the form of an XML document.
- *
- * 3) A template is a component of a stylesheet that is used to match a
- * particular portion of an input document and specifies the form of the
- * corresponding portion of the output document.
- *
- * 4) An element is a mark-up tag in an XML document; an attribute is a
- * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
- * "elem" is an element name, "attr" and "attr2" are attribute names with
- * the values "val" and "val2", respectively.
- *
- * 5) A namespace declaration is a special attribute that is used to associate
- * a prefix with a URI (the namespace). The meanings of element names and
- * attribute names that use that prefix are defined with respect to that
- * namespace.
- *
- * 6) "Translet" is an invented term that describes the class file that
- * results from compiling an XML stylesheet into a Java class.
- *
- * 7) XPath is a specification that describes a notation for identifying
- * nodes in a tree-structured representation of an XML document. An
- * instance of that notation is referred to as an XPath expression.
- *
- */
+ /*
+ * This file contains error and warning messages related to Xalan Error
+ * Handling.
+ *
+ * General notes to translators:
+ *
+ * 1) Xalan (or more properly, Xalan-interpretive) and XSLTC are names of
+ * components. XSLT is an acronym for "XML Stylesheet Language:
+ * Transformations". XSLTC is an acronym for XSLT Compiler.
+ *
+ * 2) A stylesheet is a description of how to transform an input XML
+ * document into a resultant XML document (or HTML document or text). The
+ * stylesheet itself is described in the form of an XML document.
+ *
+ * 3) A template is a component of a stylesheet that is used to match a
+ * particular portion of an input document and specifies the form of the
+ * corresponding portion of the output document.
+ *
+ * 4) An element is a mark-up tag in an XML document; an attribute is a
+ * modifier on the tag. For example, in <elem attr='val' attr2='val2'>
+ * "elem" is an element name, "attr" and "attr2" are attribute names with
+ * the values "val" and "val2", respectively.
+ *
+ * 5) A namespace declaration is a special attribute that is used to
+ * associate a prefix with a URI (the namespace). The meanings of element
+ * names and attribute names that use that prefix are defined with respect
+ * to that namespace.
+ *
+ * 6) "Translet" is an invented term that describes the class file that
+ * results from compiling an XML stylesheet into a Java class.
+ *
+ * 7) XPath is a specification that describes a notation for identifying
+ * nodes in a tree-structured representation of an XML document. An instance
+ * of that notation is referred to as an XPath expression.
+ *
+ */
- /*
- * Static variables
- */
- public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX =
- "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX";
-
- public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT =
- "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT";
-
- public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE";
- public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED";
- public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE";
- public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS";
- public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD";
- public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES="ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES";
- public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB";
- public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND";
- public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT";
- public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB";
- public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB";
- public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB =
- "ER_BAD_VAL_ON_LEVEL_ATTRIB";
- public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML =
- "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML";
- public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME =
- "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME";
- public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB";
- public static final String ER_NEED_NAME_OR_MATCH_ATTRIB =
- "ER_NEED_NAME_OR_MATCH_ATTRIB";
- public static final String ER_CANT_RESOLVE_NSPREFIX =
- "ER_CANT_RESOLVE_NSPREFIX";
- public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE";
- public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC";
- public static final String ER_ELEMTEMPLATEELEM_ERR ="ER_ELEMTEMPLATEELEM_ERR";
- public static final String ER_NULL_CHILD = "ER_NULL_CHILD";
- public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB";
- public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB";
- public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB";
- public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC";
- public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON =
- "ER_COULD_NOT_CREATE_XML_PROC_LIAISON";
- public static final String ER_PROCESS_NOT_SUCCESSFUL =
- "ER_PROCESS_NOT_SUCCESSFUL";
- public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL";
- public static final String ER_ENCODING_NOT_SUPPORTED =
- "ER_ENCODING_NOT_SUPPORTED";
- public static final String ER_COULD_NOT_CREATE_TRACELISTENER =
- "ER_COULD_NOT_CREATE_TRACELISTENER";
- public static final String ER_KEY_REQUIRES_NAME_ATTRIB =
- "ER_KEY_REQUIRES_NAME_ATTRIB";
- public static final String ER_KEY_REQUIRES_MATCH_ATTRIB =
- "ER_KEY_REQUIRES_MATCH_ATTRIB";
- public static final String ER_KEY_REQUIRES_USE_ATTRIB =
- "ER_KEY_REQUIRES_USE_ATTRIB";
- public static final String ER_REQUIRES_ELEMENTS_ATTRIB =
- "ER_REQUIRES_ELEMENTS_ATTRIB";
- public static final String ER_MISSING_PREFIX_ATTRIB =
- "ER_MISSING_PREFIX_ATTRIB";
- public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL";
- public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND";
- public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION";
- public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB";
- public static final String ER_STYLESHEET_INCLUDES_ITSELF =
- "ER_STYLESHEET_INCLUDES_ITSELF";
- public static final String ER_PROCESSINCLUDE_ERROR ="ER_PROCESSINCLUDE_ERROR";
- public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB";
- public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT =
- "ER_MISSING_CONTAINER_ELEMENT_COMPONENT";
- public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT =
- "ER_CAN_ONLY_OUTPUT_TO_ELEMENT";
- public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR";
- public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR";
- public static final String ER_NO_SELECT_EXPRESSION ="ER_NO_SELECT_EXPRESSION";
- public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR =
- "ER_CANNOT_SERIALIZE_XSLPROCESSOR";
- public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET";
- public static final String ER_FAILED_PROCESS_STYLESHEET =
- "ER_FAILED_PROCESS_STYLESHEET";
- public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC";
- public static final String ER_COULDNT_FIND_FRAGMENT =
- "ER_COULDNT_FIND_FRAGMENT";
- public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT";
- public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB =
- "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB";
- public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB =
- "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB";
- public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG =
- "ER_NO_CLONE_OF_DOCUMENT_FRAG";
- public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM";
- public static final String ER_XMLSPACE_ILLEGAL_VALUE =
- "ER_XMLSPACE_ILLEGAL_VALUE";
- public static final String ER_NO_XSLKEY_DECLARATION =
- "ER_NO_XSLKEY_DECLARATION";
- public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL";
- public static final String ER_XSLFUNCTIONS_UNSUPPORTED =
- "ER_XSLFUNCTIONS_UNSUPPORTED";
- public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR";
- public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET =
- "ER_NOT_ALLOWED_INSIDE_STYLESHEET";
- public static final String ER_RESULTNS_NOT_SUPPORTED =
- "ER_RESULTNS_NOT_SUPPORTED";
- public static final String ER_DEFAULTSPACE_NOT_SUPPORTED =
- "ER_DEFAULTSPACE_NOT_SUPPORTED";
- public static final String ER_INDENTRESULT_NOT_SUPPORTED =
- "ER_INDENTRESULT_NOT_SUPPORTED";
- public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB";
- public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM";
- public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE";
- public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN";
- public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE =
- "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE";
- public static final String ER_MISPLACED_XSLOTHERWISE =
- "ER_MISPLACED_XSLOTHERWISE";
- public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE =
- "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE";
- public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE =
- "ER_NOT_ALLOWED_INSIDE_TEMPLATE";
- public static final String ER_UNKNOWN_EXT_NS_PREFIX =
- "ER_UNKNOWN_EXT_NS_PREFIX";
- public static final String ER_IMPORTS_AS_FIRST_ELEM =
- "ER_IMPORTS_AS_FIRST_ELEM";
- public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF";
- public static final String ER_XMLSPACE_ILLEGAL_VAL ="ER_XMLSPACE_ILLEGAL_VAL";
- public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL =
- "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL";
- public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION";
- public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR";
- public static final String ER_CURRENCY_SIGN_ILLEGAL=
- "ER_CURRENCY_SIGN_ILLEGAL";
- public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM =
- "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM";
- public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER =
- "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER";
- public static final String ER_REDIRECT_COULDNT_GET_FILENAME =
- "ER_REDIRECT_COULDNT_GET_FILENAME";
- public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT =
- "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT";
- public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX =
- "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX";
- public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI";
- public static final String ER_MISSING_ARG_FOR_OPTION =
- "ER_MISSING_ARG_FOR_OPTION";
- public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION";
- public static final String ER_MALFORMED_FORMAT_STRING =
- "ER_MALFORMED_FORMAT_STRING";
- public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB =
- "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB";
- public static final String ER_ILLEGAL_ATTRIBUTE_VALUE =
- "ER_ILLEGAL_ATTRIBUTE_VALUE";
- public static final String ER_CHOOSE_REQUIRES_WHEN ="ER_CHOOSE_REQUIRES_WHEN";
- public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH =
- "ER_NO_APPLY_IMPORT_IN_FOR_EACH";
- public static final String ER_CANT_USE_DTM_FOR_OUTPUT =
- "ER_CANT_USE_DTM_FOR_OUTPUT";
- public static final String ER_CANT_USE_DTM_FOR_INPUT =
- "ER_CANT_USE_DTM_FOR_INPUT";
- public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED";
- public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE";
- public static final String ER_INVALID_UTF16_SURROGATE =
- "ER_INVALID_UTF16_SURROGATE";
- public static final String ER_XSLATTRSET_USED_ITSELF =
- "ER_XSLATTRSET_USED_ITSELF";
- public static final String ER_CANNOT_MIX_XERCESDOM ="ER_CANNOT_MIX_XERCESDOM";
- public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS";
- public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT =
- "ER_IN_ELEMTEMPLATEELEM_READOBJECT";
- public static final String ER_DUPLICATE_NAMED_TEMPLATE =
- "ER_DUPLICATE_NAMED_TEMPLATE";
- public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL";
- public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF";
- public static final String ER_ILLEGAL_DOMSOURCE_INPUT =
- "ER_ILLEGAL_DOMSOURCE_INPUT";
- public static final String ER_CLASS_NOT_FOUND_FOR_OPTION =
- "ER_CLASS_NOT_FOUND_FOR_OPTION";
- public static final String ER_REQUIRED_ELEM_NOT_FOUND =
- "ER_REQUIRED_ELEM_NOT_FOUND";
- public static final String ER_INPUT_CANNOT_BE_NULL ="ER_INPUT_CANNOT_BE_NULL";
- public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL";
- public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL";
- public static final String ER_SOURCE_CANNOT_BE_NULL =
- "ER_SOURCE_CANNOT_BE_NULL";
- public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR";
- public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN";
- public static final String ER_CANNOT_CREATE_EXTENSN =
- "ER_CANNOT_CREATE_EXTENSN";
- public static final String ER_INSTANCE_MTHD_CALL_REQUIRES =
- "ER_INSTANCE_MTHD_CALL_REQUIRES";
- public static final String ER_INVALID_ELEMENT_NAME ="ER_INVALID_ELEMENT_NAME";
- public static final String ER_ELEMENT_NAME_METHOD_STATIC =
- "ER_ELEMENT_NAME_METHOD_STATIC";
- public static final String ER_EXTENSION_FUNC_UNKNOWN =
- "ER_EXTENSION_FUNC_UNKNOWN";
- public static final String ER_MORE_MATCH_CONSTRUCTOR =
- "ER_MORE_MATCH_CONSTRUCTOR";
- public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD";
- public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT";
- public static final String ER_INVALID_CONTEXT_PASSED =
- "ER_INVALID_CONTEXT_PASSED";
- public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS";
- public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME";
- public static final String ER_NO_URL = "ER_NO_URL";
- public static final String ER_POOL_SIZE_LESSTHAN_ONE =
- "ER_POOL_SIZE_LESSTHAN_ONE";
- public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER";
- public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT";
- public static final String ER_ILLEGAL_XMLSPACE_VALUE =
- "ER_ILLEGAL_XMLSPACE_VALUE";
- public static final String ER_PROCESSFROMNODE_FAILED =
- "ER_PROCESSFROMNODE_FAILED";
- public static final String ER_RESOURCE_COULD_NOT_LOAD =
- "ER_RESOURCE_COULD_NOT_LOAD";
- public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO =
- "ER_BUFFER_SIZE_LESSTHAN_ZERO";
- public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION =
- "ER_UNKNOWN_ERROR_CALLING_EXTENSION";
- public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL";
- public static final String ER_ELEM_CONTENT_NOT_ALLOWED =
- "ER_ELEM_CONTENT_NOT_ALLOWED";
- public static final String ER_STYLESHEET_DIRECTED_TERMINATION =
- "ER_STYLESHEET_DIRECTED_TERMINATION";
- public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO";
- public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE";
- public static final String ER_COULD_NOT_LOAD_RESOURCE =
- "ER_COULD_NOT_LOAD_RESOURCE";
- public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES =
- "ER_CANNOT_INIT_DEFAULT_TEMPLATES";
- public static final String ER_RESULT_NULL = "ER_RESULT_NULL";
- public static final String ER_RESULT_COULD_NOT_BE_SET =
- "ER_RESULT_COULD_NOT_BE_SET";
- public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED";
- public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE =
- "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE";
- public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE =
- "ER_CANNOT_TRANSFORM_SOURCE_TYPE";
- public static final String ER_NULL_CONTENT_HANDLER ="ER_NULL_CONTENT_HANDLER";
- public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER";
- public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE";
- public static final String ER_NO_PARENT_FOR_FILTER ="ER_NO_PARENT_FOR_FILTER";
- public static final String ER_NO_STYLESHEET_IN_MEDIA =
- "ER_NO_STYLESHEET_IN_MEDIA";
- public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI";
- public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED";
- public static final String ER_PROPERTY_VALUE_BOOLEAN =
- "ER_PROPERTY_VALUE_BOOLEAN";
- public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT =
- "ER_COULD_NOT_FIND_EXTERN_SCRIPT";
- public static final String ER_RESOURCE_COULD_NOT_FIND =
- "ER_RESOURCE_COULD_NOT_FIND";
- public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED =
- "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED";
- public static final String ER_FAILED_CREATING_ELEMLITRSLT =
- "ER_FAILED_CREATING_ELEMLITRSLT";
- public static final String ER_VALUE_SHOULD_BE_NUMBER =
- "ER_VALUE_SHOULD_BE_NUMBER";
- public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL";
- public static final String ER_FAILED_CALLING_METHOD =
- "ER_FAILED_CALLING_METHOD";
- public static final String ER_FAILED_CREATING_ELEMTMPL =
- "ER_FAILED_CREATING_ELEMTMPL";
- public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED";
- public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED";
- public static final String ER_BAD_VALUE = "ER_BAD_VALUE";
- public static final String ER_ATTRIB_VALUE_NOT_FOUND =
- "ER_ATTRIB_VALUE_NOT_FOUND";
- public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED =
- "ER_ATTRIB_VALUE_NOT_RECOGNIZED";
- public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE";
- public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG";
- public static final String ER_CANNOT_FIND_SAX1_DRIVER =
- "ER_CANNOT_FIND_SAX1_DRIVER";
- public static final String ER_SAX1_DRIVER_NOT_LOADED =
- "ER_SAX1_DRIVER_NOT_LOADED";
- public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED =
- "ER_SAX1_DRIVER_NOT_INSTANTIATED" ;
- public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER =
- "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER";
- public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED =
- "ER_PARSER_PROPERTY_NOT_SPECIFIED";
- public static final String ER_PARSER_ARG_CANNOT_BE_NULL =
- "ER_PARSER_ARG_CANNOT_BE_NULL" ;
- public static final String ER_FEATURE = "ER_FEATURE";
- public static final String ER_PROPERTY = "ER_PROPERTY" ;
- public static final String ER_NULL_ENTITY_RESOLVER ="ER_NULL_ENTITY_RESOLVER";
- public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER" ;
- public static final String ER_NO_DRIVER_NAME_SPECIFIED =
- "ER_NO_DRIVER_NAME_SPECIFIED";
- public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED";
- public static final String ER_POOLSIZE_LESS_THAN_ONE =
- "ER_POOLSIZE_LESS_THAN_ONE";
- public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME";
- public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER";
- public static final String ER_ASSERT_NO_TEMPLATE_PARENT =
- "ER_ASSERT_NO_TEMPLATE_PARENT";
- public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR =
- "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR";
- public static final String ER_NOT_ALLOWED_IN_POSITION =
- "ER_NOT_ALLOWED_IN_POSITION";
- public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION =
- "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION";
- public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE =
- "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE";
- public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX =
- "ER_NAMESPACE_CONTEXT_NULL_PREFIX";
- public static final String ER_XPATH_RESOLVER_NULL_QNAME =
- "ER_XPATH_RESOLVER_NULL_QNAME";
- public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY =
- "ER_XPATH_RESOLVER_NEGATIVE_ARITY";
- public static final String INVALID_TCHAR = "INVALID_TCHAR";
- public static final String INVALID_QNAME = "INVALID_QNAME";
- public static final String INVALID_ENUM = "INVALID_ENUM";
- public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN";
- public static final String INVALID_NCNAME = "INVALID_NCNAME";
- public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN";
- public static final String INVALID_NUMBER = "INVALID_NUMBER";
- public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL";
- public static final String ER_DUPLICATE_GLOBAL_VAR ="ER_DUPLICATE_GLOBAL_VAR";
- public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR";
- public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH";
- public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX";
- public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET";
- public static final String ER_FUNCTION_NOT_FOUND =
- "ER_FUNCTION_NOT_FOUND";
- public static final String ER_CANT_HAVE_CONTENT_AND_SELECT =
- "ER_CANT_HAVE_CONTENT_AND_SELECT";
- public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE";
- public static final String ER_SET_FEATURE_NULL_NAME =
- "ER_SET_FEATURE_NULL_NAME";
- public static final String ER_GET_FEATURE_NULL_NAME =
- "ER_GET_FEATURE_NULL_NAME";
- public static final String ER_UNSUPPORTED_FEATURE =
- "ER_UNSUPPORTED_FEATURE";
- public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING =
- "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING";
-
- public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE";
- public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR =
- "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR";
- public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT =
- "WG_EXPR_ATTRIB_CHANGED_TO_SELECT";
- public static final String WG_NO_LOCALE_IN_FORMATNUMBER =
- "WG_NO_LOCALE_IN_FORMATNUMBER";
- public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND";
- public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM";
- public static final String WG_CANNOT_LOAD_REQUESTED_DOC =
- "WG_CANNOT_LOAD_REQUESTED_DOC";
- public static final String WG_CANNOT_FIND_COLLATOR ="WG_CANNOT_FIND_COLLATOR";
- public static final String WG_FUNCTIONS_SHOULD_USE_URL =
- "WG_FUNCTIONS_SHOULD_USE_URL";
- public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 =
- "WG_ENCODING_NOT_SUPPORTED_USING_UTF8";
- public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA =
- "WG_ENCODING_NOT_SUPPORTED_USING_JAVA";
- public static final String WG_SPECIFICITY_CONFLICTS =
- "WG_SPECIFICITY_CONFLICTS";
- public static final String WG_PARSING_AND_PREPARING =
- "WG_PARSING_AND_PREPARING";
- public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE";
- public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP";
- public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED";
- public static final String WG_NO_DECIMALFORMAT_DECLARATION =
- "WG_NO_DECIMALFORMAT_DECLARATION";
- public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS";
- public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED =
- "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED";
- public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE =
- "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE";
- public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE";
- public static final String WG_COULD_NOT_RESOLVE_PREFIX =
- "WG_COULD_NOT_RESOLVE_PREFIX";
- public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB =
- "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB";
- public static final String WG_ILLEGAL_ATTRIBUTE_NAME =
- "WG_ILLEGAL_ATTRIBUTE_NAME";
- public static final String WG_ILLEGAL_ATTRIBUTE_VALUE =
- "WG_ILLEGAL_ATTRIBUTE_VALUE";
- public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG";
- public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML =
- "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML";
- public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME =
- "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME";
- public static final String WG_ILLEGAL_ATTRIBUTE_POSITION =
- "WG_ILLEGAL_ATTRIBUTE_POSITION";
- public static final String NO_MODIFICATION_ALLOWED_ERR =
- "NO_MODIFICATION_ALLOWED_ERR";
+ /*
+ * Static variables
+ */
+ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX = "ER_INVALID_SET_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX";
- /*
- * Now fill in the message text.
- * Then fill in the message text for that message code in the
- * array. Use the new error code as the index into the array.
- */
+ public static final String ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT = "ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT";
- // Error messages...
+ public static final String ER_NO_CURLYBRACE = "ER_NO_CURLYBRACE";
+ public static final String ER_FUNCTION_NOT_SUPPORTED = "ER_FUNCTION_NOT_SUPPORTED";
+ public static final String ER_ILLEGAL_ATTRIBUTE = "ER_ILLEGAL_ATTRIBUTE";
+ public static final String ER_NULL_SOURCENODE_APPLYIMPORTS = "ER_NULL_SOURCENODE_APPLYIMPORTS";
+ public static final String ER_CANNOT_ADD = "ER_CANNOT_ADD";
+ public static final String ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES = "ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES";
+ public static final String ER_NO_NAME_ATTRIB = "ER_NO_NAME_ATTRIB";
+ public static final String ER_TEMPLATE_NOT_FOUND = "ER_TEMPLATE_NOT_FOUND";
+ public static final String ER_CANT_RESOLVE_NAME_AVT = "ER_CANT_RESOLVE_NAME_AVT";
+ public static final String ER_REQUIRES_ATTRIB = "ER_REQUIRES_ATTRIB";
+ public static final String ER_MUST_HAVE_TEST_ATTRIB = "ER_MUST_HAVE_TEST_ATTRIB";
+ public static final String ER_BAD_VAL_ON_LEVEL_ATTRIB = "ER_BAD_VAL_ON_LEVEL_ATTRIB";
+ public static final String ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML";
+ public static final String ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME";
+ public static final String ER_NEED_MATCH_ATTRIB = "ER_NEED_MATCH_ATTRIB";
+ public static final String ER_NEED_NAME_OR_MATCH_ATTRIB = "ER_NEED_NAME_OR_MATCH_ATTRIB";
+ public static final String ER_CANT_RESOLVE_NSPREFIX = "ER_CANT_RESOLVE_NSPREFIX";
+ public static final String ER_ILLEGAL_VALUE = "ER_ILLEGAL_VALUE";
+ public static final String ER_NO_OWNERDOC = "ER_NO_OWNERDOC";
+ public static final String ER_ELEMTEMPLATEELEM_ERR = "ER_ELEMTEMPLATEELEM_ERR";
+ public static final String ER_NULL_CHILD = "ER_NULL_CHILD";
+ public static final String ER_NEED_SELECT_ATTRIB = "ER_NEED_SELECT_ATTRIB";
+ public static final String ER_NEED_TEST_ATTRIB = "ER_NEED_TEST_ATTRIB";
+ public static final String ER_NEED_NAME_ATTRIB = "ER_NEED_NAME_ATTRIB";
+ public static final String ER_NO_CONTEXT_OWNERDOC = "ER_NO_CONTEXT_OWNERDOC";
+ public static final String ER_COULD_NOT_CREATE_XML_PROC_LIAISON = "ER_COULD_NOT_CREATE_XML_PROC_LIAISON";
+ public static final String ER_PROCESS_NOT_SUCCESSFUL = "ER_PROCESS_NOT_SUCCESSFUL";
+ public static final String ER_NOT_SUCCESSFUL = "ER_NOT_SUCCESSFUL";
+ public static final String ER_ENCODING_NOT_SUPPORTED = "ER_ENCODING_NOT_SUPPORTED";
+ public static final String ER_COULD_NOT_CREATE_TRACELISTENER = "ER_COULD_NOT_CREATE_TRACELISTENER";
+ public static final String ER_KEY_REQUIRES_NAME_ATTRIB = "ER_KEY_REQUIRES_NAME_ATTRIB";
+ public static final String ER_KEY_REQUIRES_MATCH_ATTRIB = "ER_KEY_REQUIRES_MATCH_ATTRIB";
+ public static final String ER_KEY_REQUIRES_USE_ATTRIB = "ER_KEY_REQUIRES_USE_ATTRIB";
+ public static final String ER_REQUIRES_ELEMENTS_ATTRIB = "ER_REQUIRES_ELEMENTS_ATTRIB";
+ public static final String ER_MISSING_PREFIX_ATTRIB = "ER_MISSING_PREFIX_ATTRIB";
+ public static final String ER_BAD_STYLESHEET_URL = "ER_BAD_STYLESHEET_URL";
+ public static final String ER_FILE_NOT_FOUND = "ER_FILE_NOT_FOUND";
+ public static final String ER_IOEXCEPTION = "ER_IOEXCEPTION";
+ public static final String ER_NO_HREF_ATTRIB = "ER_NO_HREF_ATTRIB";
+ public static final String ER_STYLESHEET_INCLUDES_ITSELF = "ER_STYLESHEET_INCLUDES_ITSELF";
+ public static final String ER_PROCESSINCLUDE_ERROR = "ER_PROCESSINCLUDE_ERROR";
+ public static final String ER_MISSING_LANG_ATTRIB = "ER_MISSING_LANG_ATTRIB";
+ public static final String ER_MISSING_CONTAINER_ELEMENT_COMPONENT = "ER_MISSING_CONTAINER_ELEMENT_COMPONENT";
+ public static final String ER_CAN_ONLY_OUTPUT_TO_ELEMENT = "ER_CAN_ONLY_OUTPUT_TO_ELEMENT";
+ public static final String ER_PROCESS_ERROR = "ER_PROCESS_ERROR";
+ public static final String ER_UNIMPLNODE_ERROR = "ER_UNIMPLNODE_ERROR";
+ public static final String ER_NO_SELECT_EXPRESSION = "ER_NO_SELECT_EXPRESSION";
+ public static final String ER_CANNOT_SERIALIZE_XSLPROCESSOR = "ER_CANNOT_SERIALIZE_XSLPROCESSOR";
+ public static final String ER_NO_INPUT_STYLESHEET = "ER_NO_INPUT_STYLESHEET";
+ public static final String ER_FAILED_PROCESS_STYLESHEET = "ER_FAILED_PROCESS_STYLESHEET";
+ public static final String ER_COULDNT_PARSE_DOC = "ER_COULDNT_PARSE_DOC";
+ public static final String ER_COULDNT_FIND_FRAGMENT = "ER_COULDNT_FIND_FRAGMENT";
+ public static final String ER_NODE_NOT_ELEMENT = "ER_NODE_NOT_ELEMENT";
+ public static final String ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = "ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB";
+ public static final String ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = "ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB";
+ public static final String ER_NO_CLONE_OF_DOCUMENT_FRAG = "ER_NO_CLONE_OF_DOCUMENT_FRAG";
+ public static final String ER_CANT_CREATE_ITEM = "ER_CANT_CREATE_ITEM";
+ public static final String ER_XMLSPACE_ILLEGAL_VALUE = "ER_XMLSPACE_ILLEGAL_VALUE";
+ public static final String ER_NO_XSLKEY_DECLARATION = "ER_NO_XSLKEY_DECLARATION";
+ public static final String ER_CANT_CREATE_URL = "ER_CANT_CREATE_URL";
+ public static final String ER_XSLFUNCTIONS_UNSUPPORTED = "ER_XSLFUNCTIONS_UNSUPPORTED";
+ public static final String ER_PROCESSOR_ERROR = "ER_PROCESSOR_ERROR";
+ public static final String ER_NOT_ALLOWED_INSIDE_STYLESHEET = "ER_NOT_ALLOWED_INSIDE_STYLESHEET";
+ public static final String ER_RESULTNS_NOT_SUPPORTED = "ER_RESULTNS_NOT_SUPPORTED";
+ public static final String ER_DEFAULTSPACE_NOT_SUPPORTED = "ER_DEFAULTSPACE_NOT_SUPPORTED";
+ public static final String ER_INDENTRESULT_NOT_SUPPORTED = "ER_INDENTRESULT_NOT_SUPPORTED";
+ public static final String ER_ILLEGAL_ATTRIB = "ER_ILLEGAL_ATTRIB";
+ public static final String ER_UNKNOWN_XSL_ELEM = "ER_UNKNOWN_XSL_ELEM";
+ public static final String ER_BAD_XSLSORT_USE = "ER_BAD_XSLSORT_USE";
+ public static final String ER_MISPLACED_XSLWHEN = "ER_MISPLACED_XSLWHEN";
+ public static final String ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE";
+ public static final String ER_MISPLACED_XSLOTHERWISE = "ER_MISPLACED_XSLOTHERWISE";
+ public static final String ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = "ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE";
+ public static final String ER_NOT_ALLOWED_INSIDE_TEMPLATE = "ER_NOT_ALLOWED_INSIDE_TEMPLATE";
+ public static final String ER_UNKNOWN_EXT_NS_PREFIX = "ER_UNKNOWN_EXT_NS_PREFIX";
+ public static final String ER_IMPORTS_AS_FIRST_ELEM = "ER_IMPORTS_AS_FIRST_ELEM";
+ public static final String ER_IMPORTING_ITSELF = "ER_IMPORTING_ITSELF";
+ public static final String ER_XMLSPACE_ILLEGAL_VAL = "ER_XMLSPACE_ILLEGAL_VAL";
+ public static final String ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = "ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL";
+ public static final String ER_SAX_EXCEPTION = "ER_SAX_EXCEPTION";
+ public static final String ER_XSLT_ERROR = "ER_XSLT_ERROR";
+ public static final String ER_CURRENCY_SIGN_ILLEGAL = "ER_CURRENCY_SIGN_ILLEGAL";
+ public static final String ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = "ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM";
+ public static final String ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = "ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER";
+ public static final String ER_REDIRECT_COULDNT_GET_FILENAME = "ER_REDIRECT_COULDNT_GET_FILENAME";
+ public static final String ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = "ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT";
+ public static final String ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = "ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX";
+ public static final String ER_MISSING_NS_URI = "ER_MISSING_NS_URI";
+ public static final String ER_MISSING_ARG_FOR_OPTION = "ER_MISSING_ARG_FOR_OPTION";
+ public static final String ER_INVALID_OPTION = "ER_INVALID_OPTION";
+ public static final String ER_MALFORMED_FORMAT_STRING = "ER_MALFORMED_FORMAT_STRING";
+ public static final String ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = "ER_STYLESHEET_REQUIRES_VERSION_ATTRIB";
+ public static final String ER_ILLEGAL_ATTRIBUTE_VALUE = "ER_ILLEGAL_ATTRIBUTE_VALUE";
+ public static final String ER_CHOOSE_REQUIRES_WHEN = "ER_CHOOSE_REQUIRES_WHEN";
+ public static final String ER_NO_APPLY_IMPORT_IN_FOR_EACH = "ER_NO_APPLY_IMPORT_IN_FOR_EACH";
+ public static final String ER_CANT_USE_DTM_FOR_OUTPUT = "ER_CANT_USE_DTM_FOR_OUTPUT";
+ public static final String ER_CANT_USE_DTM_FOR_INPUT = "ER_CANT_USE_DTM_FOR_INPUT";
+ public static final String ER_CALL_TO_EXT_FAILED = "ER_CALL_TO_EXT_FAILED";
+ public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE";
+ public static final String ER_INVALID_UTF16_SURROGATE = "ER_INVALID_UTF16_SURROGATE";
+ public static final String ER_XSLATTRSET_USED_ITSELF = "ER_XSLATTRSET_USED_ITSELF";
+ public static final String ER_CANNOT_MIX_XERCESDOM = "ER_CANNOT_MIX_XERCESDOM";
+ public static final String ER_TOO_MANY_LISTENERS = "ER_TOO_MANY_LISTENERS";
+ public static final String ER_IN_ELEMTEMPLATEELEM_READOBJECT = "ER_IN_ELEMTEMPLATEELEM_READOBJECT";
+ public static final String ER_DUPLICATE_NAMED_TEMPLATE = "ER_DUPLICATE_NAMED_TEMPLATE";
+ public static final String ER_INVALID_KEY_CALL = "ER_INVALID_KEY_CALL";
+ public static final String ER_REFERENCING_ITSELF = "ER_REFERENCING_ITSELF";
+ public static final String ER_ILLEGAL_DOMSOURCE_INPUT = "ER_ILLEGAL_DOMSOURCE_INPUT";
+ public static final String ER_CLASS_NOT_FOUND_FOR_OPTION = "ER_CLASS_NOT_FOUND_FOR_OPTION";
+ public static final String ER_REQUIRED_ELEM_NOT_FOUND = "ER_REQUIRED_ELEM_NOT_FOUND";
+ public static final String ER_INPUT_CANNOT_BE_NULL = "ER_INPUT_CANNOT_BE_NULL";
+ public static final String ER_URI_CANNOT_BE_NULL = "ER_URI_CANNOT_BE_NULL";
+ public static final String ER_FILE_CANNOT_BE_NULL = "ER_FILE_CANNOT_BE_NULL";
+ public static final String ER_SOURCE_CANNOT_BE_NULL = "ER_SOURCE_CANNOT_BE_NULL";
+ public static final String ER_CANNOT_INIT_BSFMGR = "ER_CANNOT_INIT_BSFMGR";
+ public static final String ER_CANNOT_CMPL_EXTENSN = "ER_CANNOT_CMPL_EXTENSN";
+ public static final String ER_CANNOT_CREATE_EXTENSN = "ER_CANNOT_CREATE_EXTENSN";
+ public static final String ER_INSTANCE_MTHD_CALL_REQUIRES = "ER_INSTANCE_MTHD_CALL_REQUIRES";
+ public static final String ER_INVALID_ELEMENT_NAME = "ER_INVALID_ELEMENT_NAME";
+ public static final String ER_ELEMENT_NAME_METHOD_STATIC = "ER_ELEMENT_NAME_METHOD_STATIC";
+ public static final String ER_EXTENSION_FUNC_UNKNOWN = "ER_EXTENSION_FUNC_UNKNOWN";
+ public static final String ER_MORE_MATCH_CONSTRUCTOR = "ER_MORE_MATCH_CONSTRUCTOR";
+ public static final String ER_MORE_MATCH_METHOD = "ER_MORE_MATCH_METHOD";
+ public static final String ER_MORE_MATCH_ELEMENT = "ER_MORE_MATCH_ELEMENT";
+ public static final String ER_INVALID_CONTEXT_PASSED = "ER_INVALID_CONTEXT_PASSED";
+ public static final String ER_POOL_EXISTS = "ER_POOL_EXISTS";
+ public static final String ER_NO_DRIVER_NAME = "ER_NO_DRIVER_NAME";
+ public static final String ER_NO_URL = "ER_NO_URL";
+ public static final String ER_POOL_SIZE_LESSTHAN_ONE = "ER_POOL_SIZE_LESSTHAN_ONE";
+ public static final String ER_INVALID_DRIVER = "ER_INVALID_DRIVER";
+ public static final String ER_NO_STYLESHEETROOT = "ER_NO_STYLESHEETROOT";
+ public static final String ER_ILLEGAL_XMLSPACE_VALUE = "ER_ILLEGAL_XMLSPACE_VALUE";
+ public static final String ER_PROCESSFROMNODE_FAILED = "ER_PROCESSFROMNODE_FAILED";
+ public static final String ER_RESOURCE_COULD_NOT_LOAD = "ER_RESOURCE_COULD_NOT_LOAD";
+ public static final String ER_BUFFER_SIZE_LESSTHAN_ZERO = "ER_BUFFER_SIZE_LESSTHAN_ZERO";
+ public static final String ER_UNKNOWN_ERROR_CALLING_EXTENSION = "ER_UNKNOWN_ERROR_CALLING_EXTENSION";
+ public static final String ER_NO_NAMESPACE_DECL = "ER_NO_NAMESPACE_DECL";
+ public static final String ER_ELEM_CONTENT_NOT_ALLOWED = "ER_ELEM_CONTENT_NOT_ALLOWED";
+ public static final String ER_STYLESHEET_DIRECTED_TERMINATION = "ER_STYLESHEET_DIRECTED_TERMINATION";
+ public static final String ER_ONE_OR_TWO = "ER_ONE_OR_TWO";
+ public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE";
+ public static final String ER_COULD_NOT_LOAD_RESOURCE = "ER_COULD_NOT_LOAD_RESOURCE";
+ public static final String ER_CANNOT_INIT_DEFAULT_TEMPLATES = "ER_CANNOT_INIT_DEFAULT_TEMPLATES";
+ public static final String ER_RESULT_NULL = "ER_RESULT_NULL";
+ public static final String ER_RESULT_COULD_NOT_BE_SET = "ER_RESULT_COULD_NOT_BE_SET";
+ public static final String ER_NO_OUTPUT_SPECIFIED = "ER_NO_OUTPUT_SPECIFIED";
+ public static final String ER_CANNOT_TRANSFORM_TO_RESULT_TYPE = "ER_CANNOT_TRANSFORM_TO_RESULT_TYPE";
+ public static final String ER_CANNOT_TRANSFORM_SOURCE_TYPE = "ER_CANNOT_TRANSFORM_SOURCE_TYPE";
+ public static final String ER_NULL_CONTENT_HANDLER = "ER_NULL_CONTENT_HANDLER";
+ public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER";
+ public static final String ER_CANNOT_CALL_PARSE = "ER_CANNOT_CALL_PARSE";
+ public static final String ER_NO_PARENT_FOR_FILTER = "ER_NO_PARENT_FOR_FILTER";
+ public static final String ER_NO_STYLESHEET_IN_MEDIA = "ER_NO_STYLESHEET_IN_MEDIA";
+ public static final String ER_NO_STYLESHEET_PI = "ER_NO_STYLESHEET_PI";
+ public static final String ER_NOT_SUPPORTED = "ER_NOT_SUPPORTED";
+ public static final String ER_PROPERTY_VALUE_BOOLEAN = "ER_PROPERTY_VALUE_BOOLEAN";
+ public static final String ER_COULD_NOT_FIND_EXTERN_SCRIPT = "ER_COULD_NOT_FIND_EXTERN_SCRIPT";
+ public static final String ER_RESOURCE_COULD_NOT_FIND = "ER_RESOURCE_COULD_NOT_FIND";
+ public static final String ER_OUTPUT_PROPERTY_NOT_RECOGNIZED = "ER_OUTPUT_PROPERTY_NOT_RECOGNIZED";
+ public static final String ER_FAILED_CREATING_ELEMLITRSLT = "ER_FAILED_CREATING_ELEMLITRSLT";
+ public static final String ER_VALUE_SHOULD_BE_NUMBER = "ER_VALUE_SHOULD_BE_NUMBER";
+ public static final String ER_VALUE_SHOULD_EQUAL = "ER_VALUE_SHOULD_EQUAL";
+ public static final String ER_FAILED_CALLING_METHOD = "ER_FAILED_CALLING_METHOD";
+ public static final String ER_FAILED_CREATING_ELEMTMPL = "ER_FAILED_CREATING_ELEMTMPL";
+ public static final String ER_CHARS_NOT_ALLOWED = "ER_CHARS_NOT_ALLOWED";
+ public static final String ER_ATTR_NOT_ALLOWED = "ER_ATTR_NOT_ALLOWED";
+ public static final String ER_BAD_VALUE = "ER_BAD_VALUE";
+ public static final String ER_ATTRIB_VALUE_NOT_FOUND = "ER_ATTRIB_VALUE_NOT_FOUND";
+ public static final String ER_ATTRIB_VALUE_NOT_RECOGNIZED = "ER_ATTRIB_VALUE_NOT_RECOGNIZED";
+ public static final String ER_NULL_URI_NAMESPACE = "ER_NULL_URI_NAMESPACE";
+ public static final String ER_NUMBER_TOO_BIG = "ER_NUMBER_TOO_BIG";
+ public static final String ER_CANNOT_FIND_SAX1_DRIVER = "ER_CANNOT_FIND_SAX1_DRIVER";
+ public static final String ER_SAX1_DRIVER_NOT_LOADED = "ER_SAX1_DRIVER_NOT_LOADED";
+ public static final String ER_SAX1_DRIVER_NOT_INSTANTIATED = "ER_SAX1_DRIVER_NOT_INSTANTIATED";
+ public static final String ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER = "ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER";
+ public static final String ER_PARSER_PROPERTY_NOT_SPECIFIED = "ER_PARSER_PROPERTY_NOT_SPECIFIED";
+ public static final String ER_PARSER_ARG_CANNOT_BE_NULL = "ER_PARSER_ARG_CANNOT_BE_NULL";
+ public static final String ER_FEATURE = "ER_FEATURE";
+ public static final String ER_PROPERTY = "ER_PROPERTY";
+ public static final String ER_NULL_ENTITY_RESOLVER = "ER_NULL_ENTITY_RESOLVER";
+ public static final String ER_NULL_DTD_HANDLER = "ER_NULL_DTD_HANDLER";
+ public static final String ER_NO_DRIVER_NAME_SPECIFIED = "ER_NO_DRIVER_NAME_SPECIFIED";
+ public static final String ER_NO_URL_SPECIFIED = "ER_NO_URL_SPECIFIED";
+ public static final String ER_POOLSIZE_LESS_THAN_ONE = "ER_POOLSIZE_LESS_THAN_ONE";
+ public static final String ER_INVALID_DRIVER_NAME = "ER_INVALID_DRIVER_NAME";
+ public static final String ER_ERRORLISTENER = "ER_ERRORLISTENER";
+ public static final String ER_ASSERT_NO_TEMPLATE_PARENT = "ER_ASSERT_NO_TEMPLATE_PARENT";
+ public static final String ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR = "ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR";
+ public static final String ER_NOT_ALLOWED_IN_POSITION = "ER_NOT_ALLOWED_IN_POSITION";
+ public static final String ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION = "ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION";
+ public static final String ER_NAMESPACE_CONTEXT_NULL_NAMESPACE = "ER_NAMESPACE_CONTEXT_NULL_NAMESPACE";
+ public static final String ER_NAMESPACE_CONTEXT_NULL_PREFIX = "ER_NAMESPACE_CONTEXT_NULL_PREFIX";
+ public static final String ER_XPATH_RESOLVER_NULL_QNAME = "ER_XPATH_RESOLVER_NULL_QNAME";
+ public static final String ER_XPATH_RESOLVER_NEGATIVE_ARITY = "ER_XPATH_RESOLVER_NEGATIVE_ARITY";
+ public static final String INVALID_TCHAR = "INVALID_TCHAR";
+ public static final String INVALID_QNAME = "INVALID_QNAME";
+ public static final String INVALID_ENUM = "INVALID_ENUM";
+ public static final String INVALID_NMTOKEN = "INVALID_NMTOKEN";
+ public static final String INVALID_NCNAME = "INVALID_NCNAME";
+ public static final String INVALID_BOOLEAN = "INVALID_BOOLEAN";
+ public static final String INVALID_NUMBER = "INVALID_NUMBER";
+ public static final String ER_ARG_LITERAL = "ER_ARG_LITERAL";
+ public static final String ER_DUPLICATE_GLOBAL_VAR = "ER_DUPLICATE_GLOBAL_VAR";
+ public static final String ER_DUPLICATE_VAR = "ER_DUPLICATE_VAR";
+ public static final String ER_TEMPLATE_NAME_MATCH = "ER_TEMPLATE_NAME_MATCH";
+ public static final String ER_INVALID_PREFIX = "ER_INVALID_PREFIX";
+ public static final String ER_NO_ATTRIB_SET = "ER_NO_ATTRIB_SET";
+ public static final String ER_FUNCTION_NOT_FOUND = "ER_FUNCTION_NOT_FOUND";
+ public static final String ER_CANT_HAVE_CONTENT_AND_SELECT = "ER_CANT_HAVE_CONTENT_AND_SELECT";
+ public static final String ER_INVALID_SET_PARAM_VALUE = "ER_INVALID_SET_PARAM_VALUE";
+ public static final String ER_SET_FEATURE_NULL_NAME = "ER_SET_FEATURE_NULL_NAME";
+ public static final String ER_GET_FEATURE_NULL_NAME = "ER_GET_FEATURE_NULL_NAME";
+ public static final String ER_UNSUPPORTED_FEATURE = "ER_UNSUPPORTED_FEATURE";
+ public static final String ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING = "ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING";
- /** Get the lookup table for error messages.
- *
- * @return The int to message lookup table.
- */
- public Object[][] getContents()
- {
- return new Object[][] {
+ public static final String WG_FOUND_CURLYBRACE = "WG_FOUND_CURLYBRACE";
+ public static final String WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = "WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR";
+ public static final String WG_EXPR_ATTRIB_CHANGED_TO_SELECT = "WG_EXPR_ATTRIB_CHANGED_TO_SELECT";
+ public static final String WG_NO_LOCALE_IN_FORMATNUMBER = "WG_NO_LOCALE_IN_FORMATNUMBER";
+ public static final String WG_LOCALE_NOT_FOUND = "WG_LOCALE_NOT_FOUND";
+ public static final String WG_CANNOT_MAKE_URL_FROM = "WG_CANNOT_MAKE_URL_FROM";
+ public static final String WG_CANNOT_LOAD_REQUESTED_DOC = "WG_CANNOT_LOAD_REQUESTED_DOC";
+ public static final String WG_CANNOT_FIND_COLLATOR = "WG_CANNOT_FIND_COLLATOR";
+ public static final String WG_FUNCTIONS_SHOULD_USE_URL = "WG_FUNCTIONS_SHOULD_USE_URL";
+ public static final String WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = "WG_ENCODING_NOT_SUPPORTED_USING_UTF8";
+ public static final String WG_ENCODING_NOT_SUPPORTED_USING_JAVA = "WG_ENCODING_NOT_SUPPORTED_USING_JAVA";
+ public static final String WG_SPECIFICITY_CONFLICTS = "WG_SPECIFICITY_CONFLICTS";
+ public static final String WG_PARSING_AND_PREPARING = "WG_PARSING_AND_PREPARING";
+ public static final String WG_ATTR_TEMPLATE = "WG_ATTR_TEMPLATE";
+ public static final String WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = "WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESP";
+ public static final String WG_ATTRIB_NOT_HANDLED = "WG_ATTRIB_NOT_HANDLED";
+ public static final String WG_NO_DECIMALFORMAT_DECLARATION = "WG_NO_DECIMALFORMAT_DECLARATION";
+ public static final String WG_OLD_XSLT_NS = "WG_OLD_XSLT_NS";
+ public static final String WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = "WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED";
+ public static final String WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = "WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE";
+ public static final String WG_ILLEGAL_ATTRIBUTE = "WG_ILLEGAL_ATTRIBUTE";
+ public static final String WG_COULD_NOT_RESOLVE_PREFIX = "WG_COULD_NOT_RESOLVE_PREFIX";
+ public static final String WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = "WG_STYLESHEET_REQUIRES_VERSION_ATTRIB";
+ public static final String WG_ILLEGAL_ATTRIBUTE_NAME = "WG_ILLEGAL_ATTRIBUTE_NAME";
+ public static final String WG_ILLEGAL_ATTRIBUTE_VALUE = "WG_ILLEGAL_ATTRIBUTE_VALUE";
+ public static final String WG_EMPTY_SECOND_ARG = "WG_EMPTY_SECOND_ARG";
+ public static final String WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = "WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML";
+ public static final String WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = "WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME";
+ public static final String WG_ILLEGAL_ATTRIBUTE_POSITION = "WG_ILLEGAL_ATTRIBUTE_POSITION";
+ public static final String NO_MODIFICATION_ALLOWED_ERR = "NO_MODIFICATION_ALLOWED_ERR";
- /** Error message ID that has a null message, but takes in a single object. */
- {"ER0000" , "{0}" },
+ /*
+ * Now fill in the message text. Then fill in the message text for that
+ * message code in the array. Use the new error code as the index into the
+ * array.
+ */
- { ER_NO_CURLYBRACE,
- "Error: Can not have '{' within expression"},
+ // Error messages...
+ /**
+ * Get the lookup table for error messages.
+ *
+ * @return The int to message lookup table.
+ */
+ public Object[][] getContents() {
+ return new Object[][] {
- { ER_ILLEGAL_ATTRIBUTE ,
- "{0} has an illegal attribute: {1}"},
+ /**
+ * Error message ID that has a null message, but takes in a
+ * single object.
+ */
+ { "ER0000", "{0}" },
- {ER_NULL_SOURCENODE_APPLYIMPORTS ,
- "sourceNode is null in xsl:apply-imports!"},
+ { ER_NO_CURLYBRACE, "Error: Can not have '{' within expression" },
- {ER_CANNOT_ADD,
- "Can not add {0} to {1}"},
+ { ER_ILLEGAL_ATTRIBUTE, "{0} has an illegal attribute: {1}" },
- { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES,
- "sourceNode is null in handleApplyTemplatesInstruction!"},
+ { ER_NULL_SOURCENODE_APPLYIMPORTS,
+ "sourceNode is null in xsl:apply-imports!" },
- { ER_NO_NAME_ATTRIB,
- "{0} must have a name attribute."},
+ { ER_CANNOT_ADD, "Can not add {0} to {1}" },
- {ER_TEMPLATE_NOT_FOUND,
- "Could not find template named: {0}"},
+ { ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES,
+ "sourceNode is null in handleApplyTemplatesInstruction!" },
- {ER_CANT_RESOLVE_NAME_AVT,
- "Could not resolve name AVT in xsl:call-template."},
+ { ER_NO_NAME_ATTRIB, "{0} must have a name attribute." },
- {ER_REQUIRES_ATTRIB,
- "{0} requires attribute: {1}"},
+ { ER_TEMPLATE_NOT_FOUND, "Could not find template named: {0}" },
- { ER_MUST_HAVE_TEST_ATTRIB,
- "{0} must have a ''test'' attribute."},
+ { ER_CANT_RESOLVE_NAME_AVT,
+ "Could not resolve name AVT in xsl:call-template." },
- {ER_BAD_VAL_ON_LEVEL_ATTRIB,
- "Bad value on level attribute: {0}"},
+ { ER_REQUIRES_ATTRIB, "{0} requires attribute: {1}" },
- {ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
- "processing-instruction name can not be 'xml'"},
+ { ER_MUST_HAVE_TEST_ATTRIB,
+ "{0} must have a ''test'' attribute." },
- { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
- "processing-instruction name must be a valid NCName: {0}"},
+ { ER_BAD_VAL_ON_LEVEL_ATTRIB,
+ "Bad value on level attribute: {0}" },
- { ER_NEED_MATCH_ATTRIB,
- "{0} must have a match attribute if it has a mode."},
+ { ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
+ "processing-instruction name can not be 'xml'" },
- { ER_NEED_NAME_OR_MATCH_ATTRIB,
- "{0} requires either a name or a match attribute."},
+ { ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
+ "processing-instruction name must be a valid NCName: {0}" },
- {ER_CANT_RESOLVE_NSPREFIX,
- "Can not resolve namespace prefix: {0}"},
+ { ER_NEED_MATCH_ATTRIB,
+ "{0} must have a match attribute if it has a mode." },
- { ER_ILLEGAL_VALUE,
- "xml:space has an illegal value: {0}"},
+ { ER_NEED_NAME_OR_MATCH_ATTRIB,
+ "{0} requires either a name or a match attribute." },
- { ER_NO_OWNERDOC,
- "Child node does not have an owner document!"},
+ { ER_CANT_RESOLVE_NSPREFIX,
+ "Can not resolve namespace prefix: {0}" },
- { ER_ELEMTEMPLATEELEM_ERR,
- "There appears to be a call-template error: {0}"},
+ { ER_ILLEGAL_VALUE, "xml:space has an illegal value: {0}" },
- { ER_NULL_CHILD,
- "Trying to add a null child!"},
+ { ER_NO_OWNERDOC, "Child node does not have an owner document!" },
- { ER_NEED_SELECT_ATTRIB,
- "{0} requires a select attribute."},
+ { ER_ELEMTEMPLATEELEM_ERR,
+ "There appears to be a call-template error: {0}" },
- { ER_NEED_TEST_ATTRIB ,
- "xsl:when must have a 'test' attribute."},
+ { ER_NULL_CHILD, "Trying to add a null child!" },
- { ER_NEED_NAME_ATTRIB,
- "xsl:with-param must have a 'name' attribute."},
+ { ER_NEED_SELECT_ATTRIB, "{0} requires a select attribute." },
- { ER_NO_CONTEXT_OWNERDOC,
- "context does not have an owner document!"},
+ { ER_NEED_TEST_ATTRIB, "xsl:when must have a 'test' attribute." },
- {ER_COULD_NOT_CREATE_XML_PROC_LIAISON,
- "Could not create XML TransformerFactory Liaison: {0}"},
+ { ER_NEED_NAME_ATTRIB,
+ "xsl:with-param must have a 'name' attribute." },
- {ER_PROCESS_NOT_SUCCESSFUL,
- "Xalan: Process was not successful."},
+ { ER_NO_CONTEXT_OWNERDOC,
+ "context does not have an owner document!" },
- { ER_NOT_SUCCESSFUL,
- "Xalan: was not successful."},
+ { ER_COULD_NOT_CREATE_XML_PROC_LIAISON,
+ "Could not create XML TransformerFactory Liaison: {0}" },
- { ER_ENCODING_NOT_SUPPORTED,
- "Encoding not supported: {0}"},
+ { ER_PROCESS_NOT_SUCCESSFUL,
+ "Xalan: Process was not successful." },
- {ER_COULD_NOT_CREATE_TRACELISTENER,
- "Could not create TraceListener: {0}"},
+ { ER_NOT_SUCCESSFUL, "Xalan: was not successful." },
- {ER_KEY_REQUIRES_NAME_ATTRIB,
- "xsl:key requires a 'name' attribute!"},
+ { ER_ENCODING_NOT_SUPPORTED, "Encoding not supported: {0}" },
- { ER_KEY_REQUIRES_MATCH_ATTRIB,
- "xsl:key requires a 'match' attribute!"},
+ { ER_COULD_NOT_CREATE_TRACELISTENER,
+ "Could not create TraceListener: {0}" },
- { ER_KEY_REQUIRES_USE_ATTRIB,
- "xsl:key requires a 'use' attribute!"},
+ { ER_KEY_REQUIRES_NAME_ATTRIB,
+ "xsl:key requires a 'name' attribute!" },
- { ER_REQUIRES_ELEMENTS_ATTRIB,
- "(StylesheetHandler) {0} requires an ''elements'' attribute!"},
+ { ER_KEY_REQUIRES_MATCH_ATTRIB,
+ "xsl:key requires a 'match' attribute!" },
- { ER_MISSING_PREFIX_ATTRIB,
- "(StylesheetHandler) {0} attribute ''prefix'' is missing"},
+ { ER_KEY_REQUIRES_USE_ATTRIB,
+ "xsl:key requires a 'use' attribute!" },
- { ER_BAD_STYLESHEET_URL,
- "Stylesheet URL is bad: {0}"},
+ { ER_REQUIRES_ELEMENTS_ATTRIB,
+ "(StylesheetHandler) {0} requires an ''elements'' attribute!" },
- { ER_FILE_NOT_FOUND,
- "Stylesheet file was not found: {0}"},
+ { ER_MISSING_PREFIX_ATTRIB,
+ "(StylesheetHandler) {0} attribute ''prefix'' is missing" },
- { ER_IOEXCEPTION,
- "Had IO Exception with stylesheet file: {0}"},
+ { ER_BAD_STYLESHEET_URL, "Stylesheet URL is bad: {0}" },
- { ER_NO_HREF_ATTRIB,
- "(StylesheetHandler) Could not find href attribute for {0}"},
+ { ER_FILE_NOT_FOUND, "Stylesheet file was not found: {0}" },
- { ER_STYLESHEET_INCLUDES_ITSELF,
- "(StylesheetHandler) {0} is directly or indirectly including itself!"},
+ { ER_IOEXCEPTION, "Had IO Exception with stylesheet file: {0}" },
- { ER_PROCESSINCLUDE_ERROR,
- "StylesheetHandler.processInclude error, {0}"},
+ { ER_NO_HREF_ATTRIB,
+ "(StylesheetHandler) Could not find href attribute for {0}" },
- { ER_MISSING_LANG_ATTRIB,
- "(StylesheetHandler) {0} attribute ''lang'' is missing"},
+ { ER_STYLESHEET_INCLUDES_ITSELF,
+ "(StylesheetHandler) {0} is directly or indirectly including itself!" },
- { ER_MISSING_CONTAINER_ELEMENT_COMPONENT,
- "(StylesheetHandler) misplaced {0} element?? Missing container element ''component''"},
+ { ER_PROCESSINCLUDE_ERROR,
+ "StylesheetHandler.processInclude error, {0}" },
- { ER_CAN_ONLY_OUTPUT_TO_ELEMENT,
- "Can only output to an Element, DocumentFragment, Document, or PrintWriter."},
+ { ER_MISSING_LANG_ATTRIB,
+ "(StylesheetHandler) {0} attribute ''lang'' is missing" },
- { ER_PROCESS_ERROR,
- "StylesheetRoot.process error"},
+ {
+ ER_MISSING_CONTAINER_ELEMENT_COMPONENT,
+ "(StylesheetHandler) misplaced {0} element?? Missing container element ''component''" },
- { ER_UNIMPLNODE_ERROR,
- "UnImplNode error: {0}"},
+ { ER_CAN_ONLY_OUTPUT_TO_ELEMENT,
+ "Can only output to an Element, DocumentFragment, Document, or PrintWriter." },
- { ER_NO_SELECT_EXPRESSION,
- "Error! Did not find xpath select expression (-select)."},
+ { ER_PROCESS_ERROR, "StylesheetRoot.process error" },
- { ER_CANNOT_SERIALIZE_XSLPROCESSOR,
- "Can not serialize an XSLProcessor!"},
+ { ER_UNIMPLNODE_ERROR, "UnImplNode error: {0}" },
- { ER_NO_INPUT_STYLESHEET,
- "Stylesheet input was not specified!"},
+ { ER_NO_SELECT_EXPRESSION,
+ "Error! Did not find xpath select expression (-select)." },
- { ER_FAILED_PROCESS_STYLESHEET,
- "Failed to process stylesheet!"},
+ { ER_CANNOT_SERIALIZE_XSLPROCESSOR,
+ "Can not serialize an XSLProcessor!" },
- { ER_COULDNT_PARSE_DOC,
- "Could not parse {0} document!"},
+ { ER_NO_INPUT_STYLESHEET, "Stylesheet input was not specified!" },
- { ER_COULDNT_FIND_FRAGMENT,
- "Could not find fragment: {0}"},
+ { ER_FAILED_PROCESS_STYLESHEET, "Failed to process stylesheet!" },
- { ER_NODE_NOT_ELEMENT,
- "Node pointed to by fragment identifier was not an element: {0}"},
+ { ER_COULDNT_PARSE_DOC, "Could not parse {0} document!" },
- { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB,
- "for-each must have either a match or name attribute"},
+ { ER_COULDNT_FIND_FRAGMENT, "Could not find fragment: {0}" },
- { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB,
- "templates must have either a match or name attribute"},
+ { ER_NODE_NOT_ELEMENT,
+ "Node pointed to by fragment identifier was not an element: {0}" },
- { ER_NO_CLONE_OF_DOCUMENT_FRAG,
- "No clone of a document fragment!"},
+ { ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB,
+ "for-each must have either a match or name attribute" },
- { ER_CANT_CREATE_ITEM,
- "Can not create item in result tree: {0}"},
+ { ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB,
+ "templates must have either a match or name attribute" },
- { ER_XMLSPACE_ILLEGAL_VALUE,
- "xml:space in the source XML has an illegal value: {0}"},
+ { ER_NO_CLONE_OF_DOCUMENT_FRAG,
+ "No clone of a document fragment!" },
- { ER_NO_XSLKEY_DECLARATION,
- "There is no xsl:key declaration for {0}!"},
+ { ER_CANT_CREATE_ITEM,
+ "Can not create item in result tree: {0}" },
- { ER_CANT_CREATE_URL,
- "Error! Cannot create url for: {0}"},
+ { ER_XMLSPACE_ILLEGAL_VALUE,
+ "xml:space in the source XML has an illegal value: {0}" },
- { ER_XSLFUNCTIONS_UNSUPPORTED,
- "xsl:functions is unsupported"},
+ { ER_NO_XSLKEY_DECLARATION,
+ "There is no xsl:key declaration for {0}!" },
- { ER_PROCESSOR_ERROR,
- "XSLT TransformerFactory Error"},
+ { ER_CANT_CREATE_URL, "Error! Cannot create url for: {0}" },
- { ER_NOT_ALLOWED_INSIDE_STYLESHEET,
- "(StylesheetHandler) {0} not allowed inside a stylesheet!"},
+ { ER_XSLFUNCTIONS_UNSUPPORTED, "xsl:functions is unsupported" },
- { ER_RESULTNS_NOT_SUPPORTED,
- "result-ns no longer supported! Use xsl:output instead."},
+ { ER_PROCESSOR_ERROR, "XSLT TransformerFactory Error" },
- { ER_DEFAULTSPACE_NOT_SUPPORTED,
- "default-space no longer supported! Use xsl:strip-space or xsl:preserve-space instead."},
+ { ER_NOT_ALLOWED_INSIDE_STYLESHEET,
+ "(StylesheetHandler) {0} not allowed inside a stylesheet!" },
- { ER_INDENTRESULT_NOT_SUPPORTED,
- "indent-result no longer supported! Use xsl:output instead."},
+ { ER_RESULTNS_NOT_SUPPORTED,
+ "result-ns no longer supported! Use xsl:output instead." },
- { ER_ILLEGAL_ATTRIB,
- "(StylesheetHandler) {0} has an illegal attribute: {1}"},
+ {
+ ER_DEFAULTSPACE_NOT_SUPPORTED,
+ "default-space no longer supported! Use xsl:strip-space or xsl:preserve-space instead." },
- { ER_UNKNOWN_XSL_ELEM,
- "Unknown XSL element: {0}"},
+ { ER_INDENTRESULT_NOT_SUPPORTED,
+ "indent-result no longer supported! Use xsl:output instead." },
- { ER_BAD_XSLSORT_USE,
- "(StylesheetHandler) xsl:sort can only be used with xsl:apply-templates or xsl:for-each."},
+ { ER_ILLEGAL_ATTRIB,
+ "(StylesheetHandler) {0} has an illegal attribute: {1}" },
- { ER_MISPLACED_XSLWHEN,
- "(StylesheetHandler) misplaced xsl:when!"},
+ { ER_UNKNOWN_XSL_ELEM, "Unknown XSL element: {0}" },
- { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE,
- "(StylesheetHandler) xsl:when not parented by xsl:choose!"},
+ {
+ ER_BAD_XSLSORT_USE,
+ "(StylesheetHandler) xsl:sort can only be used with xsl:apply-templates or xsl:for-each." },
- { ER_MISPLACED_XSLOTHERWISE,
- "(StylesheetHandler) misplaced xsl:otherwise!"},
+ { ER_MISPLACED_XSLWHEN,
+ "(StylesheetHandler) misplaced xsl:when!" },
- { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE,
- "(StylesheetHandler) xsl:otherwise not parented by xsl:choose!"},
+ { ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE,
+ "(StylesheetHandler) xsl:when not parented by xsl:choose!" },
- { ER_NOT_ALLOWED_INSIDE_TEMPLATE,
- "(StylesheetHandler) {0} is not allowed inside a template!"},
+ { ER_MISPLACED_XSLOTHERWISE,
+ "(StylesheetHandler) misplaced xsl:otherwise!" },
- { ER_UNKNOWN_EXT_NS_PREFIX,
- "(StylesheetHandler) {0} extension namespace prefix {1} unknown"},
+ { ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE,
+ "(StylesheetHandler) xsl:otherwise not parented by xsl:choose!" },
- { ER_IMPORTS_AS_FIRST_ELEM,
- "(StylesheetHandler) Imports can only occur as the first elements in the stylesheet!"},
+ { ER_NOT_ALLOWED_INSIDE_TEMPLATE,
+ "(StylesheetHandler) {0} is not allowed inside a template!" },
- { ER_IMPORTING_ITSELF,
- "(StylesheetHandler) {0} is directly or indirectly importing itself!"},
+ { ER_UNKNOWN_EXT_NS_PREFIX,
+ "(StylesheetHandler) {0} extension namespace prefix {1} unknown" },
- { ER_XMLSPACE_ILLEGAL_VAL,
- "(StylesheetHandler) " + "xml:space has an illegal value: {0}"},
+ {
+ ER_IMPORTS_AS_FIRST_ELEM,
+ "(StylesheetHandler) Imports can only occur as the first elements in the stylesheet!" },
- { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL,
- "processStylesheet not succesfull!"},
+ { ER_IMPORTING_ITSELF,
+ "(StylesheetHandler) {0} is directly or indirectly importing itself!" },
- { ER_SAX_EXCEPTION,
- "SAX Exception"},
+ {
+ ER_XMLSPACE_ILLEGAL_VAL,
+ "(StylesheetHandler) "
+ + "xml:space has an illegal value: {0}" },
-// add this message to fix bug 21478
- { ER_FUNCTION_NOT_SUPPORTED,
- "Function not supported!"},
+ { ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL,
+ "processStylesheet not succesfull!" },
- { ER_XSLT_ERROR,
- "XSLT Error"},
+ { ER_SAX_EXCEPTION, "SAX Exception" },
- { ER_CURRENCY_SIGN_ILLEGAL,
- "currency sign is not allowed in format pattern string"},
+ // add this message to fix bug 21478
+ { ER_FUNCTION_NOT_SUPPORTED, "Function not supported!" },
- { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM,
- "Document function not supported in Stylesheet DOM!"},
+ { ER_XSLT_ERROR, "XSLT Error" },
- { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER,
- "Can't resolve prefix of non-Prefix resolver!"},
+ { ER_CURRENCY_SIGN_ILLEGAL,
+ "currency sign is not allowed in format pattern string" },
- { ER_REDIRECT_COULDNT_GET_FILENAME,
- "Redirect extension: Could not get filename - file or select attribute must return vald string."},
+ { ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM,
+ "Document function not supported in Stylesheet DOM!" },
- { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT,
- "Can not build FormatterListener in Redirect extension!"},
+ { ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER,
+ "Can't resolve prefix of non-Prefix resolver!" },
- { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX,
- "Prefix in exclude-result-prefixes is not valid: {0}"},
+ {
+ ER_REDIRECT_COULDNT_GET_FILENAME,
+ "Redirect extension: Could not get filename - file or select attribute must return vald string." },
- { ER_MISSING_NS_URI,
- "Missing namespace URI for specified prefix"},
+ { ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT,
+ "Can not build FormatterListener in Redirect extension!" },
- { ER_MISSING_ARG_FOR_OPTION,
- "Missing argument for option: {0}"},
+ { ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX,
+ "Prefix in exclude-result-prefixes is not valid: {0}" },
- { ER_INVALID_OPTION,
- "Invalid option: {0}"},
+ { ER_MISSING_NS_URI,
+ "Missing namespace URI for specified prefix" },
- { ER_MALFORMED_FORMAT_STRING,
- "Malformed format string: {0}"},
+ { ER_MISSING_ARG_FOR_OPTION, "Missing argument for option: {0}" },
- { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB,
- "xsl:stylesheet requires a 'version' attribute!"},
+ { ER_INVALID_OPTION, "Invalid option: {0}" },
- { ER_ILLEGAL_ATTRIBUTE_VALUE,
- "Attribute: {0} has an illegal value: {1}"},
+ { ER_MALFORMED_FORMAT_STRING, "Malformed format string: {0}" },
- { ER_CHOOSE_REQUIRES_WHEN,
- "xsl:choose requires an xsl:when"},
+ { ER_STYLESHEET_REQUIRES_VERSION_ATTRIB,
+ "xsl:stylesheet requires a 'version' attribute!" },
- { ER_NO_APPLY_IMPORT_IN_FOR_EACH,
- "xsl:apply-imports not allowed in a xsl:for-each"},
+ { ER_ILLEGAL_ATTRIBUTE_VALUE,
+ "Attribute: {0} has an illegal value: {1}" },
- { ER_CANT_USE_DTM_FOR_OUTPUT,
- "Cannot use a DTMLiaison for an output DOM node... pass a org.apache.xpath.DOM2Helper instead!"},
+ { ER_CHOOSE_REQUIRES_WHEN, "xsl:choose requires an xsl:when" },
- { ER_CANT_USE_DTM_FOR_INPUT,
- "Cannot use a DTMLiaison for a input DOM node... pass a org.apache.xpath.DOM2Helper instead!"},
+ { ER_NO_APPLY_IMPORT_IN_FOR_EACH,
+ "xsl:apply-imports not allowed in a xsl:for-each" },
- { ER_CALL_TO_EXT_FAILED,
- "Call to extension element failed: {0}"},
+ {
+ ER_CANT_USE_DTM_FOR_OUTPUT,
+ "Cannot use a DTMLiaison for an output DOM node... pass a org.apache.xpath.DOM2Helper instead!" },
- { ER_PREFIX_MUST_RESOLVE,
- "Prefix must resolve to a namespace: {0}"},
+ {
+ ER_CANT_USE_DTM_FOR_INPUT,
+ "Cannot use a DTMLiaison for a input DOM node... pass a org.apache.xpath.DOM2Helper instead!" },
- { ER_INVALID_UTF16_SURROGATE,
- "Invalid UTF-16 surrogate detected: {0} ?"},
+ { ER_CALL_TO_EXT_FAILED,
+ "Call to extension element failed: {0}" },
- { ER_XSLATTRSET_USED_ITSELF,
- "xsl:attribute-set {0} used itself, which will cause an infinite loop."},
+ { ER_PREFIX_MUST_RESOLVE,
+ "Prefix must resolve to a namespace: {0}" },
- { ER_CANNOT_MIX_XERCESDOM,
- "Can not mix non Xerces-DOM input with Xerces-DOM output!"},
+ { ER_INVALID_UTF16_SURROGATE,
+ "Invalid UTF-16 surrogate detected: {0} ?" },
- { ER_TOO_MANY_LISTENERS,
- "addTraceListenersToStylesheet - TooManyListenersException"},
+ { ER_XSLATTRSET_USED_ITSELF,
+ "xsl:attribute-set {0} used itself, which will cause an infinite loop." },
- { ER_IN_ELEMTEMPLATEELEM_READOBJECT,
- "In ElemTemplateElement.readObject: {0}"},
+ { ER_CANNOT_MIX_XERCESDOM,
+ "Can not mix non Xerces-DOM input with Xerces-DOM output!" },
- { ER_DUPLICATE_NAMED_TEMPLATE,
- "Found more than one template named: {0}"},
+ { ER_TOO_MANY_LISTENERS,
+ "addTraceListenersToStylesheet - TooManyListenersException" },
- { ER_INVALID_KEY_CALL,
- "Invalid function call: recursive key() calls are not allowed"},
+ { ER_IN_ELEMTEMPLATEELEM_READOBJECT,
+ "In ElemTemplateElement.readObject: {0}" },
- { ER_REFERENCING_ITSELF,
- "Variable {0} is directly or indirectly referencing itself!"},
+ { ER_DUPLICATE_NAMED_TEMPLATE,
+ "Found more than one template named: {0}" },
- { ER_ILLEGAL_DOMSOURCE_INPUT,
- "The input node can not be null for a DOMSource for newTemplates!"},
+ { ER_INVALID_KEY_CALL,
+ "Invalid function call: recursive key() calls are not allowed" },
- { ER_CLASS_NOT_FOUND_FOR_OPTION,
- "Class file not found for option {0}"},
+ { ER_REFERENCING_ITSELF,
+ "Variable {0} is directly or indirectly referencing itself!" },
- { ER_REQUIRED_ELEM_NOT_FOUND,
- "Required Element not found: {0}"},
+ { ER_ILLEGAL_DOMSOURCE_INPUT,
+ "The input node can not be null for a DOMSource for newTemplates!" },
- { ER_INPUT_CANNOT_BE_NULL,
- "InputStream cannot be null"},
+ { ER_CLASS_NOT_FOUND_FOR_OPTION,
+ "Class file not found for option {0}" },
- { ER_URI_CANNOT_BE_NULL,
- "URI cannot be null"},
+ { ER_REQUIRED_ELEM_NOT_FOUND, "Required Element not found: {0}" },
- { ER_FILE_CANNOT_BE_NULL,
- "File cannot be null"},
+ { ER_INPUT_CANNOT_BE_NULL, "InputStream cannot be null" },
- { ER_SOURCE_CANNOT_BE_NULL,
- "InputSource cannot be null"},
+ { ER_URI_CANNOT_BE_NULL, "URI cannot be null" },
- { ER_CANNOT_INIT_BSFMGR,
- "Could not initialize BSF Manager"},
+ { ER_FILE_CANNOT_BE_NULL, "File cannot be null" },
- { ER_CANNOT_CMPL_EXTENSN,
- "Could not compile extension"},
+ { ER_SOURCE_CANNOT_BE_NULL, "InputSource cannot be null" },
- { ER_CANNOT_CREATE_EXTENSN,
- "Could not create extension: {0} because of: {1}"},
+ { ER_CANNOT_INIT_BSFMGR, "Could not initialize BSF Manager" },
- { ER_INSTANCE_MTHD_CALL_REQUIRES,
- "Instance method call to method {0} requires an Object instance as first argument"},
+ { ER_CANNOT_CMPL_EXTENSN, "Could not compile extension" },
- { ER_INVALID_ELEMENT_NAME,
- "Invalid element name specified {0}"},
+ { ER_CANNOT_CREATE_EXTENSN,
+ "Could not create extension: {0} because of: {1}" },
- { ER_ELEMENT_NAME_METHOD_STATIC,
- "Element name method must be static {0}"},
+ {
+ ER_INSTANCE_MTHD_CALL_REQUIRES,
+ "Instance method call to method {0} requires an Object instance as first argument" },
- { ER_EXTENSION_FUNC_UNKNOWN,
- "Extension function {0} : {1} is unknown"},
+ { ER_INVALID_ELEMENT_NAME, "Invalid element name specified {0}" },
- { ER_MORE_MATCH_CONSTRUCTOR,
- "More than one best match for constructor for {0}"},
+ { ER_ELEMENT_NAME_METHOD_STATIC,
+ "Element name method must be static {0}" },
- { ER_MORE_MATCH_METHOD,
- "More than one best match for method {0}"},
+ { ER_EXTENSION_FUNC_UNKNOWN,
+ "Extension function {0} : {1} is unknown" },
- { ER_MORE_MATCH_ELEMENT,
- "More than one best match for element method {0}"},
+ { ER_MORE_MATCH_CONSTRUCTOR,
+ "More than one best match for constructor for {0}" },
- { ER_INVALID_CONTEXT_PASSED,
- "Invalid context passed to evaluate {0}"},
+ { ER_MORE_MATCH_METHOD,
+ "More than one best match for method {0}" },
- { ER_POOL_EXISTS,
- "Pool already exists"},
+ { ER_MORE_MATCH_ELEMENT,
+ "More than one best match for element method {0}" },
- { ER_NO_DRIVER_NAME,
- "No driver Name specified"},
+ { ER_INVALID_CONTEXT_PASSED,
+ "Invalid context passed to evaluate {0}" },
- { ER_NO_URL,
- "No URL specified"},
+ { ER_POOL_EXISTS, "Pool already exists" },
- { ER_POOL_SIZE_LESSTHAN_ONE,
- "Pool size is less than one!"},
+ { ER_NO_DRIVER_NAME, "No driver Name specified" },
- { ER_INVALID_DRIVER,
- "Invalid driver name specified!"},
+ { ER_NO_URL, "No URL specified" },
- { ER_NO_STYLESHEETROOT,
- "Did not find the stylesheet root!"},
+ { ER_POOL_SIZE_LESSTHAN_ONE, "Pool size is less than one!" },
- { ER_ILLEGAL_XMLSPACE_VALUE,
- "Illegal value for xml:space"},
+ { ER_INVALID_DRIVER, "Invalid driver name specified!" },
- { ER_PROCESSFROMNODE_FAILED,
- "processFromNode failed"},
+ { ER_NO_STYLESHEETROOT, "Did not find the stylesheet root!" },
- { ER_RESOURCE_COULD_NOT_LOAD,
- "The resource [ {0} ] could not load: {1} \n {2} \t {3}"},
+ { ER_ILLEGAL_XMLSPACE_VALUE, "Illegal value for xml:space" },
- { ER_BUFFER_SIZE_LESSTHAN_ZERO,
- "Buffer size <=0"},
+ { ER_PROCESSFROMNODE_FAILED, "processFromNode failed" },
- { ER_UNKNOWN_ERROR_CALLING_EXTENSION,
- "Unknown error when calling extension"},
+ { ER_RESOURCE_COULD_NOT_LOAD,
+ "The resource [ {0} ] could not load: {1} \n {2} \t {3}" },
- { ER_NO_NAMESPACE_DECL,
- "Prefix {0} does not have a corresponding namespace declaration"},
+ { ER_BUFFER_SIZE_LESSTHAN_ZERO, "Buffer size <=0" },
- { ER_ELEM_CONTENT_NOT_ALLOWED,
- "Element content not allowed for lang=javaclass {0}"},
+ { ER_UNKNOWN_ERROR_CALLING_EXTENSION,
+ "Unknown error when calling extension" },
- { ER_STYLESHEET_DIRECTED_TERMINATION,
- "Stylesheet directed termination"},
+ { ER_NO_NAMESPACE_DECL,
+ "Prefix {0} does not have a corresponding namespace declaration" },
- { ER_ONE_OR_TWO,
- "1 or 2"},
+ { ER_ELEM_CONTENT_NOT_ALLOWED,
+ "Element content not allowed for lang=javaclass {0}" },
- { ER_TWO_OR_THREE,
- "2 or 3"},
+ { ER_STYLESHEET_DIRECTED_TERMINATION,
+ "Stylesheet directed termination" },
- { ER_COULD_NOT_LOAD_RESOURCE,
- "Could not load {0} (check CLASSPATH), now using just the defaults"},
+ { ER_ONE_OR_TWO, "1 or 2" },
- { ER_CANNOT_INIT_DEFAULT_TEMPLATES,
- "Cannot initialize default templates"},
+ { ER_TWO_OR_THREE, "2 or 3" },
- { ER_RESULT_NULL,
- "Result should not be null"},
+ { ER_COULD_NOT_LOAD_RESOURCE,
+ "Could not load {0} (check CLASSPATH), now using just the defaults" },
- { ER_RESULT_COULD_NOT_BE_SET,
- "Result could not be set"},
+ { ER_CANNOT_INIT_DEFAULT_TEMPLATES,
+ "Cannot initialize default templates" },
- { ER_NO_OUTPUT_SPECIFIED,
- "No output specified"},
+ { ER_RESULT_NULL, "Result should not be null" },
- { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE,
- "Can''t transform to a Result of type {0}"},
+ { ER_RESULT_COULD_NOT_BE_SET, "Result could not be set" },
- { ER_CANNOT_TRANSFORM_SOURCE_TYPE,
- "Can''t transform a Source of type {0}"},
+ { ER_NO_OUTPUT_SPECIFIED, "No output specified" },
- { ER_NULL_CONTENT_HANDLER,
- "Null content handler"},
+ { ER_CANNOT_TRANSFORM_TO_RESULT_TYPE,
+ "Can''t transform to a Result of type {0}" },
- { ER_NULL_ERROR_HANDLER,
- "Null error handler"},
+ { ER_CANNOT_TRANSFORM_SOURCE_TYPE,
+ "Can''t transform a Source of type {0}" },
- { ER_CANNOT_CALL_PARSE,
- "parse can not be called if the ContentHandler has not been set"},
+ { ER_NULL_CONTENT_HANDLER, "Null content handler" },
- { ER_NO_PARENT_FOR_FILTER,
- "No parent for filter"},
+ { ER_NULL_ERROR_HANDLER, "Null error handler" },
- { ER_NO_STYLESHEET_IN_MEDIA,
- "No stylesheet found in: {0}, media= {1}"},
+ { ER_CANNOT_CALL_PARSE,
+ "parse can not be called if the ContentHandler has not been set" },
- { ER_NO_STYLESHEET_PI,
- "No xml-stylesheet PI found in: {0}"},
+ { ER_NO_PARENT_FOR_FILTER, "No parent for filter" },
- { ER_NOT_SUPPORTED,
- "Not supported: {0}"},
+ { ER_NO_STYLESHEET_IN_MEDIA,
+ "No stylesheet found in: {0}, media= {1}" },
- { ER_PROPERTY_VALUE_BOOLEAN,
- "Value for property {0} should be a Boolean instance"},
+ { ER_NO_STYLESHEET_PI, "No xml-stylesheet PI found in: {0}" },
- { ER_COULD_NOT_FIND_EXTERN_SCRIPT,
- "Could not get to external script at {0}"},
+ { ER_NOT_SUPPORTED, "Not supported: {0}" },
- { ER_RESOURCE_COULD_NOT_FIND,
- "The resource [ {0} ] could not be found.\n {1}"},
+ { ER_PROPERTY_VALUE_BOOLEAN,
+ "Value for property {0} should be a Boolean instance" },
- { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED,
- "Output property not recognized: {0}"},
+ { ER_COULD_NOT_FIND_EXTERN_SCRIPT,
+ "Could not get to external script at {0}" },
- { ER_FAILED_CREATING_ELEMLITRSLT,
- "Failed creating ElemLiteralResult instance"},
+ { ER_RESOURCE_COULD_NOT_FIND,
+ "The resource [ {0} ] could not be found.\n {1}" },
- //Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key name was ER_PRIORITY_NOT_PARSABLE
- // In latest Xalan code base key name is ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care
- //in locale specific files like XSLTErrorResources_de.java, XSLTErrorResources_fr.java etc.
- //NOTE: Not only the key name but message has also been changed.
- { ER_VALUE_SHOULD_BE_NUMBER,
- "Value for {0} should contain a parsable number"},
+ { ER_OUTPUT_PROPERTY_NOT_RECOGNIZED,
+ "Output property not recognized: {0}" },
- { ER_VALUE_SHOULD_EQUAL,
- "Value for {0} should equal yes or no"},
+ { ER_FAILED_CREATING_ELEMLITRSLT,
+ "Failed creating ElemLiteralResult instance" },
- { ER_FAILED_CALLING_METHOD,
- "Failed calling {0} method"},
+ // Earlier (JDK 1.4 XALAN 2.2-D11) at key code '204' the key
+ // name was ER_PRIORITY_NOT_PARSABLE
+ // In latest Xalan code base key name is
+ // ER_VALUE_SHOULD_BE_NUMBER. This should also be taken care
+ // in locale specific files like XSLTErrorResources_de.java,
+ // XSLTErrorResources_fr.java etc.
+ // NOTE: Not only the key name but message has also been
+ // changed.
+ { ER_VALUE_SHOULD_BE_NUMBER,
+ "Value for {0} should contain a parsable number" },
- { ER_FAILED_CREATING_ELEMTMPL,
- "Failed creating ElemTemplateElement instance"},
+ { ER_VALUE_SHOULD_EQUAL, "Value for {0} should equal yes or no" },
- { ER_CHARS_NOT_ALLOWED,
- "Characters are not allowed at this point in the document"},
+ { ER_FAILED_CALLING_METHOD, "Failed calling {0} method" },
- { ER_ATTR_NOT_ALLOWED,
- "\"{0}\" attribute is not allowed on the {1} element!"},
+ { ER_FAILED_CREATING_ELEMTMPL,
+ "Failed creating ElemTemplateElement instance" },
- { ER_BAD_VALUE,
- "{0} bad value {1} "},
+ { ER_CHARS_NOT_ALLOWED,
+ "Characters are not allowed at this point in the document" },
- { ER_ATTRIB_VALUE_NOT_FOUND,
- "{0} attribute value not found "},
+ { ER_ATTR_NOT_ALLOWED,
+ "\"{0}\" attribute is not allowed on the {1} element!" },
- { ER_ATTRIB_VALUE_NOT_RECOGNIZED,
- "{0} attribute value not recognized "},
+ { ER_BAD_VALUE, "{0} bad value {1} " },
- { ER_NULL_URI_NAMESPACE,
- "Attempting to generate a namespace prefix with a null URI"},
+ { ER_ATTRIB_VALUE_NOT_FOUND, "{0} attribute value not found " },
- { ER_NUMBER_TOO_BIG,
- "Attempting to format a number bigger than the largest Long integer"},
+ { ER_ATTRIB_VALUE_NOT_RECOGNIZED,
+ "{0} attribute value not recognized " },
- { ER_CANNOT_FIND_SAX1_DRIVER,
- "Cannot find SAX1 driver class {0}"},
+ { ER_NULL_URI_NAMESPACE,
+ "Attempting to generate a namespace prefix with a null URI" },
- { ER_SAX1_DRIVER_NOT_LOADED,
- "SAX1 driver class {0} found but cannot be loaded"},
+ { ER_NUMBER_TOO_BIG,
+ "Attempting to format a number bigger than the largest Long integer" },
- { ER_SAX1_DRIVER_NOT_INSTANTIATED,
- "SAX1 driver class {0} loaded but cannot be instantiated"},
+ { ER_CANNOT_FIND_SAX1_DRIVER,
+ "Cannot find SAX1 driver class {0}" },
- { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER,
- "SAX1 driver class {0} does not implement org.xml.sax.Parser"},
+ { ER_SAX1_DRIVER_NOT_LOADED,
+ "SAX1 driver class {0} found but cannot be loaded" },
- { ER_PARSER_PROPERTY_NOT_SPECIFIED,
- "System property org.xml.sax.parser not specified"},
+ { ER_SAX1_DRIVER_NOT_INSTANTIATED,
+ "SAX1 driver class {0} loaded but cannot be instantiated" },
- { ER_PARSER_ARG_CANNOT_BE_NULL,
- "Parser argument must not be null"},
+ { ER_SAX1_DRIVER_NOT_IMPLEMENT_PARSER,
+ "SAX1 driver class {0} does not implement org.xml.sax.Parser" },
- { ER_FEATURE,
- "Feature: {0}"},
+ { ER_PARSER_PROPERTY_NOT_SPECIFIED,
+ "System property org.xml.sax.parser not specified" },
- { ER_PROPERTY,
- "Property: {0}"},
+ { ER_PARSER_ARG_CANNOT_BE_NULL,
+ "Parser argument must not be null" },
- { ER_NULL_ENTITY_RESOLVER,
- "Null entity resolver"},
+ { ER_FEATURE, "Feature: {0}" },
- { ER_NULL_DTD_HANDLER,
- "Null DTD handler"},
+ { ER_PROPERTY, "Property: {0}" },
- { ER_NO_DRIVER_NAME_SPECIFIED,
- "No Driver Name Specified!"},
+ { ER_NULL_ENTITY_RESOLVER, "Null entity resolver" },
- { ER_NO_URL_SPECIFIED,
- "No URL Specified!"},
+ { ER_NULL_DTD_HANDLER, "Null DTD handler" },
- { ER_POOLSIZE_LESS_THAN_ONE,
- "Pool size is less than 1!"},
+ { ER_NO_DRIVER_NAME_SPECIFIED, "No Driver Name Specified!" },
- { ER_INVALID_DRIVER_NAME,
- "Invalid Driver Name Specified!"},
+ { ER_NO_URL_SPECIFIED, "No URL Specified!" },
- { ER_ERRORLISTENER,
- "ErrorListener"},
+ { ER_POOLSIZE_LESS_THAN_ONE, "Pool size is less than 1!" },
+ { ER_INVALID_DRIVER_NAME, "Invalid Driver Name Specified!" },
-// Note to translators: The following message should not normally be displayed
-// to users. It describes a situation in which the processor has detected
-// an internal consistency problem in itself, and it provides this message
-// for the developer to help diagnose the problem. The name
-// 'ElemTemplateElement' is the name of a class, and should not be
-// translated.
- { ER_ASSERT_NO_TEMPLATE_PARENT,
- "Programmer's error! The expression has no ElemTemplateElement parent!"},
+ { ER_ERRORLISTENER, "ErrorListener" },
+ // Note to translators: The following message should not
+ // normally be displayed
+ // to users. It describes a situation in which the processor has
+ // detected
+ // an internal consistency problem in itself, and it provides
+ // this message
+ // for the developer to help diagnose the problem. The name
+ // 'ElemTemplateElement' is the name of a class, and should not
+ // be
+ // translated.
+ { ER_ASSERT_NO_TEMPLATE_PARENT,
+ "Programmer's error! The expression has no ElemTemplateElement parent!" },
-// Note to translators: The following message should not normally be displayed
-// to users. It describes a situation in which the processor has detected
-// an internal consistency problem in itself, and it provides this message
-// for the developer to help diagnose the problem. The substitution text
-// provides further information in order to diagnose the problem. The name
-// 'RedundentExprEliminator' is the name of a class, and should not be
-// translated.
- { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR,
- "Programmer''s assertion in RedundentExprEliminator: {0}"},
+ // Note to translators: The following message should not
+ // normally be displayed
+ // to users. It describes a situation in which the processor has
+ // detected
+ // an internal consistency problem in itself, and it provides
+ // this message
+ // for the developer to help diagnose the problem. The
+ // substitution text
+ // provides further information in order to diagnose the
+ // problem. The name
+ // 'RedundentExprEliminator' is the name of a class, and should
+ // not be
+ // translated.
+ { ER_ASSERT_REDUNDENT_EXPR_ELIMINATOR,
+ "Programmer''s assertion in RedundentExprEliminator: {0}" },
- { ER_NOT_ALLOWED_IN_POSITION,
- "{0} is not allowed in this position in the stylesheet!"},
+ { ER_NOT_ALLOWED_IN_POSITION,
+ "{0} is not allowed in this position in the stylesheet!" },
- { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION,
- "Non-whitespace text is not allowed in this position in the stylesheet!"},
+ { ER_NONWHITESPACE_NOT_ALLOWED_IN_POSITION,
+ "Non-whitespace text is not allowed in this position in the stylesheet!" },
- // This code is shared with warning codes.
- // SystemId Unknown
- { INVALID_TCHAR,
- "Illegal value: {1} used for CHAR attribute: {0}. An attribute of type CHAR must be only 1 character!"},
+ // This code is shared with warning codes.
+ // SystemId Unknown
+ {
+ INVALID_TCHAR,
+ "Illegal value: {1} used for CHAR attribute: {0}. An attribute of type CHAR must be only 1 character!" },
- // Note to translators: The following message is used if the value of
- // an attribute in a stylesheet is invalid. "QNAME" is the XML data-type of
- // the attribute, and should not be translated. The substitution text {1} is
- // the attribute value and {0} is the attribute name.
- //The following codes are shared with the warning codes...
- { INVALID_QNAME,
- "Illegal value: {1} used for QNAME attribute: {0}"},
+ // Note to translators: The following message is used if the
+ // value of
+ // an attribute in a stylesheet is invalid. "QNAME" is the XML
+ // data-type of
+ // the attribute, and should not be translated. The substitution
+ // text {1} is
+ // the attribute value and {0} is the attribute name.
+ // The following codes are shared with the warning codes...
+ { INVALID_QNAME,
+ "Illegal value: {1} used for QNAME attribute: {0}" },
- // Note to translators: The following message is used if the value of
- // an attribute in a stylesheet is invalid. "ENUM" is the XML data-type of
- // the attribute, and should not be translated. The substitution text {1} is
- // the attribute value, {0} is the attribute name, and {2} is a list of valid
- // values.
- { INVALID_ENUM,
- "Illegal value: {1} used for ENUM attribute: {0}. Valid values are: {2}."},
+ // Note to translators: The following message is used if the
+ // value of
+ // an attribute in a stylesheet is invalid. "ENUM" is the XML
+ // data-type of
+ // the attribute, and should not be translated. The substitution
+ // text {1} is
+ // the attribute value, {0} is the attribute name, and {2} is a
+ // list of valid
+ // values.
+ { INVALID_ENUM,
+ "Illegal value: {1} used for ENUM attribute: {0}. Valid values are: {2}." },
-// Note to translators: The following message is used if the value of
-// an attribute in a stylesheet is invalid. "NMTOKEN" is the XML data-type
-// of the attribute, and should not be translated. The substitution text {1} is
-// the attribute value and {0} is the attribute name.
- { INVALID_NMTOKEN,
- "Illegal value: {1} used for NMTOKEN attribute: {0} "},
+ // Note to translators: The following message is used if the
+ // value of
+ // an attribute in a stylesheet is invalid. "NMTOKEN" is the XML
+ // data-type
+ // of the attribute, and should not be translated. The
+ // substitution text {1} is
+ // the attribute value and {0} is the attribute name.
+ { INVALID_NMTOKEN,
+ "Illegal value: {1} used for NMTOKEN attribute: {0} " },
-// Note to translators: The following message is used if the value of
-// an attribute in a stylesheet is invalid. "NCNAME" is the XML data-type
-// of the attribute, and should not be translated. The substitution text {1} is
-// the attribute value and {0} is the attribute name.
- { INVALID_NCNAME,
- "Illegal value: {1} used for NCNAME attribute: {0} "},
+ // Note to translators: The following message is used if the
+ // value of
+ // an attribute in a stylesheet is invalid. "NCNAME" is the XML
+ // data-type
+ // of the attribute, and should not be translated. The
+ // substitution text {1} is
+ // the attribute value and {0} is the attribute name.
+ { INVALID_NCNAME,
+ "Illegal value: {1} used for NCNAME attribute: {0} " },
-// Note to translators: The following message is used if the value of
-// an attribute in a stylesheet is invalid. "boolean" is the XSLT data-type
-// of the attribute, and should not be translated. The substitution text {1} is
-// the attribute value and {0} is the attribute name.
- { INVALID_BOOLEAN,
- "Illegal value: {1} used for boolean attribute: {0} "},
+ // Note to translators: The following message is used if the
+ // value of
+ // an attribute in a stylesheet is invalid. "boolean" is the
+ // XSLT data-type
+ // of the attribute, and should not be translated. The
+ // substitution text {1} is
+ // the attribute value and {0} is the attribute name.
+ { INVALID_BOOLEAN,
+ "Illegal value: {1} used for boolean attribute: {0} " },
-// Note to translators: The following message is used if the value of
-// an attribute in a stylesheet is invalid. "number" is the XSLT data-type
-// of the attribute, and should not be translated. The substitution text {1} is
-// the attribute value and {0} is the attribute name.
- { INVALID_NUMBER,
- "Illegal value: {1} used for number attribute: {0} "},
+ // Note to translators: The following message is used if the
+ // value of
+ // an attribute in a stylesheet is invalid. "number" is the XSLT
+ // data-type
+ // of the attribute, and should not be translated. The
+ // substitution text {1} is
+ // the attribute value and {0} is the attribute name.
+ { INVALID_NUMBER,
+ "Illegal value: {1} used for number attribute: {0} " },
+ // End of shared codes...
- // End of shared codes...
+ // Note to translators: A "match pattern" is a special form of
+ // XPath expression
+ // that is used for matching patterns. The substitution text is
+ // the name of
+ // a function. The message indicates that when this function is
+ // referenced in
+ // a match pattern, its argument must be a string literal (or
+ // constant.)
+ // ER_ARG_LITERAL - new error message for bugzilla //5202
+ { ER_ARG_LITERAL,
+ "Argument to {0} in match pattern must be a literal." },
-// Note to translators: A "match pattern" is a special form of XPath expression
-// that is used for matching patterns. The substitution text is the name of
-// a function. The message indicates that when this function is referenced in
-// a match pattern, its argument must be a string literal (or constant.)
-// ER_ARG_LITERAL - new error message for bugzilla //5202
- { ER_ARG_LITERAL,
- "Argument to {0} in match pattern must be a literal."},
+ // Note to translators: The following message indicates that two
+ // definitions of
+ // a variable. A "global variable" is a variable that is
+ // accessible everywher
+ // in the stylesheet.
+ // ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790
+ { ER_DUPLICATE_GLOBAL_VAR,
+ "Duplicate global variable declaration." },
-// Note to translators: The following message indicates that two definitions of
-// a variable. A "global variable" is a variable that is accessible everywher
-// in the stylesheet.
-// ER_DUPLICATE_GLOBAL_VAR - new error message for bugzilla #790
- { ER_DUPLICATE_GLOBAL_VAR,
- "Duplicate global variable declaration."},
+ // Note to translators: The following message indicates that two
+ // definitions of
+ // a variable were encountered.
+ // ER_DUPLICATE_VAR - new error message for bugzilla #790
+ { ER_DUPLICATE_VAR, "Duplicate variable declaration." },
+ // Note to translators: "xsl:template, "name" and "match" are
+ // XSLT keywords
+ // which must not be translated.
+ // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789
+ { ER_TEMPLATE_NAME_MATCH,
+ "xsl:template must have a name or match attribute (or both)" },
-// Note to translators: The following message indicates that two definitions of
-// a variable were encountered.
-// ER_DUPLICATE_VAR - new error message for bugzilla #790
- { ER_DUPLICATE_VAR,
- "Duplicate variable declaration."},
+ // Note to translators: "exclude-result-prefixes" is an XSLT
+ // keyword which
+ // should not be translated. The message indicates that a
+ // namespace prefix
+ // encountered as part of the value of the
+ // exclude-result-prefixes attribute
+ // was in error.
+ // ER_INVALID_PREFIX - new error message for bugzilla #788
+ { ER_INVALID_PREFIX,
+ "Prefix in exclude-result-prefixes is not valid: {0}" },
- // Note to translators: "xsl:template, "name" and "match" are XSLT keywords
- // which must not be translated.
- // ER_TEMPLATE_NAME_MATCH - new error message for bugzilla #789
- { ER_TEMPLATE_NAME_MATCH,
- "xsl:template must have a name or match attribute (or both)"},
+ // Note to translators: An "attribute set" is a set of
+ // attributes that can
+ // be added to an element in the output document as a group. The
+ // message
+ // indicates that there was a reference to an attribute set
+ // named {0} that
+ // was never defined.
+ // ER_NO_ATTRIB_SET - new error message for bugzilla #782
+ { ER_NO_ATTRIB_SET, "attribute-set named {0} does not exist" },
- // Note to translators: "exclude-result-prefixes" is an XSLT keyword which
- // should not be translated. The message indicates that a namespace prefix
- // encountered as part of the value of the exclude-result-prefixes attribute
- // was in error.
- // ER_INVALID_PREFIX - new error message for bugzilla #788
- { ER_INVALID_PREFIX,
- "Prefix in exclude-result-prefixes is not valid: {0}"},
+ // Note to translators: This message indicates that there was a
+ // reference
+ // to a function named {0} for which no function definition
+ // could be found.
+ { ER_FUNCTION_NOT_FOUND,
+ "The function named {0} does not exist" },
- // Note to translators: An "attribute set" is a set of attributes that can
- // be added to an element in the output document as a group. The message
- // indicates that there was a reference to an attribute set named {0} that
- // was never defined.
- // ER_NO_ATTRIB_SET - new error message for bugzilla #782
- { ER_NO_ATTRIB_SET,
- "attribute-set named {0} does not exist"},
-
- // Note to translators: This message indicates that there was a reference
- // to a function named {0} for which no function definition could be found.
- { ER_FUNCTION_NOT_FOUND,
- "The function named {0} does not exist"},
+ // Note to translators: This message indicates that the XSLT
+ // instruction
+ // that is named by the substitution text {0} must not contain
+ // other XSLT
+ // instructions (content) or a "select" attribute. The word
+ // "select" is
+ // an XSLT keyword in this case and must not be translated.
+ { ER_CANT_HAVE_CONTENT_AND_SELECT,
+ "The {0} element must not have both content and a select attribute." },
- // Note to translators: This message indicates that the XSLT instruction
- // that is named by the substitution text {0} must not contain other XSLT
- // instructions (content) or a "select" attribute. The word "select" is
- // an XSLT keyword in this case and must not be translated.
- { ER_CANT_HAVE_CONTENT_AND_SELECT,
- "The {0} element must not have both content and a select attribute."},
+ // Note to translators: This message indicates that the value
+ // argument
+ // of setParameter must be a valid Java Object.
+ { ER_INVALID_SET_PARAM_VALUE,
+ "The value of param {0} must be a valid Java Object" },
- // Note to translators: This message indicates that the value argument
- // of setParameter must be a valid Java Object.
- { ER_INVALID_SET_PARAM_VALUE,
- "The value of param {0} must be a valid Java Object"},
+ {
+ ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT,
+ "The result-prefix attribute of an xsl:namespace-alias element has the value '#default', but there is no declaration of the default namespace in scope for the element" },
- { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX_FOR_DEFAULT,
- "The result-prefix attribute of an xsl:namespace-alias element has the value '#default', but there is no declaration of the default namespace in scope for the element"},
+ {
+ ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX,
+ "The result-prefix attribute of an xsl:namespace-alias element has the value ''{0}'', but there is no namespace declaration for the prefix ''{0}'' in scope for the element." },
- { ER_INVALID_NAMESPACE_URI_VALUE_FOR_RESULT_PREFIX,
- "The result-prefix attribute of an xsl:namespace-alias element has the value ''{0}'', but there is no namespace declaration for the prefix ''{0}'' in scope for the element."},
+ {
+ ER_SET_FEATURE_NULL_NAME,
+ "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)." },
- { ER_SET_FEATURE_NULL_NAME,
- "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)."},
-
- { ER_GET_FEATURE_NULL_NAME,
- "The feature name cannot be null in TransformerFactory.getFeature(String name)."},
-
- { ER_UNSUPPORTED_FEATURE,
- "Cannot set the feature ''{0}'' on this TransformerFactory."},
-
- { ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING,
- "Use of the extension element ''{0}'' is not allowed when the secure processing feature is set to true."},
-
- { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE,
- "Cannot get the prefix for a null namespace uri."},
+ {
+ ER_GET_FEATURE_NULL_NAME,
+ "The feature name cannot be null in TransformerFactory.getFeature(String name)." },
- { ER_NAMESPACE_CONTEXT_NULL_PREFIX,
- "Cannot get the namespace uri for null prefix."},
+ { ER_UNSUPPORTED_FEATURE,
+ "Cannot set the feature ''{0}'' on this TransformerFactory." },
- { ER_XPATH_RESOLVER_NULL_QNAME,
- "The function name cannot be null."},
+ {
+ ER_EXTENSION_ELEMENT_NOT_ALLOWED_IN_SECURE_PROCESSING,
+ "Use of the extension element ''{0}'' is not allowed when the secure processing feature is set to true." },
- { ER_XPATH_RESOLVER_NEGATIVE_ARITY,
- "The arity cannot be negative."},
- // Warnings...
+ { ER_NAMESPACE_CONTEXT_NULL_NAMESPACE,
+ "Cannot get the prefix for a null namespace uri." },
- { WG_FOUND_CURLYBRACE,
- "Found '}' but no attribute template open!"},
+ { ER_NAMESPACE_CONTEXT_NULL_PREFIX,
+ "Cannot get the namespace uri for null prefix." },
- { WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR,
- "Warning: count attribute does not match an ancestor in xsl:number! Target = {0}"},
+ { ER_XPATH_RESOLVER_NULL_QNAME,
+ "The function name cannot be null." },
- { WG_EXPR_ATTRIB_CHANGED_TO_SELECT,
- "Old syntax: The name of the 'expr' attribute has been changed to 'select'."},
+ { ER_XPATH_RESOLVER_NEGATIVE_ARITY,
+ "The arity cannot be negative." },
+ // Warnings...
- { WG_NO_LOCALE_IN_FORMATNUMBER,
- "Xalan doesn't yet handle the locale name in the format-number function."},
+ { WG_FOUND_CURLYBRACE,
+ "Found '}' but no attribute template open!" },
- { WG_LOCALE_NOT_FOUND,
- "Warning: Could not find locale for xml:lang={0}"},
+ {
+ WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR,
+ "Warning: count attribute does not match an ancestor in xsl:number! Target = {0}" },
- { WG_CANNOT_MAKE_URL_FROM,
- "Can not make URL from: {0}"},
+ { WG_EXPR_ATTRIB_CHANGED_TO_SELECT,
+ "Old syntax: The name of the 'expr' attribute has been changed to 'select'." },
- { WG_CANNOT_LOAD_REQUESTED_DOC,
- "Can not load requested doc: {0}"},
+ { WG_NO_LOCALE_IN_FORMATNUMBER,
+ "Xalan doesn't yet handle the locale name in the format-number function." },
- { WG_CANNOT_FIND_COLLATOR,
- "Could not find Collator for <sort xml:lang={0}"},
+ { WG_LOCALE_NOT_FOUND,
+ "Warning: Could not find locale for xml:lang={0}" },
- { WG_FUNCTIONS_SHOULD_USE_URL,
- "Old syntax: the functions instruction should use a url of {0}"},
+ { WG_CANNOT_MAKE_URL_FROM, "Can not make URL from: {0}" },
- { WG_ENCODING_NOT_SUPPORTED_USING_UTF8,
- "encoding not supported: {0}, using UTF-8"},
+ { WG_CANNOT_LOAD_REQUESTED_DOC,
+ "Can not load requested doc: {0}" },
- { WG_ENCODING_NOT_SUPPORTED_USING_JAVA,
- "encoding not supported: {0}, using Java {1}"},
+ { WG_CANNOT_FIND_COLLATOR,
+ "Could not find Collator for <sort xml:lang={0}" },
- { WG_SPECIFICITY_CONFLICTS,
- "Specificity conflicts found: {0} Last found in stylesheet will be used."},
+ { WG_FUNCTIONS_SHOULD_USE_URL,
+ "Old syntax: the functions instruction should use a url of {0}" },
- { WG_PARSING_AND_PREPARING,
- "========= Parsing and preparing {0} =========="},
+ { WG_ENCODING_NOT_SUPPORTED_USING_UTF8,
+ "encoding not supported: {0}, using UTF-8" },
- { WG_ATTR_TEMPLATE,
- "Attr Template, {0}"},
+ { WG_ENCODING_NOT_SUPPORTED_USING_JAVA,
+ "encoding not supported: {0}, using Java {1}" },
- { WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE,
- "Match conflict between xsl:strip-space and xsl:preserve-space"},
+ { WG_SPECIFICITY_CONFLICTS,
+ "Specificity conflicts found: {0} Last found in stylesheet will be used." },
- { WG_ATTRIB_NOT_HANDLED,
- "Xalan does not yet handle the {0} attribute!"},
+ { WG_PARSING_AND_PREPARING,
+ "========= Parsing and preparing {0} ==========" },
- { WG_NO_DECIMALFORMAT_DECLARATION,
- "No declaration found for decimal format: {0}"},
+ { WG_ATTR_TEMPLATE, "Attr Template, {0}" },
- { WG_OLD_XSLT_NS,
- "Missing or incorrect XSLT Namespace. "},
+ { WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE,
+ "Match conflict between xsl:strip-space and xsl:preserve-space" },
- { WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED,
- "Only one default xsl:decimal-format declaration is allowed."},
+ { WG_ATTRIB_NOT_HANDLED,
+ "Xalan does not yet handle the {0} attribute!" },
- { WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE,
- "xsl:decimal-format names must be unique. Name \"{0}\" has been duplicated."},
+ { WG_NO_DECIMALFORMAT_DECLARATION,
+ "No declaration found for decimal format: {0}" },
- { WG_ILLEGAL_ATTRIBUTE,
- "{0} has an illegal attribute: {1}"},
+ { WG_OLD_XSLT_NS, "Missing or incorrect XSLT Namespace. " },
- { WG_COULD_NOT_RESOLVE_PREFIX,
- "Could not resolve namespace prefix: {0}. The node will be ignored."},
+ { WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED,
+ "Only one default xsl:decimal-format declaration is allowed." },
- { WG_STYLESHEET_REQUIRES_VERSION_ATTRIB,
- "xsl:stylesheet requires a 'version' attribute!"},
+ { WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE,
+ "xsl:decimal-format names must be unique. Name \"{0}\" has been duplicated." },
- { WG_ILLEGAL_ATTRIBUTE_NAME,
- "Illegal attribute name: {0}"},
+ { WG_ILLEGAL_ATTRIBUTE, "{0} has an illegal attribute: {1}" },
- { WG_ILLEGAL_ATTRIBUTE_VALUE,
- "Illegal value used for attribute {0}: {1}"},
+ { WG_COULD_NOT_RESOLVE_PREFIX,
+ "Could not resolve namespace prefix: {0}. The node will be ignored." },
- { WG_EMPTY_SECOND_ARG,
- "Resulting nodeset from second argument of document function is empty. Return an empty node-set."},
+ { WG_STYLESHEET_REQUIRES_VERSION_ATTRIB,
+ "xsl:stylesheet requires a 'version' attribute!" },
- //Following are the new WARNING keys added in XALAN code base after Jdk 1.4 (Xalan 2.2-D11)
+ { WG_ILLEGAL_ATTRIBUTE_NAME, "Illegal attribute name: {0}" },
- // Note to translators: "name" and "xsl:processing-instruction" are keywords
- // and must not be translated.
- { WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
- "The value of the 'name' attribute of xsl:processing-instruction name must not be 'xml'"},
+ { WG_ILLEGAL_ATTRIBUTE_VALUE,
+ "Illegal value used for attribute {0}: {1}" },
- // Note to translators: "name" and "xsl:processing-instruction" are keywords
- // and must not be translated. "NCName" is an XML data-type and must not be
- // translated.
- { WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
- "The value of the ''name'' attribute of xsl:processing-instruction must be a valid NCName: {0}"},
+ {
+ WG_EMPTY_SECOND_ARG,
+ "Resulting nodeset from second argument of document function is empty. Return an empty node-set." },
- // Note to translators: This message is reported if the stylesheet that is
- // being processed attempted to construct an XML document with an attribute in a
- // place other than on an element. The substitution text specifies the name of
- // the attribute.
- { WG_ILLEGAL_ATTRIBUTE_POSITION,
- "Cannot add attribute {0} after child nodes or before an element is produced. Attribute will be ignored."},
+ // Following are the new WARNING keys added in XALAN code base
+ // after Jdk 1.4 (Xalan 2.2-D11)
- { NO_MODIFICATION_ALLOWED_ERR,
- "An attempt is made to modify an object where modifications are not allowed."
- },
+ // Note to translators: "name" and "xsl:processing-instruction"
+ // are keywords
+ // and must not be translated.
+ {
+ WG_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML,
+ "The value of the 'name' attribute of xsl:processing-instruction name must not be 'xml'" },
- //Check: WHY THERE IS A GAP B/W NUMBERS in the XSLTErrorResources properties file?
+ // Note to translators: "name" and "xsl:processing-instruction"
+ // are keywords
+ // and must not be translated. "NCName" is an XML data-type and
+ // must not be
+ // translated.
+ {
+ WG_PROCESSINGINSTRUCTION_NOTVALID_NCNAME,
+ "The value of the ''name'' attribute of xsl:processing-instruction must be a valid NCName: {0}" },
- // Other miscellaneous text used inside the code...
- { "ui_language", "en"},
- { "help_language", "en" },
- { "language", "en" },
- { "BAD_CODE", "Parameter to createMessage was out of bounds"},
- { "FORMAT_FAILED", "Exception thrown during messageFormat call"},
- { "version", ">>>>>>> Xalan Version "},
- { "version2", "<<<<<<<"},
- { "yes", "yes"},
- { "line", "Line #"},
- { "column","Column #"},
- { "xsldone", "XSLProcessor: done"},
+ // Note to translators: This message is reported if the
+ // stylesheet that is
+ // being processed attempted to construct an XML document with
+ // an attribute in a
+ // place other than on an element. The substitution text
+ // specifies the name of
+ // the attribute.
+ {
+ WG_ILLEGAL_ATTRIBUTE_POSITION,
+ "Cannot add attribute {0} after child nodes or before an element is produced. Attribute will be ignored." },
+ { NO_MODIFICATION_ALLOWED_ERR,
+ "An attempt is made to modify an object where modifications are not allowed." },
- // Note to translators: The following messages provide usage information
- // for the Xalan Process command line. "Process" is the name of a Java class,
- // and should not be translated.
- { "xslProc_option", "Xalan-J command line Process class options:"},
- { "xslProc_option", "Xalan-J command line Process class options\u003a"},
- { "xslProc_invalid_xsltc_option", "The option {0} is not supported in XSLTC mode."},
- { "xslProc_invalid_xalan_option", "The option {0} can only be used with -XSLTC."},
- { "xslProc_no_input", "Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions."},
- { "xslProc_common_options", "-Common Options-"},
- { "xslProc_xalan_options", "-Options for Xalan-"},
- { "xslProc_xsltc_options", "-Options for XSLTC-"},
- { "xslProc_return_to_continue", "(press <return> to continue)"},
+ // Check: WHY THERE IS A GAP B/W NUMBERS in the
+ // XSLTErrorResources properties file?
- // Note to translators: The option name and the parameter name do not need to
- // be translated. Only translate the messages in parentheses. Note also that
- // leading whitespace in the messages is used to indent the usage information
- // for each option in the English messages.
- // Do not translate the keywords: XSLTC, SAX, DOM and DTM.
- { "optionXSLTC", " [-XSLTC (use XSLTC for transformation)]"},
- { "optionIN", " [-IN inputXMLURL]"},
- { "optionXSL", " [-XSL XSLTransformationURL]"},
- { "optionOUT", " [-OUT outputFileName]"},
- { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]"},
- { "optionLXCOUT", " [-LXCOUT compiledStylesheetFileNameOutOut]"},
- { "optionPARSER", " [-PARSER fully qualified class name of parser liaison]"},
- { "optionE", " [-E (Do not expand entity refs)]"},
- { "optionV", " [-E (Do not expand entity refs)]"},
- { "optionQC", " [-QC (Quiet Pattern Conflicts Warnings)]"},
- { "optionQ", " [-Q (Quiet Mode)]"},
- { "optionLF", " [-LF (Use linefeeds only on output {default is CR/LF})]"},
- { "optionCR", " [-CR (Use carriage returns only on output {default is CR/LF})]"},
- { "optionESCAPE", " [-ESCAPE (Which characters to escape {default is <>&\"\'\\r\\n}]"},
- { "optionINDENT", " [-INDENT (Control how many spaces to indent {default is 0})]"},
- { "optionTT", " [-TT (Trace the templates as they are being called.)]"},
- { "optionTG", " [-TG (Trace each generation event.)]"},
- { "optionTS", " [-TS (Trace each selection event.)]"},
- { "optionTTC", " [-TTC (Trace the template children as they are being processed.)]"},
- { "optionTCLASS", " [-TCLASS (TraceListener class for trace extensions.)]"},
- { "optionVALIDATE", " [-VALIDATE (Set whether validation occurs. Validation is off by default.)]"},
- { "optionEDUMP", " [-EDUMP {optional filename} (Do stackdump on error.)]"},
- { "optionXML", " [-XML (Use XML formatter and add XML header.)]"},
- { "optionTEXT", " [-TEXT (Use simple Text formatter.)]"},
- { "optionHTML", " [-HTML (Use HTML formatter.)]"},
- { "optionPARAM", " [-PARAM name expression (Set a stylesheet parameter)]"},
- { "noParsermsg1", "XSL Process was not successful."},
- { "noParsermsg2", "** Could not find parser **"},
- { "noParsermsg3", "Please check your classpath."},
- { "noParsermsg4", "If you don't have IBM's XML Parser for Java, you can download it from"},
- { "noParsermsg5", "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml"},
- { "optionURIRESOLVER", " [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]"},
- { "optionENTITYRESOLVER", " [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]"},
- { "optionCONTENTHANDLER", " [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]"},
- { "optionLINENUMBERS", " [-L use line numbers for source document]"},
- { "optionSECUREPROCESSING", " [-SECURE (set the secure processing feature to true.)]"},
+ // Other miscellaneous text used inside the code...
+ { "ui_language", "en" },
+ { "help_language", "en" },
+ { "language", "en" },
+ { "BAD_CODE", "Parameter to createMessage was out of bounds" },
+ { "FORMAT_FAILED", "Exception thrown during messageFormat call" },
+ { "version", ">>>>>>> Xalan Version " },
+ { "version2", "<<<<<<<" },
+ { "yes", "yes" },
+ { "line", "Line #" },
+ { "column", "Column #" },
+ { "xsldone", "XSLProcessor: done" },
- // Following are the new options added in XSLTErrorResources.properties files after Jdk 1.4 (Xalan 2.2-D11)
+ // Note to translators: The following messages provide usage
+ // information
+ // for the Xalan Process command line. "Process" is the name of
+ // a Java class,
+ // and should not be translated.
+ { "xslProc_option",
+ "Xalan-J command line Process class options:" },
+ { "xslProc_option",
+ "Xalan-J command line Process class options\u003a" },
+ { "xslProc_invalid_xsltc_option",
+ "The option {0} is not supported in XSLTC mode." },
+ { "xslProc_invalid_xalan_option",
+ "The option {0} can only be used with -XSLTC." },
+ {
+ "xslProc_no_input",
+ "Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions." },
+ { "xslProc_common_options", "-Common Options-" },
+ { "xslProc_xalan_options", "-Options for Xalan-" },
+ { "xslProc_xsltc_options", "-Options for XSLTC-" },
+ { "xslProc_return_to_continue", "(press <return> to continue)" },
+ // Note to translators: The option name and the parameter name
+ // do not need to
+ // be translated. Only translate the messages in parentheses.
+ // Note also that
+ // leading whitespace in the messages is used to indent the
+ // usage information
+ // for each option in the English messages.
+ // Do not translate the keywords: XSLTC, SAX, DOM and DTM.
+ { "optionXSLTC", " [-XSLTC (use XSLTC for transformation)]" },
+ { "optionIN", " [-IN inputXMLURL]" },
+ { "optionXSL", " [-XSL XSLTransformationURL]" },
+ { "optionOUT", " [-OUT outputFileName]" },
+ { "optionLXCIN", " [-LXCIN compiledStylesheetFileNameIn]" },
+ { "optionLXCOUT",
+ " [-LXCOUT compiledStylesheetFileNameOutOut]" },
+ { "optionPARSER",
+ " [-PARSER fully qualified class name of parser liaison]" },
+ { "optionE", " [-E (Do not expand entity refs)]" },
+ { "optionV", " [-E (Do not expand entity refs)]" },
+ { "optionQC", " [-QC (Quiet Pattern Conflicts Warnings)]" },
+ { "optionQ", " [-Q (Quiet Mode)]" },
+ { "optionLF",
+ " [-LF (Use linefeeds only on output {default is CR/LF})]" },
+ { "optionCR",
+ " [-CR (Use carriage returns only on output {default is CR/LF})]" },
+ { "optionESCAPE",
+ " [-ESCAPE (Which characters to escape {default is <>&\"\'\\r\\n}]" },
+ { "optionINDENT",
+ " [-INDENT (Control how many spaces to indent {default is 0})]" },
+ { "optionTT",
+ " [-TT (Trace the templates as they are being called.)]" },
+ { "optionTG", " [-TG (Trace each generation event.)]" },
+ { "optionTS", " [-TS (Trace each selection event.)]" },
+ { "optionTTC",
+ " [-TTC (Trace the template children as they are being processed.)]" },
+ { "optionTCLASS",
+ " [-TCLASS (TraceListener class for trace extensions.)]" },
+ {
+ "optionVALIDATE",
+ " [-VALIDATE (Set whether validation occurs. Validation is off by default.)]" },
+ { "optionEDUMP",
+ " [-EDUMP {optional filename} (Do stackdump on error.)]" },
+ { "optionXML",
+ " [-XML (Use XML formatter and add XML header.)]" },
+ { "optionTEXT", " [-TEXT (Use simple Text formatter.)]" },
+ { "optionHTML", " [-HTML (Use HTML formatter.)]" },
+ { "optionPARAM",
+ " [-PARAM name expression (Set a stylesheet parameter)]" },
+ { "noParsermsg1", "XSL Process was not successful." },
+ { "noParsermsg2", "** Could not find parser **" },
+ { "noParsermsg3", "Please check your classpath." },
+ { "noParsermsg4",
+ "If you don't have IBM's XML Parser for Java, you can download it from" },
+ { "noParsermsg5",
+ "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml" },
+ { "optionURIRESOLVER",
+ " [-URIRESOLVER full class name (URIResolver to be used to resolve URIs)]" },
+ {
+ "optionENTITYRESOLVER",
+ " [-ENTITYRESOLVER full class name (EntityResolver to be used to resolve entities)]" },
+ {
+ "optionCONTENTHANDLER",
+ " [-CONTENTHANDLER full class name (ContentHandler to be used to serialize output)]" },
+ { "optionLINENUMBERS",
+ " [-L use line numbers for source document]" },
+ { "optionSECUREPROCESSING",
+ " [-SECURE (set the secure processing feature to true.)]" },
- { "optionMEDIA", " [-MEDIA mediaType (use media attribute to find stylesheet associated with a document.)]"},
- { "optionFLAVOR", " [-FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform.)] "}, // Added by sboag/scurcuru; experimental
- { "optionDIAG", " [-DIAG (Print overall milliseconds transform took.)]"},
- { "optionINCREMENTAL", " [-INCREMENTAL (request incremental DTM construction by setting http://xml.apache.org/xalan/features/incremental true.)]"},
- { "optionNOOPTIMIMIZE", " [-NOOPTIMIMIZE (request no stylesheet optimization processing by setting http://xml.apache.org/xalan/features/optimize false.)]"},
- { "optionRL", " [-RL recursionlimit (assert numeric limit on stylesheet recursion depth.)]"},
- { "optionXO", " [-XO [transletName] (assign the name to the generated translet)]"},
- { "optionXD", " [-XD destinationDirectory (specify a destination directory for translet)]"},
- { "optionXJ", " [-XJ jarfile (packages translet classes into a jar file of name <jarfile>)]"},
- { "optionXP", " [-XP package (specifies a package name prefix for all generated translet classes)]"},
+ // Following are the new options added in
+ // XSLTErrorResources.properties files after Jdk 1.4 (Xalan
+ // 2.2-D11)
- //AddITIONAL STRINGS that need L10n
- // Note to translators: The following message describes usage of a particular
- // command-line option that is used to enable the "template inlining"
- // optimization. The optimization involves making a copy of the code
- // generated for a template in another template that refers to it.
- { "optionXN", " [-XN (enables template inlining)]" },
- { "optionXX", " [-XX (turns on additional debugging message output)]"},
- { "optionXT" , " [-XT (use translet to transform if possible)]"},
- { "diagTiming"," --------- Transform of {0} via {1} took {2} ms" },
- { "recursionTooDeep","Template nesting too deep. nesting = {0}, template {1} {2}" },
- { "nameIs", "name is" },
- { "matchPatternIs", "match pattern is" }
+ {
+ "optionMEDIA",
+ " [-MEDIA mediaType (use media attribute to find stylesheet associated with a document.)]" },
+ { "optionFLAVOR",
+ " [-FLAVOR flavorName (Explicitly use s2s=SAX or d2d=DOM to do transform.)] " }, // Added
+ // by
+ // sboag/scurcuru;
+ // experimental
+ { "optionDIAG",
+ " [-DIAG (Print overall milliseconds transform took.)]" },
+ {
+ "optionINCREMENTAL",
+ " [-INCREMENTAL (request incremental DTM construction by setting http://xml.apache.org/xalan/features/incremental true.)]" },
+ {
+ "optionNOOPTIMIMIZE",
+ " [-NOOPTIMIMIZE (request no stylesheet optimization processing by setting http://xml.apache.org/xalan/features/optimize false.)]" },
+ { "optionRL",
+ " [-RL recursionlimit (assert numeric limit on stylesheet recursion depth.)]" },
+ { "optionXO",
+ " [-XO [transletName] (assign the name to the generated translet)]" },
+ { "optionXD",
+ " [-XD destinationDirectory (specify a destination directory for translet)]" },
+ {
+ "optionXJ",
+ " [-XJ jarfile (packages translet classes into a jar file of name <jarfile>)]" },
+ {
+ "optionXP",
+ " [-XP package (specifies a package name prefix for all generated translet classes)]" },
- };
- }
- // ================= INFRASTRUCTURE ======================
+ // AddITIONAL STRINGS that need L10n
+ // Note to translators: The following message describes usage of
+ // a particular
+ // command-line option that is used to enable the "template
+ // inlining"
+ // optimization. The optimization involves making a copy of the
+ // code
+ // generated for a template in another template that refers to
+ // it.
+ { "optionXN", " [-XN (enables template inlining)]" },
+ { "optionXX",
+ " [-XX (turns on additional debugging message output)]" },
+ { "optionXT",
+ " [-XT (use translet to transform if possible)]" },
+ { "diagTiming",
+ " --------- Transform of {0} via {1} took {2} ms" },
+ { "recursionTooDeep",
+ "Template nesting too deep. nesting = {0}, template {1} {2}" },
+ { "nameIs", "name is" },
+ { "matchPatternIs", "match pattern is" }
- /** String for use when a bad error code was encountered. */
- public static final String BAD_CODE = "BAD_CODE";
+ };
+ }
- /** String for use when formatting of the error string failed. */
- public static final String FORMAT_FAILED = "FORMAT_FAILED";
+ // ================= INFRASTRUCTURE ======================
- /** General error string. */
- public static final String ERROR_STRING = "#error";
+ /** String for use when a bad error code was encountered. */
+ public static final String BAD_CODE = "BAD_CODE";
- /** String to prepend to error messages. */
- public static final String ERROR_HEADER = "Error: ";
+ /** String for use when formatting of the error string failed. */
+ public static final String FORMAT_FAILED = "FORMAT_FAILED";
- /** String to prepend to warning messages. */
- public static final String WARNING_HEADER = "Warning: ";
+ /** General error string. */
+ public static final String ERROR_STRING = "#error";
- /** String to specify the XSLT module. */
- public static final String XSL_HEADER = "XSLT ";
+ /** String to prepend to error messages. */
+ public static final String ERROR_HEADER = "Error: ";
- /** String to specify the XML parser module. */
- public static final String XML_HEADER = "XML ";
+ /** String to prepend to warning messages. */
+ public static final String WARNING_HEADER = "Warning: ";
- /** I don't think this is used any more.
- * @deprecated */
- public static final String QUERY_HEADER = "PATTERN ";
+ /** String to specify the XSLT module. */
+ public static final String XSL_HEADER = "XSLT ";
+ /** String to specify the XML parser module. */
+ public static final String XML_HEADER = "XML ";
- /**
- * Return a named ResourceBundle for a particular locale. This method mimics the behavior
- * of ResourceBundle.getBundle().
- *
- * @param className the name of the class that implements the resource bundle.
- * @return the ResourceBundle
- * @throws MissingResourceException
- */
- public static final XSLTErrorResources loadResourceBundle(String className)
- throws MissingResourceException
- {
+ /**
+ * I don't think this is used any more.
+ *
+ * @deprecated
+ */
+ public static final String QUERY_HEADER = "PATTERN ";
- Locale locale = Locale.getDefault();
- String suffix = getResourceSuffix(locale);
+ /**
+ * Return a named ResourceBundle for a particular locale. This method mimics
+ * the behavior of ResourceBundle.getBundle().
+ *
+ * @param className
+ * the name of the class that implements the resource bundle.
+ * @return the ResourceBundle
+ * @throws MissingResourceException
+ */
+ public static final XSLTErrorResources loadResourceBundle(String className)
+ throws MissingResourceException {
- try
- {
+ Locale locale = Locale.getDefault();
+ String suffix = getResourceSuffix(locale);
- // first try with the given locale
- return (XSLTErrorResources) ResourceBundle.getBundle(className
- + suffix, locale);
- }
- catch (MissingResourceException e)
- {
- try // try to fall back to en_US if we can't load
- {
+ try {
- // Since we can't find the localized property file,
- // fall back to en_US.
- return (XSLTErrorResources) ResourceBundle.getBundle(className,
- new Locale("en", "US"));
- }
- catch (MissingResourceException e2)
- {
+ // first try with the given locale
+ return (XSLTErrorResources) ResourceBundle.getBundle(className
+ + suffix, locale);
+ } catch (MissingResourceException e) {
+ try // try to fall back to en_US if we can't load
+ {
- // Now we are really in trouble.
- // very bad, definitely very bad...not going to get very far
- throw new MissingResourceException(
- "Could not load any resource bundles.", className, "");
- }
- }
- }
+ // Since we can't find the localized property file,
+ // fall back to en_US.
+ return (XSLTErrorResources) ResourceBundle.getBundle(className,
+ new Locale("en", "US"));
+ } catch (MissingResourceException e2) {
- /**
- * Return the resource file suffic for the indicated locale
- * For most locales, this will be based the language code. However
- * for Chinese, we do distinguish between Taiwan and PRC
- *
- * @param locale the locale
- * @return an String suffix which canbe appended to a resource name
- */
- private static final String getResourceSuffix(Locale locale)
- {
+ // Now we are really in trouble.
+ // very bad, definitely very bad...not going to get very far
+ throw new MissingResourceException(
+ "Could not load any resource bundles.", className, "");
+ }
+ }
+ }
- String suffix = "_" + locale.getLanguage();
- String country = locale.getCountry();
+ /**
+ * Return the resource file suffic for the indicated locale For most
+ * locales, this will be based the language code. However for Chinese, we do
+ * distinguish between Taiwan and PRC
+ *
+ * @param locale
+ * the locale
+ * @return an String suffix which canbe appended to a resource name
+ */
+ private static final String getResourceSuffix(Locale locale) {
- if (country.equals("TW"))
- suffix += "_" + country;
+ String suffix = "_" + locale.getLanguage();
+ String country = locale.getCountry();
- return suffix;
- }
+ if (country.equals("TW"))
+ suffix += "_" + country;
+ return suffix;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionContext.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionContext.java
index 169f5fb..4dbdb81 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionContext.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionContext.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExpressionContext.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExpressionContext.java,v 1.2 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -37,67 +37,73 @@
import org.w3c.dom.traversal.NodeIterator;
/**
- * An object that implements this interface can supply
- * information about the current XPath expression context.
+ * An object that implements this interface can supply information about the
+ * current XPath expression context.
*/
-public interface ExpressionContext
-{
+public interface ExpressionContext {
- /**
- * Get the current context node.
- * @return The current context node.
- */
- public Node getContextNode();
+ /**
+ * Get the current context node.
+ *
+ * @return The current context node.
+ */
+ public Node getContextNode();
- /**
- * Get the current context node list.
- * @return An iterator for the current context list, as
- * defined in XSLT.
- */
- public NodeIterator getContextNodes();
-
- /**
- * Get the error listener.
- * @return The registered error listener.
- */
- public ErrorListener getErrorListener();
+ /**
+ * Get the current context node list.
+ *
+ * @return An iterator for the current context list, as defined in XSLT.
+ */
+ public NodeIterator getContextNodes();
- /**
- * Get the value of a node as a number.
- * @param n Node to be converted to a number. May be null.
- * @return value of n as a number.
- */
- public double toNumber(Node n);
+ /**
+ * Get the error listener.
+ *
+ * @return The registered error listener.
+ */
+ public ErrorListener getErrorListener();
- /**
- * Get the value of a node as a string.
- * @param n Node to be converted to a string. May be null.
- * @return value of n as a string, or an empty string if n is null.
- */
- public String toString(Node n);
+ /**
+ * Get the value of a node as a number.
+ *
+ * @param n
+ * Node to be converted to a number. May be null.
+ * @return value of n as a number.
+ */
+ public double toNumber(Node n);
- /**
- * Get a variable based on it's qualified name.
- *
- * @param qname The qualified name of the variable.
- *
- * @return The evaluated value of the variable.
- *
- * @throws javax.xml.transform.TransformerException
- */
- public XObject getVariableOrParam(org.apache.xml.utils.QName qname)
- throws javax.xml.transform.TransformerException;
-
- /**
- * Get the XPathContext that owns this ExpressionContext.
- *
- * Note: exslt:function requires the XPathContext to access
- * the variable stack and TransformerImpl.
- *
- * @return The current XPathContext.
- * @throws javax.xml.transform.TransformerException
- */
- public org.apache.xpath.XPathContext getXPathContext()
- throws javax.xml.transform.TransformerException;
+ /**
+ * Get the value of a node as a string.
+ *
+ * @param n
+ * Node to be converted to a string. May be null.
+ * @return value of n as a string, or an empty string if n is null.
+ */
+ public String toString(Node n);
+
+ /**
+ * Get a variable based on it's qualified name.
+ *
+ * @param qname
+ * The qualified name of the variable.
+ *
+ * @return The evaluated value of the variable.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public XObject getVariableOrParam(org.apache.xml.utils.QName qname)
+ throws javax.xml.transform.TransformerException;
+
+ /**
+ * Get the XPathContext that owns this ExpressionContext.
+ *
+ * Note: exslt:function requires the XPathContext to access the variable
+ * stack and TransformerImpl.
+ *
+ * @return The current XPathContext.
+ * @throws javax.xml.transform.TransformerException
+ */
+ public org.apache.xpath.XPathContext getXPathContext()
+ throws javax.xml.transform.TransformerException;
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionVisitor.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionVisitor.java
index 429dfec..799c030 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionVisitor.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExpressionVisitor.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExpressionVisitor.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExpressionVisitor.java,v 1.2 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -38,55 +38,54 @@
import org.apache.xpath.functions.Function;
/**
- * When {@link org.apache.xalan.processor.StylesheetHandler} creates
- * an {@link org.apache.xpath.XPath}, the ExpressionVisitor
- * visits the XPath expression. For any extension functions it
- * encounters, it instructs StylesheetRoot to register the
- * extension namespace.
+ * When {@link org.apache.xalan.processor.StylesheetHandler} creates an
+ * {@link org.apache.xpath.XPath}, the ExpressionVisitor visits the XPath
+ * expression. For any extension functions it encounters, it instructs
+ * StylesheetRoot to register the extension namespace.
*
- * This mechanism is required to locate extension functions
- * that may be embedded within an expression.
+ * This mechanism is required to locate extension functions that may be embedded
+ * within an expression.
*/
-public class ExpressionVisitor extends XPathVisitor
-{
- private StylesheetRoot m_sroot;
-
- /**
- * The constructor sets the StylesheetRoot variable which
- * is used to register extension namespaces.
- * @param sroot the StylesheetRoot that is being constructed.
- */
- public ExpressionVisitor (StylesheetRoot sroot)
- {
- m_sroot = sroot;
- }
-
- /**
- * If the function is an extension function, register the namespace.
- *
- * @param owner The current XPath object that owns the expression.
- * @param func The function currently being visited.
- *
- * @return true to continue the visit in the subtree, if any.
- */
- public boolean visitFunction(ExpressionOwner owner, Function func)
- {
- if (func instanceof FuncExtFunction)
- {
- String namespace = ((FuncExtFunction)func).getNamespace();
- m_sroot.getExtensionNamespacesManager().registerExtension(namespace);
- }
- else if (func instanceof FuncExtFunctionAvailable)
- {
- String arg = ((FuncExtFunctionAvailable)func).getArg0().toString();
- if (arg.indexOf(":") > 0)
- {
- String prefix = arg.substring(0,arg.indexOf(":"));
- String namespace = this.m_sroot.getNamespaceForPrefix(prefix);
- m_sroot.getExtensionNamespacesManager().registerExtension(namespace);
- }
- }
- return true;
- }
+public class ExpressionVisitor extends XPathVisitor {
+ private StylesheetRoot m_sroot;
+
+ /**
+ * The constructor sets the StylesheetRoot variable which is used to
+ * register extension namespaces.
+ *
+ * @param sroot
+ * the StylesheetRoot that is being constructed.
+ */
+ public ExpressionVisitor(StylesheetRoot sroot) {
+ m_sroot = sroot;
+ }
+
+ /**
+ * If the function is an extension function, register the namespace.
+ *
+ * @param owner
+ * The current XPath object that owns the expression.
+ * @param func
+ * The function currently being visited.
+ *
+ * @return true to continue the visit in the subtree, if any.
+ */
+ @Override
+ public boolean visitFunction(ExpressionOwner owner, Function func) {
+ if (func instanceof FuncExtFunction) {
+ String namespace = ((FuncExtFunction) func).getNamespace();
+ m_sroot.getExtensionNamespacesManager()
+ .registerExtension(namespace);
+ } else if (func instanceof FuncExtFunctionAvailable) {
+ String arg = ((FuncExtFunctionAvailable) func).getArg0().toString();
+ if (arg.indexOf(":") > 0) {
+ String prefix = arg.substring(0, arg.indexOf(":"));
+ String namespace = this.m_sroot.getNamespaceForPrefix(prefix);
+ m_sroot.getExtensionNamespacesManager().registerExtension(
+ namespace);
+ }
+ }
+ return true;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandler.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandler.java
index e86ab7b..8b9836b 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandler.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandler.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionHandler.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExtensionHandler.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -41,117 +41,140 @@
import org.apache.xpath.functions.FuncExtFunction;
/**
- * Abstract base class for handling an extension namespace for XPath.
- * Provides functions to test a function's existence and call a function.
- * Also provides functions for calling an element and testing for
- * an element's existence.
- *
+ * Abstract base class for handling an extension namespace for XPath. Provides
+ * functions to test a function's existence and call a function. Also provides
+ * functions for calling an element and testing for an element's existence.
+ *
* @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
* @xsl.usage internal
*/
-public abstract class ExtensionHandler
-{
+public abstract class ExtensionHandler {
- /** uri of the extension namespace */
- protected String m_namespaceUri;
+ /** uri of the extension namespace */
+ protected String m_namespaceUri;
- /** scripting language of implementation */
- protected String m_scriptLang;
+ /** scripting language of implementation */
+ protected String m_scriptLang;
- /**
- * This method loads a class using the context class loader if we're
- * running under Java2 or higher.
- *
- * @param className Name of the class to load
- */
- static Class getClassForName(String className)
- throws ClassNotFoundException
- {
- // Hack for backwards compatibility with XalanJ1 stylesheets
- if(className.equals("org.apache.xalan.xslt.extensions.Redirect")) {
- className = "org.apache.xalan.lib.Redirect";
- }
+ /**
+ * This method loads a class using the context class loader if we're running
+ * under Java2 or higher.
+ *
+ * @param className
+ * Name of the class to load
+ */
+ static Class getClassForName(String className)
+ throws ClassNotFoundException {
+ // Hack for backwards compatibility with XalanJ1 stylesheets
+ if (className.equals("org.apache.xalan.xslt.extensions.Redirect")) {
+ className = "org.apache.xalan.lib.Redirect";
+ }
- return ObjectFactory.findProviderClass(
- className, ObjectFactory.findClassLoader(), true);
- }
+ return ObjectFactory.findProviderClass(className, ObjectFactory
+ .findClassLoader(), true);
+ }
- /**
- * Construct a new extension namespace handler given all the information
- * needed.
- *
- * @param namespaceUri the extension namespace URI that I'm implementing
- * @param scriptLang language of code implementing the extension
- */
- protected ExtensionHandler(String namespaceUri, String scriptLang)
- {
- m_namespaceUri = namespaceUri;
- m_scriptLang = scriptLang;
- }
+ /**
+ * Construct a new extension namespace handler given all the information
+ * needed.
+ *
+ * @param namespaceUri
+ * the extension namespace URI that I'm implementing
+ * @param scriptLang
+ * language of code implementing the extension
+ */
+ protected ExtensionHandler(String namespaceUri, String scriptLang) {
+ m_namespaceUri = namespaceUri;
+ m_scriptLang = scriptLang;
+ }
- /**
- * Tests whether a certain function name is known within this namespace.
- * @param function name of the function being tested
- * @return true if its known, false if not.
- */
- public abstract boolean isFunctionAvailable(String function);
+ /**
+ * Tests whether a certain function name is known within this namespace.
+ *
+ * @param function
+ * name of the function being tested
+ * @return true if its known, false if not.
+ */
+ public abstract boolean isFunctionAvailable(String function);
- /**
- * Tests whether a certain element name is known within this namespace.
- * @param element Name of element to check
- * @return true if its known, false if not.
- */
- public abstract boolean isElementAvailable(String element);
+ /**
+ * Tests whether a certain element name is known within this namespace.
+ *
+ * @param element
+ * Name of element to check
+ * @return true if its known, false if not.
+ */
+ public abstract boolean isElementAvailable(String element);
- /**
- * Process a call to a function.
- *
- * @param funcName Function name.
- * @param args The arguments of the function call.
- * @param methodKey A key that uniquely identifies this class and method call.
- * @param exprContext The context in which this expression is being executed.
- *
- * @return the return value of the function evaluation.
- *
- * @throws TransformerException if parsing trouble
- */
- public abstract Object callFunction(
- String funcName, Vector args, Object methodKey,
- ExpressionContext exprContext) throws TransformerException;
+ /**
+ * Process a call to a function.
+ *
+ * @param funcName
+ * Function name.
+ * @param args
+ * The arguments of the function call.
+ * @param methodKey
+ * A key that uniquely identifies this class and method call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ *
+ * @return the return value of the function evaluation.
+ *
+ * @throws TransformerException
+ * if parsing trouble
+ */
+ public abstract Object callFunction(String funcName, Vector args,
+ Object methodKey, ExpressionContext exprContext)
+ throws TransformerException;
- /**
- * Process a call to a function.
- *
- * @param extFunction The XPath extension function.
- * @param args The arguments of the function call.
- * @param exprContext The context in which this expression is being executed.
- *
- * @return the return value of the function evaluation.
- *
- * @throws TransformerException if parsing trouble
- */
- public abstract Object callFunction(
- FuncExtFunction extFunction, Vector args,
- ExpressionContext exprContext) throws TransformerException;
+ /**
+ * Process a call to a function.
+ *
+ * @param extFunction
+ * The XPath extension function.
+ * @param args
+ * The arguments of the function call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ *
+ * @return the return value of the function evaluation.
+ *
+ * @throws TransformerException
+ * if parsing trouble
+ */
+ public abstract Object callFunction(FuncExtFunction extFunction,
+ Vector args, ExpressionContext exprContext)
+ throws TransformerException;
- /**
- * Process a call to this extension namespace via an element. As a side
- * effect, the results are sent to the TransformerImpl's result tree.
- *
- * @param localPart Element name's local part.
- * @param element The extension element being processed.
- * @param transformer Handle to TransformerImpl.
- * @param stylesheetTree The compiled stylesheet tree.
- * @param methodKey A key that uniquely identifies this class and method call.
- *
- * @throws XSLProcessorException thrown if something goes wrong
- * while running the extension handler.
- * @throws MalformedURLException if loading trouble
- * @throws FileNotFoundException if loading trouble
- * @throws IOException if loading trouble
- * @throws TransformerException if parsing trouble
- */
- public abstract void processElement(
- String localPart, ElemTemplateElement element, TransformerImpl transformer,
- Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException;
+ /**
+ * Process a call to this extension namespace via an element. As a side
+ * effect, the results are sent to the TransformerImpl's result tree.
+ *
+ * @param localPart
+ * Element name's local part.
+ * @param element
+ * The extension element being processed.
+ * @param transformer
+ * Handle to TransformerImpl.
+ * @param stylesheetTree
+ * The compiled stylesheet tree.
+ * @param methodKey
+ * A key that uniquely identifies this class and method call.
+ *
+ * @throws XSLProcessorException
+ * thrown if something goes wrong while running the extension
+ * handler.
+ * @throws MalformedURLException
+ * if loading trouble
+ * @throws FileNotFoundException
+ * if loading trouble
+ * @throws IOException
+ * if loading trouble
+ * @throws TransformerException
+ * if parsing trouble
+ */
+ public abstract void processElement(String localPart,
+ ElemTemplateElement element, TransformerImpl transformer,
+ Stylesheet stylesheetTree, Object methodKey)
+ throws TransformerException, IOException;
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerExsltFunction.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerExsltFunction.java
index 47791bb..f29eab6 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerExsltFunction.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerExsltFunction.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionHandlerExsltFunction.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: ExtensionHandlerExsltFunction.java,v 1.3 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -53,187 +53,185 @@
import org.apache.xpath.objects.XString;
/**
- * Execute EXSLT functions, determine the availability of EXSLT functions, and the
- * availability of an EXSLT result element.
+ * Execute EXSLT functions, determine the availability of EXSLT functions, and
+ * the availability of an EXSLT result element.
*/
-public class ExtensionHandlerExsltFunction extends ExtensionHandler
-{
- private String m_namespace;
- private StylesheetRoot m_stylesheet;
- private static final QName RESULTQNAME =
- new QName(Constants.S_EXSLT_FUNCTIONS_URL,
- Constants.EXSLT_ELEMNAME_FUNCRESULT_STRING);
- /**
- * Constructor called from ElemExsltFunction runtimeInit().
- */
- public ExtensionHandlerExsltFunction(String ns, StylesheetRoot stylesheet)
- {
- super(ns, "xml"); // required by ExtensionHandler interface.
- m_namespace = ns;
- m_stylesheet = stylesheet;
- }
-
- /**
- * Required by ExtensionHandler (an abstract method). No-op.
- */
- public void processElement(
- String localPart, ElemTemplateElement element, TransformerImpl transformer,
- Stylesheet stylesheetTree, Object methodKey) throws TransformerException, IOException
- {}
-
- /**
- * Get the ElemExsltFunction element associated with the
- * function.
- *
- * @param funcName Local name of the function.
- * @return the ElemExsltFunction element associated with
- * the function, null if none exists.
- */
- public ElemExsltFunction getFunction(String funcName)
- {
- QName qname = new QName(m_namespace, funcName);
- ElemTemplate templ = m_stylesheet.getTemplateComposed(qname);
- if (templ != null && templ instanceof ElemExsltFunction)
- return (ElemExsltFunction) templ;
- else
- return null;
- }
-
-
- /**
- * Does the EXSLT function exist?
- *
- * @param funcName Local name of the function.
- * @return true if the function exists.
- */
- public boolean isFunctionAvailable(String funcName)
- {
- return getFunction(funcName)!= null;
- }
-
- /** If an element-available() call applies to an EXSLT result element within
- * an EXSLT function element, return true.
- *
- * Note: The EXSLT function element is a template-level element, and
- * element-available() returns false for it.
- *
- * @param elemName name of the element.
- * @return true if the function is available.
- */
- public boolean isElementAvailable(String elemName)
- {
- if (!(new QName(m_namespace, elemName).equals(RESULTQNAME)))
- {
- return false;
- }
- else
- {
- ElemTemplateElement elem = m_stylesheet.getFirstChildElem();
- while (elem != null && elem != m_stylesheet)
- {
- if (elem instanceof ElemExsltFuncResult && ancestorIsFunction(elem))
- return true;
- ElemTemplateElement nextElem = elem.getFirstChildElem();
- if (nextElem == null)
- nextElem = elem.getNextSiblingElem();
- if (nextElem == null)
- nextElem = elem.getParentElem();
- elem = nextElem;
- }
- }
- return false;
- }
+public class ExtensionHandlerExsltFunction extends ExtensionHandler {
+ private String m_namespace;
+ private StylesheetRoot m_stylesheet;
+ private static final QName RESULTQNAME = new QName(
+ org.apache.xml.utils.Constants.S_EXSLT_FUNCTIONS_URL,
+ Constants.EXSLT_ELEMNAME_FUNCRESULT_STRING);
- /**
- * Determine whether the func:result element is within a func:function element.
- * If not, it is illegal.
- */
- private boolean ancestorIsFunction(ElemTemplateElement child)
- {
- while (child.getParentElem() != null
- && !(child.getParentElem() instanceof StylesheetRoot))
- {
- if (child.getParentElem() instanceof ElemExsltFunction)
- return true;
- child = child.getParentElem();
- }
- return false;
- }
+ /**
+ * Constructor called from ElemExsltFunction runtimeInit().
+ */
+ public ExtensionHandlerExsltFunction(String ns, StylesheetRoot stylesheet) {
+ super(ns, "xml"); // required by ExtensionHandler interface.
+ m_namespace = ns;
+ m_stylesheet = stylesheet;
+ }
- /**
- * Execute the EXSLT function and return the result value.
- *
- * @param funcName Name of the EXSLT function.
- * @param args The arguments of the function call.
- * @param methodKey Not used.
- * @param exprContext Used to get the XPathContext.
- * @return the return value of the function evaluation.
- * @throws TransformerException
- */
- public Object callFunction(
- String funcName, Vector args, Object methodKey,
- ExpressionContext exprContext) throws TransformerException
- {
- throw new TransformerException("This method should not be called.");
- }
+ /**
+ * Required by ExtensionHandler (an abstract method). No-op.
+ */
+ @Override
+ public void processElement(String localPart, ElemTemplateElement element,
+ TransformerImpl transformer, Stylesheet stylesheetTree,
+ Object methodKey) throws TransformerException, IOException {
+ }
- /**
- * Execute the EXSLT function and return the result value.
- *
- * @param extFunction The XPath extension function
- * @param args The arguments of the function call.
- * @param exprContext The context in which this expression is being executed.
- * @return the return value of the function evaluation.
- * @throws TransformerException
- */
- public Object callFunction(FuncExtFunction extFunction,
- Vector args,
- ExpressionContext exprContext)
- throws TransformerException
- {
- // Find the template which invokes this EXSLT function.
- ExpressionNode parent = extFunction.exprGetParent();
- while (parent != null && !(parent instanceof ElemTemplate))
- {
- parent = parent.exprGetParent();
- }
-
- ElemTemplate callerTemplate = (parent != null) ? (ElemTemplate)parent: null;
-
- XObject[] methodArgs;
- methodArgs = new XObject[args.size()];
- try
- {
- for (int i = 0; i < methodArgs.length; i++)
- {
- methodArgs[i] = XObject.create(args.elementAt(i));
- }
-
- ElemExsltFunction elemFunc = getFunction(extFunction.getFunctionName());
-
- if (null != elemFunc) {
- XPathContext context = exprContext.getXPathContext();
- TransformerImpl transformer = (TransformerImpl)context.getOwnerObject();
- transformer.pushCurrentFuncResult(null);
+ /**
+ * Get the ElemExsltFunction element associated with the function.
+ *
+ * @param funcName
+ * Local name of the function.
+ * @return the ElemExsltFunction element associated with the function, null
+ * if none exists.
+ */
+ public ElemExsltFunction getFunction(String funcName) {
+ QName qname = new QName(m_namespace, funcName);
+ ElemTemplate templ = m_stylesheet.getTemplateComposed(qname);
+ if (templ != null && templ instanceof ElemExsltFunction)
+ return (ElemExsltFunction) templ;
+ else
+ return null;
+ }
- elemFunc.execute(transformer, methodArgs);
+ /**
+ * Does the EXSLT function exist?
+ *
+ * @param funcName
+ * Local name of the function.
+ * @return true if the function exists.
+ */
+ @Override
+ public boolean isFunctionAvailable(String funcName) {
+ return getFunction(funcName) != null;
+ }
- XObject val = (XObject)transformer.popCurrentFuncResult();
- return (val == null) ? new XString("") // value if no result element.
- : val;
- }
- else {
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_FUNCTION_NOT_FOUND, new Object[] {extFunction.getFunctionName()}));
- }
- }
- catch (TransformerException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new TransformerException(e);
- }
- }
-
+ /**
+ * If an element-available() call applies to an EXSLT result element within
+ * an EXSLT function element, return true.
+ *
+ * Note: The EXSLT function element is a template-level element, and
+ * element-available() returns false for it.
+ *
+ * @param elemName
+ * name of the element.
+ * @return true if the function is available.
+ */
+ @Override
+ public boolean isElementAvailable(String elemName) {
+ if (!(new QName(m_namespace, elemName).equals(RESULTQNAME))) {
+ return false;
+ } else {
+ ElemTemplateElement elem = m_stylesheet.getFirstChildElem();
+ while (elem != null && elem != m_stylesheet) {
+ if (elem instanceof ElemExsltFuncResult
+ && ancestorIsFunction(elem))
+ return true;
+ ElemTemplateElement nextElem = elem.getFirstChildElem();
+ if (nextElem == null)
+ nextElem = elem.getNextSiblingElem();
+ if (nextElem == null)
+ nextElem = elem.getParentElem();
+ elem = nextElem;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Determine whether the func:result element is within a func:function
+ * element. If not, it is illegal.
+ */
+ private boolean ancestorIsFunction(ElemTemplateElement child) {
+ while (child.getParentElem() != null
+ && !(child.getParentElem() instanceof StylesheetRoot)) {
+ if (child.getParentElem() instanceof ElemExsltFunction)
+ return true;
+ child = child.getParentElem();
+ }
+ return false;
+ }
+
+ /**
+ * Execute the EXSLT function and return the result value.
+ *
+ * @param funcName
+ * Name of the EXSLT function.
+ * @param args
+ * The arguments of the function call.
+ * @param methodKey
+ * Not used.
+ * @param exprContext
+ * Used to get the XPathContext.
+ * @return the return value of the function evaluation.
+ * @throws TransformerException
+ */
+ @Override
+ public Object callFunction(String funcName, Vector args, Object methodKey,
+ ExpressionContext exprContext) throws TransformerException {
+ throw new TransformerException("This method should not be called.");
+ }
+
+ /**
+ * Execute the EXSLT function and return the result value.
+ *
+ * @param extFunction
+ * The XPath extension function
+ * @param args
+ * The arguments of the function call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ * @return the return value of the function evaluation.
+ * @throws TransformerException
+ */
+ @Override
+ public Object callFunction(FuncExtFunction extFunction, Vector args,
+ ExpressionContext exprContext) throws TransformerException {
+ // Find the template which invokes this EXSLT function.
+ ExpressionNode parent = extFunction.exprGetParent();
+ while (parent != null && !(parent instanceof ElemTemplate)) {
+ parent = parent.exprGetParent();
+ }
+
+ ElemTemplate callerTemplate = (parent != null) ? (ElemTemplate) parent
+ : null;
+
+ XObject[] methodArgs;
+ methodArgs = new XObject[args.size()];
+ try {
+ for (int i = 0; i < methodArgs.length; i++) {
+ methodArgs[i] = XObject.create(args.elementAt(i));
+ }
+
+ ElemExsltFunction elemFunc = getFunction(extFunction
+ .getFunctionName());
+
+ if (null != elemFunc) {
+ XPathContext context = exprContext.getXPathContext();
+ TransformerImpl transformer = (TransformerImpl) context
+ .getOwnerObject();
+ transformer.pushCurrentFuncResult(null);
+
+ elemFunc.execute(transformer, methodArgs);
+
+ XObject val = (XObject) transformer.popCurrentFuncResult();
+ return (val == null) ? new XString("") // value if no result
+ // element.
+ : val;
+ } else {
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_FUNCTION_NOT_FOUND,
+ new Object[] { extFunction.getFunctionName() }));
+ }
+ } catch (TransformerException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new TransformerException(e);
+ }
+ }
+
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerGeneral.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerGeneral.java
index 2223934..2198889 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerGeneral.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerGeneral.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionHandlerGeneral.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: ExtensionHandlerGeneral.java,v 1.3 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -40,9 +40,6 @@
import javax.xml.transform.TransformerException;
-import org.apache.xml.res.XMLErrorResources;
-import org.apache.xml.res.XMLMessages;
-
import org.eclipse.wst.xsl.core.compiler.xslt10.res.Messages;
import org.eclipse.wst.xsl.core.compiler.xslt10.res.XSLTErrorResources;
import org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemTemplateElement;
@@ -57,351 +54,380 @@
import org.apache.xpath.objects.XObject;
/**
- * Class handling an extension namespace for XPath. Provides functions
- * to test a function's existence and call a function
- *
+ * Class handling an extension namespace for XPath. Provides functions to test a
+ * function's existence and call a function
+ *
* @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
* @xsl.usage internal
*/
-public class ExtensionHandlerGeneral extends ExtensionHandler
-{
+public class ExtensionHandlerGeneral extends ExtensionHandler {
- /** script source to run (if any) */
- private String m_scriptSrc;
+ /** script source to run (if any) */
+ private String m_scriptSrc;
- /** URL of source of script (if any) */
- private String m_scriptSrcURL;
+ /** URL of source of script (if any) */
+ private String m_scriptSrcURL;
- /** functions of namespace */
- private Hashtable m_functions = new Hashtable();
+ /** functions of namespace */
+ private Hashtable m_functions = new Hashtable();
- /** elements of namespace */
- private Hashtable m_elements = new Hashtable();
+ /** elements of namespace */
+ private Hashtable m_elements = new Hashtable();
- // BSF objects used to invoke BSF by reflection. Do not import the BSF classes
- // since we don't want a compile dependency on BSF.
+ // BSF objects used to invoke BSF by reflection. Do not import the BSF
+ // classes
+ // since we don't want a compile dependency on BSF.
- /** BSF manager used to run scripts */
- private Object m_engine;
+ /** BSF manager used to run scripts */
+ private Object m_engine;
- /** Engine call to invoke scripts */
- private Method m_engineCall = null;
+ /** Engine call to invoke scripts */
+ private Method m_engineCall = null;
- // static fields
+ // static fields
- /** BSFManager package name */
- private static String BSF_MANAGER ;
-
- /** Default BSFManager name */
- private static final String DEFAULT_BSF_MANAGER = "org.apache.bsf.BSFManager";
-
- /** Property name to load the BSFManager class */
- private static final String propName = "org.apache.xalan.extensions.bsf.BSFManager";
-
- /** Integer Zero */
- private static final Integer ZEROINT = new Integer(0);
+ /** BSFManager package name */
+ private static String BSF_MANAGER;
- static{
- BSF_MANAGER = ObjectFactory.lookUpFactoryClassName(propName, null, null);
-
- if (BSF_MANAGER == null){
- BSF_MANAGER = DEFAULT_BSF_MANAGER;
- }
- }
+ /** Default BSFManager name */
+ private static final String DEFAULT_BSF_MANAGER = "org.apache.bsf.BSFManager";
- /**
- * Construct a new extension namespace handler given all the information
- * needed.
- *
- * @param namespaceUri the extension namespace URI that I'm implementing
- * @param elemNames Vector of element names
- * @param funcNames string containing list of functions of extension NS
- * @param scriptLang Scripting language of implementation
- * @param scriptSrcURL URL of source script
- * @param scriptSrc the actual script code (if any)
- * @param systemId
- *
- * @throws TransformerException
- */
- public ExtensionHandlerGeneral(
- String namespaceUri, StringVector elemNames, StringVector funcNames, String scriptLang, String scriptSrcURL, String scriptSrc, String systemId)
- throws TransformerException
- {
+ /** Property name to load the BSFManager class */
+ private static final String propName = "org.apache.xalan.extensions.bsf.BSFManager";
- super(namespaceUri, scriptLang);
+ /** Integer Zero */
+ private static final Integer ZEROINT = new Integer(0);
- if (elemNames != null)
- {
- Object junk = new Object();
- int n = elemNames.size();
+ static {
+ BSF_MANAGER = ObjectFactory
+ .lookUpFactoryClassName(propName, null, null);
- for (int i = 0; i < n; i++)
- {
- String tok = elemNames.elementAt(i);
+ if (BSF_MANAGER == null) {
+ BSF_MANAGER = DEFAULT_BSF_MANAGER;
+ }
+ }
- m_elements.put(tok, junk); // just stick it in there basically
- }
- }
+ /**
+ * Construct a new extension namespace handler given all the information
+ * needed.
+ *
+ * @param namespaceUri
+ * the extension namespace URI that I'm implementing
+ * @param elemNames
+ * Vector of element names
+ * @param funcNames
+ * string containing list of functions of extension NS
+ * @param scriptLang
+ * Scripting language of implementation
+ * @param scriptSrcURL
+ * URL of source script
+ * @param scriptSrc
+ * the actual script code (if any)
+ * @param systemId
+ *
+ * @throws TransformerException
+ */
+ public ExtensionHandlerGeneral(String namespaceUri, StringVector elemNames,
+ StringVector funcNames, String scriptLang, String scriptSrcURL,
+ String scriptSrc, String systemId) throws TransformerException {
- if (funcNames != null)
- {
- Object junk = new Object();
- int n = funcNames.size();
+ super(namespaceUri, scriptLang);
- for (int i = 0; i < n; i++)
- {
- String tok = funcNames.elementAt(i);
+ if (elemNames != null) {
+ Object junk = new Object();
+ int n = elemNames.size();
- m_functions.put(tok, junk); // just stick it in there basically
- }
- }
+ for (int i = 0; i < n; i++) {
+ String tok = elemNames.elementAt(i);
- m_scriptSrcURL = scriptSrcURL;
- m_scriptSrc = scriptSrc;
+ m_elements.put(tok, junk); // just stick it in there basically
+ }
+ }
- if (m_scriptSrcURL != null)
- {
- URL url = null;
- try{
- url = new URL(m_scriptSrcURL);
- }
- catch (java.net.MalformedURLException mue)
- {
- int indexOfColon = m_scriptSrcURL.indexOf(':');
- int indexOfSlash = m_scriptSrcURL.indexOf('/');
+ if (funcNames != null) {
+ Object junk = new Object();
+ int n = funcNames.size();
- if ((indexOfColon != -1) && (indexOfSlash != -1)
- && (indexOfColon < indexOfSlash))
- {
- // The url is absolute.
- url = null;
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), mue); //"src attribute not yet supported for "
- //+ scriptLang);
- }
- else
- {
- try{
- url = new URL(new URL(SystemIDResolver.getAbsoluteURI(systemId)), m_scriptSrcURL);
- }
- catch (java.net.MalformedURLException mue2)
- {
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), mue2); //"src attribute not yet supported for "
- //+ scriptLang);
- }
- }
- }
- if (url != null)
- {
- try
- {
- URLConnection uc = url.openConnection();
- InputStream is = uc.getInputStream();
- byte []bArray = new byte[uc.getContentLength()];
- is.read(bArray);
- m_scriptSrc = new String(bArray);
-
- }
- catch (IOException ioe)
- {
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT, new Object[]{m_scriptSrcURL}), ioe); //"src attribute not yet supported for "
- //+ scriptLang);
- }
- }
-
- }
+ for (int i = 0; i < n; i++) {
+ String tok = funcNames.elementAt(i);
- Object manager = null;
- try
- {
- manager = ObjectFactory.newInstance(
- BSF_MANAGER, ObjectFactory.findClassLoader(), true);
- }
- catch (ObjectFactory.ConfigurationError e)
- {
- e.printStackTrace();
- }
+ m_functions.put(tok, junk); // just stick it in there basically
+ }
+ }
- if (manager == null)
- {
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_CANNOT_INIT_BSFMGR, null)); //"Could not initialize BSF manager");
- }
+ m_scriptSrcURL = scriptSrcURL;
+ m_scriptSrc = scriptSrc;
- try
- {
- Method loadScriptingEngine = manager.getClass()
- .getMethod("loadScriptingEngine", new Class[]{ String.class });
+ if (m_scriptSrcURL != null) {
+ URL url = null;
+ try {
+ url = new URL(m_scriptSrcURL);
+ } catch (java.net.MalformedURLException mue) {
+ int indexOfColon = m_scriptSrcURL.indexOf(':');
+ int indexOfSlash = m_scriptSrcURL.indexOf('/');
- m_engine = loadScriptingEngine.invoke(manager,
- new Object[]{ scriptLang });
+ if ((indexOfColon != -1) && (indexOfSlash != -1)
+ && (indexOfColon < indexOfSlash)) {
+ // The url is absolute.
+ url = null;
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT,
+ new Object[] { m_scriptSrcURL }), mue); // "src
+ // attribute
+ // not yet
+ // supported
+ // for "
+ // + scriptLang);
+ } else {
+ try {
+ url = new URL(new URL(SystemIDResolver
+ .getAbsoluteURI(systemId)), m_scriptSrcURL);
+ } catch (java.net.MalformedURLException mue2) {
+ throw new TransformerException(
+ Messages
+ .createMessage(
+ XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT,
+ new Object[] { m_scriptSrcURL }),
+ mue2); // "src attribute not yet supported for
+ // "
+ // + scriptLang);
+ }
+ }
+ }
+ if (url != null) {
+ try {
+ URLConnection uc = url.openConnection();
+ InputStream is = uc.getInputStream();
+ byte[] bArray = new byte[uc.getContentLength()];
+ is.read(bArray);
+ m_scriptSrc = new String(bArray);
- Method engineExec = m_engine.getClass().getMethod("exec",
- new Class[]{ String.class, Integer.TYPE, Integer.TYPE, Object.class });
+ } catch (IOException ioe) {
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_COULD_NOT_FIND_EXTERN_SCRIPT,
+ new Object[] { m_scriptSrcURL }), ioe); // "src
+ // attribute
+ // not yet
+ // supported
+ // for "
+ // + scriptLang);
+ }
+ }
- // "Compile" the program
- engineExec.invoke(m_engine,
- new Object[]{ "XalanScript", ZEROINT, ZEROINT, m_scriptSrc });
- }
- catch (Exception e)
- {
- e.printStackTrace();
+ }
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_CANNOT_CMPL_EXTENSN, null), e); //"Could not compile extension", e);
- }
- }
+ Object manager = null;
+ try {
+ manager = ObjectFactory.newInstance(BSF_MANAGER, ObjectFactory
+ .findClassLoader(), true);
+ } catch (ObjectFactory.ConfigurationError e) {
+ e.printStackTrace();
+ }
- /**
- * Tests whether a certain function name is known within this namespace.
- * @param function name of the function being tested
- * @return true if its known, false if not.
- */
- public boolean isFunctionAvailable(String function)
- {
- return (m_functions.get(function) != null);
- }
+ if (manager == null) {
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_CANNOT_INIT_BSFMGR, null)); // "Could
+ // not
+ // initialize
+ // BSF
+ // manager");
+ }
- /**
- * Tests whether a certain element name is known within this namespace.
- * @param element name of the element being tested
- * @return true if its known, false if not.
- */
- public boolean isElementAvailable(String element)
- {
- return (m_elements.get(element) != null);
- }
+ try {
+ Method loadScriptingEngine = manager.getClass().getMethod(
+ "loadScriptingEngine", new Class[] { String.class });
- /**
- * Process a call to a function.
- *
- * @param funcName Function name.
- * @param args The arguments of the function call.
- * @param methodKey A key that uniquely identifies this class and method call.
- * @param exprContext The context in which this expression is being executed.
- *
- * @return the return value of the function evaluation.
- *
- * @throws TransformerException if parsing trouble
- */
- public Object callFunction(
- String funcName, Vector args, Object methodKey, ExpressionContext exprContext)
- throws TransformerException
- {
+ m_engine = loadScriptingEngine.invoke(manager,
+ new Object[] { scriptLang });
- Object[] argArray;
+ Method engineExec = m_engine.getClass().getMethod(
+ "exec",
+ new Class[] { String.class, Integer.TYPE, Integer.TYPE,
+ Object.class });
- try
- {
- argArray = new Object[args.size()];
+ // "Compile" the program
+ engineExec.invoke(m_engine, new Object[] { "XalanScript", ZEROINT,
+ ZEROINT, m_scriptSrc });
+ } catch (Exception e) {
+ e.printStackTrace();
- for (int i = 0; i < argArray.length; i++)
- {
- Object o = args.elementAt(i);
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_CANNOT_CMPL_EXTENSN, null), e); // "Could
+ // not
+ // compile
+ // extension",
+ // e);
+ }
+ }
- argArray[i] = (o instanceof XObject) ? ((XObject) o).object() : o;
- o = argArray[i];
- if(null != o && o instanceof DTMIterator)
- {
- argArray[i] = new DTMNodeList((DTMIterator)o);
- }
- }
+ /**
+ * Tests whether a certain function name is known within this namespace.
+ *
+ * @param function
+ * name of the function being tested
+ * @return true if its known, false if not.
+ */
+ @Override
+ public boolean isFunctionAvailable(String function) {
+ return (m_functions.get(function) != null);
+ }
- if (m_engineCall == null) {
- m_engineCall = m_engine.getClass().getMethod("call",
- new Class[]{ Object.class, String.class, Object[].class });
- }
+ /**
+ * Tests whether a certain element name is known within this namespace.
+ *
+ * @param element
+ * name of the element being tested
+ * @return true if its known, false if not.
+ */
+ @Override
+ public boolean isElementAvailable(String element) {
+ return (m_elements.get(element) != null);
+ }
- return m_engineCall.invoke(m_engine,
- new Object[]{ null, funcName, argArray });
- }
- catch (Exception e)
- {
- e.printStackTrace();
+ /**
+ * Process a call to a function.
+ *
+ * @param funcName
+ * Function name.
+ * @param args
+ * The arguments of the function call.
+ * @param methodKey
+ * A key that uniquely identifies this class and method call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ *
+ * @return the return value of the function evaluation.
+ *
+ * @throws TransformerException
+ * if parsing trouble
+ */
+ @Override
+ public Object callFunction(String funcName, Vector args, Object methodKey,
+ ExpressionContext exprContext) throws TransformerException {
- String msg = e.getMessage();
+ Object[] argArray;
- if (null != msg)
- {
- if (msg.startsWith("Stopping after fatal error:"))
- {
- msg = msg.substring("Stopping after fatal error:".length());
- }
+ try {
+ argArray = new Object[args.size()];
- // System.out.println("Call to extension function failed: "+msg);
- throw new TransformerException(e);
- }
- else
- {
+ for (int i = 0; i < argArray.length; i++) {
+ Object o = args.elementAt(i);
- // Should probably make a TRaX Extension Exception.
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_CANNOT_CREATE_EXTENSN, new Object[]{funcName, e })); //"Could not create extension: " + funcName
- //+ " because of: " + e);
- }
- }
- }
+ argArray[i] = (o instanceof XObject) ? ((XObject) o).object()
+ : o;
+ o = argArray[i];
+ if (null != o && o instanceof DTMIterator) {
+ argArray[i] = new DTMNodeList((DTMIterator) o);
+ }
+ }
- /**
- * Process a call to an XPath extension function
- *
- * @param extFunction The XPath extension function
- * @param args The arguments of the function call.
- * @param exprContext The context in which this expression is being executed.
- * @return the return value of the function evaluation.
- * @throws TransformerException
- */
- public Object callFunction(FuncExtFunction extFunction,
- Vector args,
- ExpressionContext exprContext)
- throws TransformerException
- {
- return callFunction(extFunction.getFunctionName(), args,
- extFunction.getMethodKey(), exprContext);
- }
+ if (m_engineCall == null) {
+ m_engineCall = m_engine.getClass().getMethod(
+ "call",
+ new Class[] { Object.class, String.class,
+ Object[].class });
+ }
- /**
- * Process a call to this extension namespace via an element. As a side
- * effect, the results are sent to the TransformerImpl's result tree.
- *
- * @param localPart Element name's local part.
- * @param element The extension element being processed.
- * @param transformer Handle to TransformerImpl.
- * @param stylesheetTree The compiled stylesheet tree.
- * @param methodKey A key that uniquely identifies this class and method call.
- *
- * @throws XSLProcessorException thrown if something goes wrong
- * while running the extension handler.
- * @throws MalformedURLException if loading trouble
- * @throws FileNotFoundException if loading trouble
- * @throws IOException if loading trouble
- * @throws TransformerException if parsing trouble
- */
- public void processElement(
- String localPart, ElemTemplateElement element, TransformerImpl transformer,
- Stylesheet stylesheetTree, Object methodKey)
- throws TransformerException, IOException
- {
+ return m_engineCall.invoke(m_engine, new Object[] { null, funcName,
+ argArray });
+ } catch (Exception e) {
+ e.printStackTrace();
- Object result = null;
- XSLProcessorContext xpc = new XSLProcessorContext(transformer, stylesheetTree);
+ String msg = e.getMessage();
- try
- {
- Vector argv = new Vector(2);
+ if (null != msg) {
+ if (msg.startsWith("Stopping after fatal error:")) {
+ msg = msg.substring("Stopping after fatal error:".length());
+ }
- argv.addElement(xpc);
- argv.addElement(element);
+ // System.out.println("Call to extension function failed:
+ // "+msg);
+ throw new TransformerException(e);
+ } else {
- result = callFunction(localPart, argv, methodKey,
- (ExpressionContext) transformer.getXPathContext().getExpressionContext());
- }
- catch (XPathProcessorException e)
- {
+ // Should probably make a TRaX Extension Exception.
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_CANNOT_CREATE_EXTENSN,
+ new Object[] { funcName, e })); // "Could not create
+ // extension: " +
+ // funcName
+ // + " because of: " + e);
+ }
+ }
+ }
- // e.printStackTrace ();
- throw new TransformerException(e.getMessage(), e);
- }
+ /**
+ * Process a call to an XPath extension function
+ *
+ * @param extFunction
+ * The XPath extension function
+ * @param args
+ * The arguments of the function call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ * @return the return value of the function evaluation.
+ * @throws TransformerException
+ */
+ @Override
+ public Object callFunction(FuncExtFunction extFunction, Vector args,
+ ExpressionContext exprContext) throws TransformerException {
+ return callFunction(extFunction.getFunctionName(), args, extFunction
+ .getMethodKey(), exprContext);
+ }
- if (result != null)
- {
- xpc.outputToResultTree(stylesheetTree, result);
- }
- }
+ /**
+ * Process a call to this extension namespace via an element. As a side
+ * effect, the results are sent to the TransformerImpl's result tree.
+ *
+ * @param localPart
+ * Element name's local part.
+ * @param element
+ * The extension element being processed.
+ * @param transformer
+ * Handle to TransformerImpl.
+ * @param stylesheetTree
+ * The compiled stylesheet tree.
+ * @param methodKey
+ * A key that uniquely identifies this class and method call.
+ *
+ * @throws XSLProcessorException
+ * thrown if something goes wrong while running the extension
+ * handler.
+ * @throws MalformedURLException
+ * if loading trouble
+ * @throws FileNotFoundException
+ * if loading trouble
+ * @throws IOException
+ * if loading trouble
+ * @throws TransformerException
+ * if parsing trouble
+ */
+ @Override
+ public void processElement(String localPart, ElemTemplateElement element,
+ TransformerImpl transformer, Stylesheet stylesheetTree,
+ Object methodKey) throws TransformerException, IOException {
+
+ Object result = null;
+ XSLProcessorContext xpc = new XSLProcessorContext(transformer,
+ stylesheetTree);
+
+ try {
+ Vector argv = new Vector(2);
+
+ argv.addElement(xpc);
+ argv.addElement(element);
+
+ result = callFunction(localPart, argv, methodKey,
+ (ExpressionContext) transformer.getXPathContext()
+ .getExpressionContext());
+ } catch (XPathProcessorException e) {
+
+ // e.printStackTrace ();
+ throw new TransformerException(e.getMessage(), e);
+ }
+
+ if (result != null) {
+ xpc.outputToResultTree(stylesheetTree, result);
+ }
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJava.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJava.java
index 05a75b6..f5b44db 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJava.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJava.java
@@ -26,85 +26,98 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionHandlerJava.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExtensionHandlerJava.java,v 1.2 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
import java.util.Hashtable;
/**
- * Abstract base class handling the java language extensions for XPath.
- * This base class provides cache management shared by all of the
- * various java extension handlers.
- *
+ * Abstract base class handling the java language extensions for XPath. This
+ * base class provides cache management shared by all of the various java
+ * extension handlers.
+ *
* @xsl.usage internal
*/
-public abstract class ExtensionHandlerJava extends ExtensionHandler
-{
+public abstract class ExtensionHandlerJava extends ExtensionHandler {
- /** Extension class name */
- protected String m_className = "";
+ /** Extension class name */
+ protected String m_className = "";
- /** Table of cached methods */
- private Hashtable m_cachedMethods = new Hashtable();
+ /** Table of cached methods */
+ private Hashtable m_cachedMethods = new Hashtable();
- /**
- * Construct a new extension handler given all the information
- * needed.
- *
- * @param namespaceUri the extension namespace URI that I'm implementing
- * @param funcNames string containing list of functions of extension NS
- * @param lang language of code implementing the extension
- * @param srcURL value of src attribute (if any) - treated as a URL
- * or a classname depending on the value of lang. If
- * srcURL is not null, then scriptSrc is ignored.
- * @param scriptSrc the actual script code (if any)
- * @param scriptLang the scripting language
- * @param className the extension class name
- */
- protected ExtensionHandlerJava(String namespaceUri, String scriptLang,
- String className)
- {
+ /**
+ * Construct a new extension handler given all the information needed.
+ *
+ * @param namespaceUri
+ * the extension namespace URI that I'm implementing
+ * @param funcNames
+ * string containing list of functions of extension NS
+ * @param lang
+ * language of code implementing the extension
+ * @param srcURL
+ * value of src attribute (if any) - treated as a URL or a
+ * classname depending on the value of lang. If srcURL is not
+ * null, then scriptSrc is ignored.
+ * @param scriptSrc
+ * the actual script code (if any)
+ * @param scriptLang
+ * the scripting language
+ * @param className
+ * the extension class name
+ */
+ protected ExtensionHandlerJava(String namespaceUri, String scriptLang,
+ String className) {
- super(namespaceUri, scriptLang);
+ super(namespaceUri, scriptLang);
- m_className = className;
- }
+ m_className = className;
+ }
- /**
- * Look up the entry in the method cache.
- * @param methodKey A key that uniquely identifies this invocation in
- * the stylesheet.
- * @param objType A Class object or instance object representing the type
- * @param methodArgs An array of the XObject arguments to be used for
- * function mangling.
- *
- * @return The given method from the method cache
- */
- public Object getFromCache(Object methodKey, Object objType,
- Object[] methodArgs)
- {
+ /**
+ * Look up the entry in the method cache.
+ *
+ * @param methodKey
+ * A key that uniquely identifies this invocation in the
+ * stylesheet.
+ * @param objType
+ * A Class object or instance object representing the type
+ * @param methodArgs
+ * An array of the XObject arguments to be used for function
+ * mangling.
+ *
+ * @return The given method from the method cache
+ */
+ public Object getFromCache(Object methodKey, Object objType,
+ Object[] methodArgs) {
- // Eventually, we want to insert code to mangle the methodKey with methodArgs
- return m_cachedMethods.get(methodKey);
- }
+ // Eventually, we want to insert code to mangle the methodKey with
+ // methodArgs
+ return m_cachedMethods.get(methodKey);
+ }
- /**
- * Add a new entry into the method cache.
- * @param methodKey A key that uniquely identifies this invocation in
- * the stylesheet.
- * @param objType A Class object or instance object representing the type
- * @param methodArgs An array of the XObject arguments to be used for
- * function mangling.
- * @param methodObj A Class object or instance object representing the method
- *
- * @return The cached method object
- */
- public Object putToCache(Object methodKey, Object objType,
- Object[] methodArgs, Object methodObj)
- {
+ /**
+ * Add a new entry into the method cache.
+ *
+ * @param methodKey
+ * A key that uniquely identifies this invocation in the
+ * stylesheet.
+ * @param objType
+ * A Class object or instance object representing the type
+ * @param methodArgs
+ * An array of the XObject arguments to be used for function
+ * mangling.
+ * @param methodObj
+ * A Class object or instance object representing the method
+ *
+ * @return The cached method object
+ */
+ public Object putToCache(Object methodKey, Object objType,
+ Object[] methodArgs, Object methodObj) {
- // Eventually, we want to insert code to mangle the methodKey with methodArgs
- return m_cachedMethods.put(methodKey, methodObj);
- }
+ // Eventually, we want to insert code to mangle the methodKey with
+ // methodArgs
+ return m_cachedMethods.put(methodKey, methodObj);
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaClass.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaClass.java
index 537cbc0..692d1ff 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaClass.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaClass.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionHandlerJavaClass.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExtensionHandlerJavaClass.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -48,507 +48,479 @@
import org.apache.xpath.objects.XObject;
/**
- * Represents an extension namespace for XPath that handles java classes.
- * It is recommended that the class URI be of the form:
+ * Represents an extension namespace for XPath that handles java classes. It is
+ * recommended that the class URI be of the form:
+ *
* <pre>
* xalan://fully.qualified.class.name
* </pre>
- * However, we do not enforce this. If the class name contains a
- * a /, we only use the part to the right of the rightmost slash.
- * In addition, we ignore any "class:" prefix.
- * Provides functions to test a function's existence and call a function.
- * Also provides functions to test an element's existence and call an
+ *
+ * However, we do not enforce this. If the class name contains a a /, we only
+ * use the part to the right of the rightmost slash. In addition, we ignore any
+ * "class:" prefix. Provides functions to test a function's existence and call a
+ * function. Also provides functions to test an element's existence and call an
* element.
- *
+ *
* @author <a href="mailto:garyp@firstech.com">Gary L Peskin</a>
* @xsl.usage internal
*/
-public class ExtensionHandlerJavaClass extends ExtensionHandlerJava
-{
+public class ExtensionHandlerJavaClass extends ExtensionHandlerJava {
- private Class m_classObj = null;
+ private Class m_classObj = null;
- /**
- * Provides a default Instance for use by elements that need to call
- * an instance method.
- */
+ /**
+ * Provides a default Instance for use by elements that need to call an
+ * instance method.
+ */
- private Object m_defaultInstance = null;
+ private Object m_defaultInstance = null;
+ /**
+ * Construct a new extension namespace handler given all the information
+ * needed.
+ *
+ * @param namespaceUri
+ * the extension namespace URI that I'm implementing
+ * @param scriptLang
+ * language of code implementing the extension
+ * @param className
+ * the fully qualified class name of the class
+ */
+ public ExtensionHandlerJavaClass(String namespaceUri, String scriptLang,
+ String className) {
+ super(namespaceUri, scriptLang, className);
+ try {
+ m_classObj = getClassForName(className);
+ } catch (ClassNotFoundException e) {
+ // For now, just let this go. We'll catch it when we try to invoke a
+ // method.
+ }
+ }
- /**
- * Construct a new extension namespace handler given all the information
- * needed.
- * @param namespaceUri the extension namespace URI that I'm implementing
- * @param scriptLang language of code implementing the extension
- * @param className the fully qualified class name of the class
- */
- public ExtensionHandlerJavaClass(String namespaceUri,
- String scriptLang,
- String className)
- {
- super(namespaceUri, scriptLang, className);
- try
- {
- m_classObj = getClassForName(className);
- }
- catch (ClassNotFoundException e)
- {
- // For now, just let this go. We'll catch it when we try to invoke a method.
- }
- }
+ /**
+ * Tests whether a certain function name is known within this namespace.
+ * Simply looks for a method with the appropriate name. There is no
+ * information regarding the arguments to the function call or whether the
+ * method implementing the function is a static method or an instance
+ * method.
+ *
+ * @param function
+ * name of the function being tested
+ * @return true if its known, false if not.
+ */
+ @Override
+ public boolean isFunctionAvailable(String function) {
+ Method[] methods = m_classObj.getMethods();
+ int nMethods = methods.length;
+ for (int i = 0; i < nMethods; i++) {
+ if (methods[i].getName().equals(function))
+ return true;
+ }
+ return false;
+ }
- /**
- * Tests whether a certain function name is known within this namespace.
- * Simply looks for a method with the appropriate name. There is
- * no information regarding the arguments to the function call or
- * whether the method implementing the function is a static method or
- * an instance method.
- * @param function name of the function being tested
- * @return true if its known, false if not.
- */
+ /**
+ * Tests whether a certain element name is known within this namespace.
+ * Looks for a method with the appropriate name and signature. This method
+ * examines both static and instance methods.
+ *
+ * @param element
+ * name of the element being tested
+ * @return true if its known, false if not.
+ */
- public boolean isFunctionAvailable(String function)
- {
- Method[] methods = m_classObj.getMethods();
- int nMethods = methods.length;
- for (int i = 0; i < nMethods; i++)
- {
- if (methods[i].getName().equals(function))
- return true;
- }
- return false;
- }
+ @Override
+ public boolean isElementAvailable(String element) {
+ Method[] methods = m_classObj.getMethods();
+ int nMethods = methods.length;
+ for (int i = 0; i < nMethods; i++) {
+ if (methods[i].getName().equals(element)) {
+ Class[] paramTypes = methods[i].getParameterTypes();
+ if ((paramTypes.length == 2)
+ && paramTypes[0]
+ .isAssignableFrom(org.apache.xalan.extensions.XSLProcessorContext.class)
+ && paramTypes[1]
+ .isAssignableFrom(org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExtensionCall.class)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Process a call to a function in the java class represented by this
+ * <code>ExtensionHandlerJavaClass<code>.
+ * There are three possible types of calls:
+ * <pre>
+ * Constructor:
+ * classns:new(arg1, arg2, ...)
+ *
+ * Static method:
+ * classns:method(arg1, arg2, ...)
+ *
+ * Instance method:
+ * classns:method(obj, arg1, arg2, ...)
+ * </pre>
+ * We use the following rules to determine the type of call made:
+ * <ol type="1">
+ * <li>If the function name is "new", call the best constructor for
+ * class represented by the namespace URI</li>
+ * <li>If the first argument to the function is of the class specified
+ * in the namespace or is a subclass of that class, look for the best
+ * method of the class specified in the namespace with the specified
+ * arguments. Compare all static and instance methods with the correct
+ * method name. For static methods, use all arguments in the compare.
+ * For instance methods, use all arguments after the first.</li>
+ * <li>Otherwise, select the best static or instance method matching
+ * all of the arguments. If the best method is an instance method,
+ * call the function using a default object, creating it if needed.</li>
+ * </ol>
+ *
+ * @param funcName Function name.
+ * @param args The arguments of the function call.
+ * @param methodKey A key that uniquely identifies this class and method call.
+ * @param exprContext The context in which this expression is being executed.
+ * @return the return value of the function evaluation.
+ * @throws TransformerException
+ */
- /**
- * Tests whether a certain element name is known within this namespace.
- * Looks for a method with the appropriate name and signature.
- * This method examines both static and instance methods.
- * @param element name of the element being tested
- * @return true if its known, false if not.
- */
+ @Override
+ public Object callFunction(String funcName, Vector args, Object methodKey,
+ ExpressionContext exprContext) throws TransformerException {
- public boolean isElementAvailable(String element)
- {
- Method[] methods = m_classObj.getMethods();
- int nMethods = methods.length;
- for (int i = 0; i < nMethods; i++)
- {
- if (methods[i].getName().equals(element))
- {
- Class[] paramTypes = methods[i].getParameterTypes();
- if ( (paramTypes.length == 2)
- && paramTypes[0].isAssignableFrom(
- org.apache.xalan.extensions.XSLProcessorContext.class)
- && paramTypes[1].isAssignableFrom(
- org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExtensionCall.class) )
- {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * Process a call to a function in the java class represented by
- * this <code>ExtensionHandlerJavaClass<code>.
- * There are three possible types of calls:
- * <pre>
- * Constructor:
- * classns:new(arg1, arg2, ...)
- *
- * Static method:
- * classns:method(arg1, arg2, ...)
- *
- * Instance method:
- * classns:method(obj, arg1, arg2, ...)
- * </pre>
- * We use the following rules to determine the type of call made:
- * <ol type="1">
- * <li>If the function name is "new", call the best constructor for
- * class represented by the namespace URI</li>
- * <li>If the first argument to the function is of the class specified
- * in the namespace or is a subclass of that class, look for the best
- * method of the class specified in the namespace with the specified
- * arguments. Compare all static and instance methods with the correct
- * method name. For static methods, use all arguments in the compare.
- * For instance methods, use all arguments after the first.</li>
- * <li>Otherwise, select the best static or instance method matching
- * all of the arguments. If the best method is an instance method,
- * call the function using a default object, creating it if needed.</li>
- * </ol>
- *
- * @param funcName Function name.
- * @param args The arguments of the function call.
- * @param methodKey A key that uniquely identifies this class and method call.
- * @param exprContext The context in which this expression is being executed.
- * @return the return value of the function evaluation.
- * @throws TransformerException
- */
+ Object[] methodArgs;
+ Object[][] convertedArgs;
+ Class[] paramTypes;
- public Object callFunction (String funcName,
- Vector args,
- Object methodKey,
- ExpressionContext exprContext)
- throws TransformerException
- {
+ try {
+ TransformerImpl trans = (exprContext != null) ? (TransformerImpl) exprContext
+ .getXPathContext().getOwnerObject()
+ : null;
+ if (funcName.equals("new")) { // Handle constructor call
- Object[] methodArgs;
- Object[][] convertedArgs;
- Class[] paramTypes;
+ methodArgs = new Object[args.size()];
+ convertedArgs = new Object[1][];
+ for (int i = 0; i < methodArgs.length; i++) {
+ methodArgs[i] = args.elementAt(i);
+ }
+ Constructor c = null;
+ if (methodKey != null)
+ c = (Constructor) getFromCache(methodKey, null, methodArgs);
- try
- {
- TransformerImpl trans = (exprContext != null) ?
- (TransformerImpl)exprContext.getXPathContext().getOwnerObject() : null;
- if (funcName.equals("new")) { // Handle constructor call
+ if (c != null && !trans.getDebug()) {
+ try {
+ paramTypes = c.getParameterTypes();
+ MethodResolver.convertParams(methodArgs, convertedArgs,
+ paramTypes, exprContext);
+ return c.newInstance(convertedArgs[0]);
+ } catch (InvocationTargetException ite) {
+ throw ite;
+ } catch (Exception e) {
+ // Must not have been the right one
+ }
+ }
+ c = MethodResolver.getConstructor(m_classObj, methodArgs,
+ convertedArgs, exprContext);
+ if (methodKey != null)
+ putToCache(methodKey, null, methodArgs, c);
- methodArgs = new Object[args.size()];
- convertedArgs = new Object[1][];
- for (int i = 0; i < methodArgs.length; i++)
- {
- methodArgs[i] = args.elementAt(i);
- }
- Constructor c = null;
- if (methodKey != null)
- c = (Constructor) getFromCache(methodKey, null, methodArgs);
-
- if (c != null && !trans.getDebug())
- {
- try
- {
- paramTypes = c.getParameterTypes();
- MethodResolver.convertParams(methodArgs, convertedArgs,
- paramTypes, exprContext);
- return c.newInstance(convertedArgs[0]);
- }
- catch (InvocationTargetException ite)
- {
- throw ite;
- }
- catch(Exception e)
- {
- // Must not have been the right one
- }
- }
- c = MethodResolver.getConstructor(m_classObj,
- methodArgs,
- convertedArgs,
- exprContext);
- if (methodKey != null)
- putToCache(methodKey, null, methodArgs, c);
-
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(new
- ExtensionEvent(trans, c, convertedArgs[0]));
- Object result;
- try {
- result = c.newInstance(convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(new
- ExtensionEvent(trans, c, convertedArgs[0]));
- }
- return result;
- } else
- return c.newInstance(convertedArgs[0]);
- }
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(
+ new ExtensionEvent(trans, c, convertedArgs[0]));
+ Object result;
+ try {
+ result = c.newInstance(convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(
+ new ExtensionEvent(trans, c, convertedArgs[0]));
+ }
+ return result;
+ } else
+ return c.newInstance(convertedArgs[0]);
+ }
- else
- {
+ else {
- int resolveType;
- Object targetObject = null;
- methodArgs = new Object[args.size()];
- convertedArgs = new Object[1][];
- for (int i = 0; i < methodArgs.length; i++)
- {
- methodArgs[i] = args.elementAt(i);
- }
- Method m = null;
- if (methodKey != null)
- m = (Method) getFromCache(methodKey, null, methodArgs);
-
- if (m != null && !trans.getDebug())
- {
- try
- {
- paramTypes = m.getParameterTypes();
- MethodResolver.convertParams(methodArgs, convertedArgs,
- paramTypes, exprContext);
- if (Modifier.isStatic(m.getModifiers()))
- return m.invoke(null, convertedArgs[0]);
- else
- {
- // This is tricky. We get the actual number of target arguments (excluding any
- // ExpressionContext). If we passed in the same number, we need the implied object.
- int nTargetArgs = convertedArgs[0].length;
- if (ExpressionContext.class.isAssignableFrom(paramTypes[0]))
- nTargetArgs--;
- if (methodArgs.length <= nTargetArgs)
- return m.invoke(m_defaultInstance, convertedArgs[0]);
- else
- {
- targetObject = methodArgs[0];
-
- if (targetObject instanceof XObject)
- targetObject = ((XObject) targetObject).object();
-
- return m.invoke(targetObject, convertedArgs[0]);
- }
- }
- }
- catch (InvocationTargetException ite)
- {
- throw ite;
- }
- catch(Exception e)
- {
- // Must not have been the right one
- }
- }
+ int resolveType;
+ Object targetObject = null;
+ methodArgs = new Object[args.size()];
+ convertedArgs = new Object[1][];
+ for (int i = 0; i < methodArgs.length; i++) {
+ methodArgs[i] = args.elementAt(i);
+ }
+ Method m = null;
+ if (methodKey != null)
+ m = (Method) getFromCache(methodKey, null, methodArgs);
- if (args.size() > 0)
- {
- targetObject = methodArgs[0];
+ if (m != null && !trans.getDebug()) {
+ try {
+ paramTypes = m.getParameterTypes();
+ MethodResolver.convertParams(methodArgs, convertedArgs,
+ paramTypes, exprContext);
+ if (Modifier.isStatic(m.getModifiers()))
+ return m.invoke(null, convertedArgs[0]);
+ else {
+ // This is tricky. We get the actual number of
+ // target arguments (excluding any
+ // ExpressionContext). If we passed in the same
+ // number, we need the implied object.
+ int nTargetArgs = convertedArgs[0].length;
+ if (ExpressionContext.class
+ .isAssignableFrom(paramTypes[0]))
+ nTargetArgs--;
+ if (methodArgs.length <= nTargetArgs)
+ return m.invoke(m_defaultInstance,
+ convertedArgs[0]);
+ else {
+ targetObject = methodArgs[0];
- if (targetObject instanceof XObject)
- targetObject = ((XObject) targetObject).object();
+ if (targetObject instanceof XObject)
+ targetObject = ((XObject) targetObject)
+ .object();
- if (m_classObj.isAssignableFrom(targetObject.getClass()))
- resolveType = MethodResolver.DYNAMIC;
- else
- resolveType = MethodResolver.STATIC_AND_INSTANCE;
- }
- else
- {
- targetObject = null;
- resolveType = MethodResolver.STATIC_AND_INSTANCE;
- }
+ return m.invoke(targetObject, convertedArgs[0]);
+ }
+ }
+ } catch (InvocationTargetException ite) {
+ throw ite;
+ } catch (Exception e) {
+ // Must not have been the right one
+ }
+ }
- m = MethodResolver.getMethod(m_classObj,
- funcName,
- methodArgs,
- convertedArgs,
- exprContext,
- resolveType);
- if (methodKey != null)
- putToCache(methodKey, null, methodArgs, m);
+ if (args.size() > 0) {
+ targetObject = methodArgs[0];
- if (MethodResolver.DYNAMIC == resolveType) { // First argument was object type
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(m, targetObject,
- convertedArgs[0]);
- Object result;
- try {
- result = m.invoke(targetObject, convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(m, targetObject,
- convertedArgs[0]);
- }
- return result;
- } else
- return m.invoke(targetObject, convertedArgs[0]);
- }
- else // First arg was not object. See if we need the implied object.
- {
- if (Modifier.isStatic(m.getModifiers())) {
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(m, null,
- convertedArgs[0]);
- Object result;
- try {
- result = m.invoke(null, convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(m, null,
- convertedArgs[0]);
- }
- return result;
- } else
- return m.invoke(null, convertedArgs[0]);
- }
- else
- {
- if (null == m_defaultInstance)
- {
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(new
- ExtensionEvent(trans, m_classObj));
- try {
- m_defaultInstance = m_classObj.newInstance();
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(new
- ExtensionEvent(trans, m_classObj));
- }
- } else
- m_defaultInstance = m_classObj.newInstance();
- }
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(m, m_defaultInstance,
- convertedArgs[0]);
- Object result;
- try {
- result = m.invoke(m_defaultInstance, convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(m,
- m_defaultInstance, convertedArgs[0]);
- }
- return result;
- } else
- return m.invoke(m_defaultInstance, convertedArgs[0]);
- }
- }
+ if (targetObject instanceof XObject)
+ targetObject = ((XObject) targetObject).object();
- }
- }
- catch (InvocationTargetException ite)
- {
- Throwable resultException = ite;
- Throwable targetException = ite.getTargetException();
-
- if (targetException instanceof TransformerException)
- throw ((TransformerException)targetException);
- else if (targetException != null)
- resultException = targetException;
-
- throw new TransformerException(resultException);
- }
- catch (Exception e)
- {
- // e.printStackTrace();
- throw new TransformerException(e);
- }
- }
+ if (m_classObj.isAssignableFrom(targetObject.getClass()))
+ resolveType = MethodResolver.DYNAMIC;
+ else
+ resolveType = MethodResolver.STATIC_AND_INSTANCE;
+ } else {
+ targetObject = null;
+ resolveType = MethodResolver.STATIC_AND_INSTANCE;
+ }
- /**
- * Process a call to an XPath extension function
- *
- * @param extFunction The XPath extension function
- * @param args The arguments of the function call.
- * @param exprContext The context in which this expression is being executed.
- * @return the return value of the function evaluation.
- * @throws TransformerException
- */
- public Object callFunction(FuncExtFunction extFunction,
- Vector args,
- ExpressionContext exprContext)
- throws TransformerException
- {
- return callFunction(extFunction.getFunctionName(), args,
- extFunction.getMethodKey(), exprContext);
- }
+ m = MethodResolver.getMethod(m_classObj, funcName, methodArgs,
+ convertedArgs, exprContext, resolveType);
+ if (methodKey != null)
+ putToCache(methodKey, null, methodArgs, m);
- /**
- * Process a call to this extension namespace via an element. As a side
- * effect, the results are sent to the TransformerImpl's result tree.
- * We invoke the static or instance method in the class represented by
- * by the namespace URI. If we don't already have an instance of this class,
- * we create one upon the first call.
- *
- * @param localPart Element name's local part.
- * @param element The extension element being processed.
- * @param transformer Handle to TransformerImpl.
- * @param stylesheetTree The compiled stylesheet tree.
- * @param methodKey A key that uniquely identifies this element call.
- * @throws IOException if loading trouble
- * @throws TransformerException if parsing trouble
- */
+ if (MethodResolver.DYNAMIC == resolveType) { // First
+ // argument was
+ // object type
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(m,
+ targetObject, convertedArgs[0]);
+ Object result;
+ try {
+ result = m.invoke(targetObject, convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(m,
+ targetObject, convertedArgs[0]);
+ }
+ return result;
+ } else
+ return m.invoke(targetObject, convertedArgs[0]);
+ } else // First arg was not object. See if we need the implied
+ // object.
+ {
+ if (Modifier.isStatic(m.getModifiers())) {
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(m, null,
+ convertedArgs[0]);
+ Object result;
+ try {
+ result = m.invoke(null, convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(
+ m, null, convertedArgs[0]);
+ }
+ return result;
+ } else
+ return m.invoke(null, convertedArgs[0]);
+ } else {
+ if (null == m_defaultInstance) {
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(
+ new ExtensionEvent(trans, m_classObj));
+ try {
+ m_defaultInstance = m_classObj
+ .newInstance();
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager()
+ .fireExtensionEndEvent(
+ new ExtensionEvent(trans,
+ m_classObj));
+ }
+ } else
+ m_defaultInstance = m_classObj.newInstance();
+ }
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(m,
+ m_defaultInstance, convertedArgs[0]);
+ Object result;
+ try {
+ result = m.invoke(m_defaultInstance,
+ convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(
+ m, m_defaultInstance, convertedArgs[0]);
+ }
+ return result;
+ } else
+ return m
+ .invoke(m_defaultInstance, convertedArgs[0]);
+ }
+ }
- public void processElement(String localPart,
- ElemTemplateElement element,
- TransformerImpl transformer,
- Stylesheet stylesheetTree,
- Object methodKey)
- throws TransformerException, IOException
- {
- Object result = null;
+ }
+ } catch (InvocationTargetException ite) {
+ Throwable resultException = ite;
+ Throwable targetException = ite.getTargetException();
- Method m = (Method) getFromCache(methodKey, null, null);
- if (null == m)
- {
- try
- {
- m = MethodResolver.getElementMethod(m_classObj, localPart);
- if ( (null == m_defaultInstance) &&
- !Modifier.isStatic(m.getModifiers()) ) {
- if (transformer.getDebug()) {
- transformer.getTraceManager().fireExtensionEvent(
- new ExtensionEvent(transformer, m_classObj));
- try {
- m_defaultInstance = m_classObj.newInstance();
- } catch (Exception e) {
- throw e;
- } finally {
- transformer.getTraceManager().fireExtensionEndEvent(
- new ExtensionEvent(transformer, m_classObj));
- }
- } else
- m_defaultInstance = m_classObj.newInstance();
- }
- }
- catch (Exception e)
- {
- // e.printStackTrace ();
- throw new TransformerException (e.getMessage (), e);
- }
- putToCache(methodKey, null, null, m);
- }
+ if (targetException instanceof TransformerException)
+ throw ((TransformerException) targetException);
+ else if (targetException != null)
+ resultException = targetException;
- XSLProcessorContext xpc = new XSLProcessorContext(transformer,
- stylesheetTree);
+ throw new TransformerException(resultException);
+ } catch (Exception e) {
+ // e.printStackTrace();
+ throw new TransformerException(e);
+ }
+ }
- try
- {
- if (transformer.getDebug()) {
- transformer.getTraceManager().fireExtensionEvent(m, m_defaultInstance,
- new Object[] {xpc, element});
- try {
- result = m.invoke(m_defaultInstance, new Object[] {xpc, element});
- } catch (Exception e) {
- throw e;
- } finally {
- transformer.getTraceManager().fireExtensionEndEvent(m,
- m_defaultInstance, new Object[] {xpc, element});
- }
- } else
- result = m.invoke(m_defaultInstance, new Object[] {xpc, element});
- }
- catch (InvocationTargetException e)
- {
- Throwable targetException = e.getTargetException();
-
- if (targetException instanceof TransformerException)
- throw (TransformerException)targetException;
- else if (targetException != null)
- throw new TransformerException (targetException.getMessage (),
- targetException);
- else
- throw new TransformerException (e.getMessage (), e);
- }
- catch (Exception e)
- {
- // e.printStackTrace ();
- throw new TransformerException (e.getMessage (), e);
- }
+ /**
+ * Process a call to an XPath extension function
+ *
+ * @param extFunction
+ * The XPath extension function
+ * @param args
+ * The arguments of the function call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ * @return the return value of the function evaluation.
+ * @throws TransformerException
+ */
+ @Override
+ public Object callFunction(FuncExtFunction extFunction, Vector args,
+ ExpressionContext exprContext) throws TransformerException {
+ return callFunction(extFunction.getFunctionName(), args, extFunction
+ .getMethodKey(), exprContext);
+ }
- if (result != null)
- {
- xpc.outputToResultTree (stylesheetTree, result);
- }
-
- }
-
+ /**
+ * Process a call to this extension namespace via an element. As a side
+ * effect, the results are sent to the TransformerImpl's result tree. We
+ * invoke the static or instance method in the class represented by by the
+ * namespace URI. If we don't already have an instance of this class, we
+ * create one upon the first call.
+ *
+ * @param localPart
+ * Element name's local part.
+ * @param element
+ * The extension element being processed.
+ * @param transformer
+ * Handle to TransformerImpl.
+ * @param stylesheetTree
+ * The compiled stylesheet tree.
+ * @param methodKey
+ * A key that uniquely identifies this element call.
+ * @throws IOException
+ * if loading trouble
+ * @throws TransformerException
+ * if parsing trouble
+ */
+
+ @Override
+ public void processElement(String localPart, ElemTemplateElement element,
+ TransformerImpl transformer, Stylesheet stylesheetTree,
+ Object methodKey) throws TransformerException, IOException {
+ Object result = null;
+
+ Method m = (Method) getFromCache(methodKey, null, null);
+ if (null == m) {
+ try {
+ m = MethodResolver.getElementMethod(m_classObj, localPart);
+ if ((null == m_defaultInstance)
+ && !Modifier.isStatic(m.getModifiers())) {
+ if (transformer.getDebug()) {
+ transformer.getTraceManager().fireExtensionEvent(
+ new ExtensionEvent(transformer, m_classObj));
+ try {
+ m_defaultInstance = m_classObj.newInstance();
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ transformer.getTraceManager()
+ .fireExtensionEndEvent(
+ new ExtensionEvent(transformer,
+ m_classObj));
+ }
+ } else
+ m_defaultInstance = m_classObj.newInstance();
+ }
+ } catch (Exception e) {
+ // e.printStackTrace ();
+ throw new TransformerException(e.getMessage(), e);
+ }
+ putToCache(methodKey, null, null, m);
+ }
+
+ XSLProcessorContext xpc = new XSLProcessorContext(transformer,
+ stylesheetTree);
+
+ try {
+ if (transformer.getDebug()) {
+ transformer.getTraceManager().fireExtensionEvent(m,
+ m_defaultInstance, new Object[] { xpc, element });
+ try {
+ result = m.invoke(m_defaultInstance, new Object[] { xpc,
+ element });
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ transformer.getTraceManager().fireExtensionEndEvent(m,
+ m_defaultInstance, new Object[] { xpc, element });
+ }
+ } else
+ result = m.invoke(m_defaultInstance, new Object[] { xpc,
+ element });
+ } catch (InvocationTargetException e) {
+ Throwable targetException = e.getTargetException();
+
+ if (targetException instanceof TransformerException)
+ throw (TransformerException) targetException;
+ else if (targetException != null)
+ throw new TransformerException(targetException.getMessage(),
+ targetException);
+ else
+ throw new TransformerException(e.getMessage(), e);
+ } catch (Exception e) {
+ // e.printStackTrace ();
+ throw new TransformerException(e.getMessage(), e);
+ }
+
+ if (result != null) {
+ xpc.outputToResultTree(stylesheetTree, result);
+ }
+
+ }
+
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaPackage.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaPackage.java
index d619556..6d0cc70 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaPackage.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionHandlerJavaPackage.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionHandlerJavaPackage.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: ExtensionHandlerJavaPackage.java,v 1.3 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -49,502 +49,475 @@
import org.apache.xpath.objects.XObject;
/**
- * Represents an extension namespace for XPath that handles java packages
- * that may be fully or partially specified.
- * It is recommended that the class URI be of one of the following forms:
+ * Represents an extension namespace for XPath that handles java packages that
+ * may be fully or partially specified. It is recommended that the class URI be
+ * of one of the following forms:
+ *
* <pre>
* xalan://partial.class.name
* xalan://
* http://xml.apache.org/xalan/java (which is the same as xalan://)
* </pre>
- * However, we do not enforce this. If the class name contains a
- * a /, we only use the part to the right of the rightmost slash.
- * In addition, we ignore any "class:" prefix.
- * Provides functions to test a function's existence and call a function.
- * Also provides functions to test an element's existence and call an
+ *
+ * However, we do not enforce this. If the class name contains a a /, we only
+ * use the part to the right of the rightmost slash. In addition, we ignore any
+ * "class:" prefix. Provides functions to test a function's existence and call a
+ * function. Also provides functions to test an element's existence and call an
* element.
- *
+ *
* @author <a href="mailto:garyp@firstech.com">Gary L Peskin</a>
- *
+ *
* @xsl.usage internal
*/
+public class ExtensionHandlerJavaPackage extends ExtensionHandlerJava {
-public class ExtensionHandlerJavaPackage extends ExtensionHandlerJava
-{
+ /**
+ * Construct a new extension namespace handler given all the information
+ * needed.
+ *
+ * @param namespaceUri
+ * the extension namespace URI that I'm implementing
+ * @param scriptLang
+ * language of code implementing the extension
+ * @param className
+ * the beginning of the class name of the class. This should be
+ * followed by a dot (.)
+ */
+ public ExtensionHandlerJavaPackage(String namespaceUri, String scriptLang,
+ String className) {
+ super(namespaceUri, scriptLang, className);
+ }
- /**
- * Construct a new extension namespace handler given all the information
- * needed.
- *
- * @param namespaceUri the extension namespace URI that I'm implementing
- * @param scriptLang language of code implementing the extension
- * @param className the beginning of the class name of the class. This
- * should be followed by a dot (.)
- */
- public ExtensionHandlerJavaPackage(String namespaceUri,
- String scriptLang,
- String className)
- {
- super(namespaceUri, scriptLang, className);
- }
+ /**
+ * Tests whether a certain function name is known within this namespace.
+ * Since this is for a package, we concatenate the package name used when
+ * this handler was created and the function name specified in the argument.
+ * There is no information regarding the arguments to the function call or
+ * whether the method implementing the function is a static method or an
+ * instance method.
+ *
+ * @param function
+ * name of the function being tested
+ * @return true if its known, false if not.
+ */
+ @Override
+ public boolean isFunctionAvailable(String function) {
+ try {
+ String fullName = m_className + function;
+ int lastDot = fullName.lastIndexOf(".");
+ if (lastDot >= 0) {
+ Class myClass = getClassForName(fullName.substring(0, lastDot));
+ Method[] methods = myClass.getMethods();
+ int nMethods = methods.length;
+ function = fullName.substring(lastDot + 1);
+ for (int i = 0; i < nMethods; i++) {
+ if (methods[i].getName().equals(function))
+ return true;
+ }
+ }
+ } catch (ClassNotFoundException cnfe) {
+ }
- /**
- * Tests whether a certain function name is known within this namespace.
- * Since this is for a package, we concatenate the package name used when
- * this handler was created and the function name specified in the argument.
- * There is
- * no information regarding the arguments to the function call or
- * whether the method implementing the function is a static method or
- * an instance method.
- * @param function name of the function being tested
- * @return true if its known, false if not.
- */
+ return false;
+ }
- public boolean isFunctionAvailable(String function)
- {
- try
- {
- String fullName = m_className + function;
- int lastDot = fullName.lastIndexOf(".");
- if (lastDot >= 0)
- {
- Class myClass = getClassForName(fullName.substring(0, lastDot));
- Method[] methods = myClass.getMethods();
- int nMethods = methods.length;
- function = fullName.substring(lastDot + 1);
- for (int i = 0; i < nMethods; i++)
- {
- if (methods[i].getName().equals(function))
- return true;
- }
- }
- }
- catch (ClassNotFoundException cnfe) {}
+ /**
+ * Tests whether a certain element name is known within this namespace.
+ * Looks for a method with the appropriate name and signature. This method
+ * examines both static and instance methods.
+ *
+ * @param element
+ * name of the element being tested
+ * @return true if its known, false if not.
+ */
- return false;
- }
+ @Override
+ public boolean isElementAvailable(String element) {
+ try {
+ String fullName = m_className + element;
+ int lastDot = fullName.lastIndexOf(".");
+ if (lastDot >= 0) {
+ Class myClass = getClassForName(fullName.substring(0, lastDot));
+ Method[] methods = myClass.getMethods();
+ int nMethods = methods.length;
+ element = fullName.substring(lastDot + 1);
+ for (int i = 0; i < nMethods; i++) {
+ if (methods[i].getName().equals(element)) {
+ Class[] paramTypes = methods[i].getParameterTypes();
+ if ((paramTypes.length == 2)
+ && paramTypes[0]
+ .isAssignableFrom(org.apache.xalan.extensions.XSLProcessorContext.class)
+ && paramTypes[1]
+ .isAssignableFrom(org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExtensionCall.class)) {
+ return true;
+ }
+ }
+ }
+ }
+ } catch (ClassNotFoundException cnfe) {
+ }
+ return false;
+ }
- /**
- * Tests whether a certain element name is known within this namespace.
- * Looks for a method with the appropriate name and signature.
- * This method examines both static and instance methods.
- * @param element name of the element being tested
- * @return true if its known, false if not.
- */
+ /**
+ * Process a call to a function in the package java namespace. There are
+ * three possible types of calls:
+ *
+ * <pre>
+ * Constructor:
+ * packagens:class.name.new(arg1, arg2, ...)
+ *
+ * Static method:
+ * packagens:class.name.method(arg1, arg2, ...)
+ *
+ * Instance method:
+ * packagens:method(obj, arg1, arg2, ...)
+ * </pre>
+ *
+ * We use the following rules to determine the type of call made:
+ * <ol type="1">
+ * <li>If the function name ends with a ".new", call the best constructor
+ * for class whose name is formed by concatenating the value specified on
+ * the namespace with the value specified in the function invocation before
+ * ".new".</li>
+ * <li>If the function name contains a period, call the best static method
+ * "method" in the class whose name is formed by concatenating the value
+ * specified on the namespace with the value specified in the function
+ * invocation.</li>
+ * <li>Otherwise, call the best instance method "method" in the class whose
+ * name is formed by concatenating the value specified on the namespace with
+ * the value specified in the function invocation. Note that a static method
+ * of the same name will <i>not</i> be called in the current
+ * implementation. This module does not verify that the obj argument is a
+ * member of the package namespace.</li>
+ * </ol>
+ *
+ * @param funcName
+ * Function name.
+ * @param args
+ * The arguments of the function call.
+ * @param methodKey
+ * A key that uniquely identifies this class and method call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ * @return the return value of the function evaluation.
+ *
+ * @throws TransformerException
+ * if parsing trouble
+ */
- public boolean isElementAvailable(String element)
- {
- try
- {
- String fullName = m_className + element;
- int lastDot = fullName.lastIndexOf(".");
- if (lastDot >= 0)
- {
- Class myClass = getClassForName(fullName.substring(0, lastDot));
- Method[] methods = myClass.getMethods();
- int nMethods = methods.length;
- element = fullName.substring(lastDot + 1);
- for (int i = 0; i < nMethods; i++)
- {
- if (methods[i].getName().equals(element))
- {
- Class[] paramTypes = methods[i].getParameterTypes();
- if ( (paramTypes.length == 2)
- && paramTypes[0].isAssignableFrom(
- org.apache.xalan.extensions.XSLProcessorContext.class)
- && paramTypes[1].isAssignableFrom(
- org.eclipse.wst.xsl.core.internal.compiler.xslt10.templates.ElemExtensionCall.class) )
- {
- return true;
- }
- }
- }
- }
- }
- catch (ClassNotFoundException cnfe) {}
+ @Override
+ public Object callFunction(String funcName, Vector args, Object methodKey,
+ ExpressionContext exprContext) throws TransformerException {
- return false;
- }
+ String className;
+ String methodName;
+ Class classObj;
+ Object targetObject;
+ int lastDot = funcName.lastIndexOf(".");
+ Object[] methodArgs;
+ Object[][] convertedArgs;
+ Class[] paramTypes;
+ try {
+ TransformerImpl trans = (exprContext != null) ? (TransformerImpl) exprContext
+ .getXPathContext().getOwnerObject()
+ : null;
+ if (funcName.endsWith(".new")) { // Handle constructor call
- /**
- * Process a call to a function in the package java namespace.
- * There are three possible types of calls:
- * <pre>
- * Constructor:
- * packagens:class.name.new(arg1, arg2, ...)
- *
- * Static method:
- * packagens:class.name.method(arg1, arg2, ...)
- *
- * Instance method:
- * packagens:method(obj, arg1, arg2, ...)
- * </pre>
- * We use the following rules to determine the type of call made:
- * <ol type="1">
- * <li>If the function name ends with a ".new", call the best constructor for
- * class whose name is formed by concatenating the value specified on
- * the namespace with the value specified in the function invocation
- * before ".new".</li>
- * <li>If the function name contains a period, call the best static method "method"
- * in the class whose name is formed by concatenating the value specified on
- * the namespace with the value specified in the function invocation.</li>
- * <li>Otherwise, call the best instance method "method"
- * in the class whose name is formed by concatenating the value specified on
- * the namespace with the value specified in the function invocation.
- * Note that a static method of the same
- * name will <i>not</i> be called in the current implementation. This
- * module does not verify that the obj argument is a member of the
- * package namespace.</li>
- * </ol>
- *
- * @param funcName Function name.
- * @param args The arguments of the function call.
- * @param methodKey A key that uniquely identifies this class and method call.
- * @param exprContext The context in which this expression is being executed.
- * @return the return value of the function evaluation.
- *
- * @throws TransformerException if parsing trouble
- */
+ methodArgs = new Object[args.size()];
+ convertedArgs = new Object[1][];
+ for (int i = 0; i < methodArgs.length; i++) {
+ methodArgs[i] = args.elementAt(i);
+ }
- public Object callFunction (String funcName,
- Vector args,
- Object methodKey,
- ExpressionContext exprContext)
- throws TransformerException
- {
+ Constructor c = (methodKey != null) ? (Constructor) getFromCache(
+ methodKey, null, methodArgs)
+ : null;
- String className;
- String methodName;
- Class classObj;
- Object targetObject;
- int lastDot = funcName.lastIndexOf(".");
- Object[] methodArgs;
- Object[][] convertedArgs;
- Class[] paramTypes;
+ if (c != null) {
+ try {
+ paramTypes = c.getParameterTypes();
+ MethodResolver.convertParams(methodArgs, convertedArgs,
+ paramTypes, exprContext);
+ return c.newInstance(convertedArgs[0]);
+ } catch (InvocationTargetException ite) {
+ throw ite;
+ } catch (Exception e) {
+ // Must not have been the right one
+ }
+ }
+ className = m_className + funcName.substring(0, lastDot);
+ try {
+ classObj = getClassForName(className);
+ } catch (ClassNotFoundException e) {
+ throw new TransformerException(e);
+ }
+ c = MethodResolver.getConstructor(classObj, methodArgs,
+ convertedArgs, exprContext);
+ if (methodKey != null)
+ putToCache(methodKey, null, methodArgs, c);
- try
- {
- TransformerImpl trans = (exprContext != null) ?
- (TransformerImpl)exprContext.getXPathContext().getOwnerObject() : null;
- if (funcName.endsWith(".new")) { // Handle constructor call
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(
+ new ExtensionEvent(trans, c, convertedArgs[0]));
+ Object result;
+ try {
+ result = c.newInstance(convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(
+ new ExtensionEvent(trans, c, convertedArgs[0]));
+ }
+ return result;
+ } else
+ return c.newInstance(convertedArgs[0]);
+ }
- methodArgs = new Object[args.size()];
- convertedArgs = new Object[1][];
- for (int i = 0; i < methodArgs.length; i++)
- {
- methodArgs[i] = args.elementAt(i);
- }
-
- Constructor c = (methodKey != null) ?
- (Constructor) getFromCache(methodKey, null, methodArgs) : null;
-
- if (c != null)
- {
- try
- {
- paramTypes = c.getParameterTypes();
- MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext);
- return c.newInstance(convertedArgs[0]);
- }
- catch (InvocationTargetException ite)
- {
- throw ite;
- }
- catch(Exception e)
- {
- // Must not have been the right one
- }
- }
- className = m_className + funcName.substring(0, lastDot);
- try
- {
- classObj = getClassForName(className);
- }
- catch (ClassNotFoundException e)
- {
- throw new TransformerException(e);
- }
- c = MethodResolver.getConstructor(classObj,
- methodArgs,
- convertedArgs,
- exprContext);
- if (methodKey != null)
- putToCache(methodKey, null, methodArgs, c);
-
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(new ExtensionEvent(trans, c, convertedArgs[0]));
- Object result;
- try {
- result = c.newInstance(convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(new ExtensionEvent(trans, c, convertedArgs[0]));
- }
- return result;
- } else
- return c.newInstance(convertedArgs[0]);
- }
+ else if (-1 != lastDot) { // Handle static method call
- else if (-1 != lastDot) { // Handle static method call
+ methodArgs = new Object[args.size()];
+ convertedArgs = new Object[1][];
+ for (int i = 0; i < methodArgs.length; i++) {
+ methodArgs[i] = args.elementAt(i);
+ }
+ Method m = (methodKey != null) ? (Method) getFromCache(
+ methodKey, null, methodArgs) : null;
- methodArgs = new Object[args.size()];
- convertedArgs = new Object[1][];
- for (int i = 0; i < methodArgs.length; i++)
- {
- methodArgs[i] = args.elementAt(i);
- }
- Method m = (methodKey != null) ?
- (Method) getFromCache(methodKey, null, methodArgs) : null;
-
- if (m != null && !trans.getDebug())
- {
- try
- {
- paramTypes = m.getParameterTypes();
- MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext);
- return m.invoke(null, convertedArgs[0]);
- }
- catch (InvocationTargetException ite)
- {
- throw ite;
- }
- catch(Exception e)
- {
- // Must not have been the right one
- }
- }
- className = m_className + funcName.substring(0, lastDot);
- methodName = funcName.substring(lastDot + 1);
- try
- {
- classObj = getClassForName(className);
- }
- catch (ClassNotFoundException e)
- {
- throw new TransformerException(e);
- }
- m = MethodResolver.getMethod(classObj,
- methodName,
- methodArgs,
- convertedArgs,
- exprContext,
- MethodResolver.STATIC_ONLY);
- if (methodKey != null)
- putToCache(methodKey, null, methodArgs, m);
-
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(m, null, convertedArgs[0]);
- Object result;
- try {
- result = m.invoke(null, convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(m, null, convertedArgs[0]);
- }
- return result;
- }
- else
- return m.invoke(null, convertedArgs[0]);
- }
+ if (m != null && !trans.getDebug()) {
+ try {
+ paramTypes = m.getParameterTypes();
+ MethodResolver.convertParams(methodArgs, convertedArgs,
+ paramTypes, exprContext);
+ return m.invoke(null, convertedArgs[0]);
+ } catch (InvocationTargetException ite) {
+ throw ite;
+ } catch (Exception e) {
+ // Must not have been the right one
+ }
+ }
+ className = m_className + funcName.substring(0, lastDot);
+ methodName = funcName.substring(lastDot + 1);
+ try {
+ classObj = getClassForName(className);
+ } catch (ClassNotFoundException e) {
+ throw new TransformerException(e);
+ }
+ m = MethodResolver.getMethod(classObj, methodName, methodArgs,
+ convertedArgs, exprContext, MethodResolver.STATIC_ONLY);
+ if (methodKey != null)
+ putToCache(methodKey, null, methodArgs, m);
- else { // Handle instance method call
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(m, null,
+ convertedArgs[0]);
+ Object result;
+ try {
+ result = m.invoke(null, convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(m, null,
+ convertedArgs[0]);
+ }
+ return result;
+ } else
+ return m.invoke(null, convertedArgs[0]);
+ }
- if (args.size() < 1)
- {
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_INSTANCE_MTHD_CALL_REQUIRES, new Object[]{funcName })); //"Instance method call to method " + funcName
- //+ " requires an Object instance as first argument");
- }
- targetObject = args.elementAt(0);
- if (targetObject instanceof XObject) // Next level down for XObjects
- targetObject = ((XObject) targetObject).object();
- methodArgs = new Object[args.size() - 1];
- convertedArgs = new Object[1][];
- for (int i = 0; i < methodArgs.length; i++)
- {
- methodArgs[i] = args.elementAt(i+1);
- }
- Method m = (methodKey != null) ?
- (Method) getFromCache(methodKey, targetObject, methodArgs) : null;
-
- if (m != null)
- {
- try
- {
- paramTypes = m.getParameterTypes();
- MethodResolver.convertParams(methodArgs, convertedArgs, paramTypes, exprContext);
- return m.invoke(targetObject, convertedArgs[0]);
- }
- catch (InvocationTargetException ite)
- {
- throw ite;
- }
- catch(Exception e)
- {
- // Must not have been the right one
- }
- }
- classObj = targetObject.getClass();
- m = MethodResolver.getMethod(classObj,
- funcName,
- methodArgs,
- convertedArgs,
- exprContext,
- MethodResolver.INSTANCE_ONLY);
- if (methodKey != null)
- putToCache(methodKey, targetObject, methodArgs, m);
-
- if (trans != null && trans.getDebug()) {
- trans.getTraceManager().fireExtensionEvent(m, targetObject, convertedArgs[0]);
- Object result;
- try {
- result = m.invoke(targetObject, convertedArgs[0]);
- } catch (Exception e) {
- throw e;
- } finally {
- trans.getTraceManager().fireExtensionEndEvent(m, targetObject, convertedArgs[0]);
- }
- return result;
- } else
- return m.invoke(targetObject, convertedArgs[0]);
- }
- }
- catch (InvocationTargetException ite)
- {
- Throwable resultException = ite;
- Throwable targetException = ite.getTargetException();
-
- if (targetException instanceof TransformerException)
- throw ((TransformerException)targetException);
- else if (targetException != null)
- resultException = targetException;
-
- throw new TransformerException(resultException);
- }
- catch (Exception e)
- {
- // e.printStackTrace();
- throw new TransformerException(e);
- }
- }
+ else { // Handle instance method call
- /**
- * Process a call to an XPath extension function
- *
- * @param extFunction The XPath extension function
- * @param args The arguments of the function call.
- * @param exprContext The context in which this expression is being executed.
- * @return the return value of the function evaluation.
- * @throws TransformerException
- */
- public Object callFunction(FuncExtFunction extFunction,
- Vector args,
- ExpressionContext exprContext)
- throws TransformerException
- {
- return callFunction(extFunction.getFunctionName(), args,
- extFunction.getMethodKey(), exprContext);
- }
+ if (args.size() < 1) {
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_INSTANCE_MTHD_CALL_REQUIRES,
+ new Object[] { funcName })); // "Instance method
+ // call to method "
+ // + funcName
+ // + " requires an Object instance as first argument");
+ }
+ targetObject = args.elementAt(0);
+ if (targetObject instanceof XObject) // Next level down for
+ // XObjects
+ targetObject = ((XObject) targetObject).object();
+ methodArgs = new Object[args.size() - 1];
+ convertedArgs = new Object[1][];
+ for (int i = 0; i < methodArgs.length; i++) {
+ methodArgs[i] = args.elementAt(i + 1);
+ }
+ Method m = (methodKey != null) ? (Method) getFromCache(
+ methodKey, targetObject, methodArgs) : null;
- /**
- * Process a call to this extension namespace via an element. As a side
- * effect, the results are sent to the TransformerImpl's result tree.
- * For this namespace, only static element methods are currently supported.
- * If instance methods are needed, please let us know your requirements.
- * @param localPart Element name's local part.
- * @param element The extension element being processed.
- * @param transformer Handle to TransformerImpl.
- * @param stylesheetTree The compiled stylesheet tree.
- * @param methodKey A key that uniquely identifies this element call.
- * @throws IOException if loading trouble
- * @throws TransformerException if parsing trouble
- */
+ if (m != null) {
+ try {
+ paramTypes = m.getParameterTypes();
+ MethodResolver.convertParams(methodArgs, convertedArgs,
+ paramTypes, exprContext);
+ return m.invoke(targetObject, convertedArgs[0]);
+ } catch (InvocationTargetException ite) {
+ throw ite;
+ } catch (Exception e) {
+ // Must not have been the right one
+ }
+ }
+ classObj = targetObject.getClass();
+ m = MethodResolver.getMethod(classObj, funcName, methodArgs,
+ convertedArgs, exprContext,
+ MethodResolver.INSTANCE_ONLY);
+ if (methodKey != null)
+ putToCache(methodKey, targetObject, methodArgs, m);
- public void processElement (String localPart,
- ElemTemplateElement element,
- TransformerImpl transformer,
- Stylesheet stylesheetTree,
- Object methodKey)
- throws TransformerException, IOException
- {
- Object result = null;
- Class classObj;
+ if (trans != null && trans.getDebug()) {
+ trans.getTraceManager().fireExtensionEvent(m, targetObject,
+ convertedArgs[0]);
+ Object result;
+ try {
+ result = m.invoke(targetObject, convertedArgs[0]);
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ trans.getTraceManager().fireExtensionEndEvent(m,
+ targetObject, convertedArgs[0]);
+ }
+ return result;
+ } else
+ return m.invoke(targetObject, convertedArgs[0]);
+ }
+ } catch (InvocationTargetException ite) {
+ Throwable resultException = ite;
+ Throwable targetException = ite.getTargetException();
- Method m = (Method) getFromCache(methodKey, null, null);
- if (null == m)
- {
- try
- {
- String fullName = m_className + localPart;
- int lastDot = fullName.lastIndexOf(".");
- if (lastDot < 0)
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_INVALID_ELEMENT_NAME, new Object[]{fullName })); //"Invalid element name specified " + fullName);
- try
- {
- classObj = getClassForName(fullName.substring(0, lastDot));
- }
- catch (ClassNotFoundException e)
- {
- throw new TransformerException(e);
- }
- localPart = fullName.substring(lastDot + 1);
- m = MethodResolver.getElementMethod(classObj, localPart);
- if (!Modifier.isStatic(m.getModifiers()))
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_ELEMENT_NAME_METHOD_STATIC, new Object[]{fullName })); //"Element name method must be static " + fullName);
- }
- catch (Exception e)
- {
- // e.printStackTrace ();
- throw new TransformerException (e);
- }
- putToCache(methodKey, null, null, m);
- }
+ if (targetException instanceof TransformerException)
+ throw ((TransformerException) targetException);
+ else if (targetException != null)
+ resultException = targetException;
- XSLProcessorContext xpc = new XSLProcessorContext(transformer,
- stylesheetTree);
+ throw new TransformerException(resultException);
+ } catch (Exception e) {
+ // e.printStackTrace();
+ throw new TransformerException(e);
+ }
+ }
- try
- {
- if (transformer.getDebug()) {
- transformer.getTraceManager().fireExtensionEvent(m, null, new Object[] {xpc, element});
- try {
- result = m.invoke(null, new Object[] {xpc, element});
- } catch (Exception e) {
- throw e;
- } finally {
- transformer.getTraceManager().fireExtensionEndEvent(m, null, new Object[] {xpc, element});
- }
- } else
- result = m.invoke(null, new Object[] {xpc, element});
- }
- catch (InvocationTargetException ite)
- {
- Throwable resultException = ite;
- Throwable targetException = ite.getTargetException();
-
- if (targetException instanceof TransformerException)
- throw ((TransformerException)targetException);
- else if (targetException != null)
- resultException = targetException;
-
- throw new TransformerException(resultException);
- }
- catch (Exception e)
- {
- // e.printStackTrace ();
- throw new TransformerException (e);
- }
+ /**
+ * Process a call to an XPath extension function
+ *
+ * @param extFunction
+ * The XPath extension function
+ * @param args
+ * The arguments of the function call.
+ * @param exprContext
+ * The context in which this expression is being executed.
+ * @return the return value of the function evaluation.
+ * @throws TransformerException
+ */
+ @Override
+ public Object callFunction(FuncExtFunction extFunction, Vector args,
+ ExpressionContext exprContext) throws TransformerException {
+ return callFunction(extFunction.getFunctionName(), args, extFunction
+ .getMethodKey(), exprContext);
+ }
- if (result != null)
- {
- xpc.outputToResultTree (stylesheetTree, result);
- }
-
- }
+ /**
+ * Process a call to this extension namespace via an element. As a side
+ * effect, the results are sent to the TransformerImpl's result tree. For
+ * this namespace, only static element methods are currently supported. If
+ * instance methods are needed, please let us know your requirements.
+ *
+ * @param localPart
+ * Element name's local part.
+ * @param element
+ * The extension element being processed.
+ * @param transformer
+ * Handle to TransformerImpl.
+ * @param stylesheetTree
+ * The compiled stylesheet tree.
+ * @param methodKey
+ * A key that uniquely identifies this element call.
+ * @throws IOException
+ * if loading trouble
+ * @throws TransformerException
+ * if parsing trouble
+ */
+
+ @Override
+ public void processElement(String localPart, ElemTemplateElement element,
+ TransformerImpl transformer, Stylesheet stylesheetTree,
+ Object methodKey) throws TransformerException, IOException {
+ Object result = null;
+ Class classObj;
+
+ Method m = (Method) getFromCache(methodKey, null, null);
+ if (null == m) {
+ try {
+ String fullName = m_className + localPart;
+ int lastDot = fullName.lastIndexOf(".");
+ if (lastDot < 0)
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_INVALID_ELEMENT_NAME,
+ new Object[] { fullName })); // "Invalid element
+ // name specified "
+ // + fullName);
+ try {
+ classObj = getClassForName(fullName.substring(0, lastDot));
+ } catch (ClassNotFoundException e) {
+ throw new TransformerException(e);
+ }
+ localPart = fullName.substring(lastDot + 1);
+ m = MethodResolver.getElementMethod(classObj, localPart);
+ if (!Modifier.isStatic(m.getModifiers()))
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_ELEMENT_NAME_METHOD_STATIC,
+ new Object[] { fullName })); // "Element name
+ // method must be
+ // static " +
+ // fullName);
+ } catch (Exception e) {
+ // e.printStackTrace ();
+ throw new TransformerException(e);
+ }
+ putToCache(methodKey, null, null, m);
+ }
+
+ XSLProcessorContext xpc = new XSLProcessorContext(transformer,
+ stylesheetTree);
+
+ try {
+ if (transformer.getDebug()) {
+ transformer.getTraceManager().fireExtensionEvent(m, null,
+ new Object[] { xpc, element });
+ try {
+ result = m.invoke(null, new Object[] { xpc, element });
+ } catch (Exception e) {
+ throw e;
+ } finally {
+ transformer.getTraceManager().fireExtensionEndEvent(m,
+ null, new Object[] { xpc, element });
+ }
+ } else
+ result = m.invoke(null, new Object[] { xpc, element });
+ } catch (InvocationTargetException ite) {
+ Throwable resultException = ite;
+ Throwable targetException = ite.getTargetException();
+
+ if (targetException instanceof TransformerException)
+ throw ((TransformerException) targetException);
+ else if (targetException != null)
+ resultException = targetException;
+
+ throw new TransformerException(resultException);
+ } catch (Exception e) {
+ // e.printStackTrace ();
+ throw new TransformerException(e);
+ }
+
+ if (result != null) {
+ xpc.outputToResultTree(stylesheetTree, result);
+ }
+
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceContext.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceContext.java
index ca37131..6b0b728 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceContext.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceContext.java
@@ -35,117 +35,111 @@
import org.eclipse.wst.xsl.core.compiler.xslt10.res.XSLTErrorResources;
/**
- * A sample implementation of NamespaceContext, with support for
- * EXSLT extension functions and Java extension functions.
+ * A sample implementation of NamespaceContext, with support for EXSLT extension
+ * functions and Java extension functions.
*/
@SuppressWarnings("nls")
-public class ExtensionNamespaceContext implements NamespaceContext
-{
- public static final String EXSLT_PREFIX = "exslt";
- public static final String EXSLT_URI = "http://exslt.org/common";
- public static final String EXSLT_MATH_PREFIX = "math";
- public static final String EXSLT_MATH_URI = "http://exslt.org/math";
- public static final String EXSLT_SET_PREFIX = "set";
- public static final String EXSLT_SET_URI = "http://exslt.org/sets";
- public static final String EXSLT_STRING_PREFIX = "str";
- public static final String EXSLT_STRING_URI = "http://exslt.org/strings";
- public static final String EXSLT_DATETIME_PREFIX = "datetime";
- public static final String EXSLT_DATETIME_URI = "http://exslt.org/dates-and-times";
- public static final String EXSLT_DYNAMIC_PREFIX = "dyn";
- public static final String EXSLT_DYNAMIC_URI = "http://exslt.org/dynamic";
- public static final String JAVA_EXT_PREFIX = "java";
- public static final String JAVA_EXT_URI = "http://xml.apache.org/xalan/java";
-
- /**
- * Return the namespace uri for a given prefix
- */
- public String getNamespaceURI(String prefix)
- {
- if (prefix == null)
- throw new IllegalArgumentException(
- Messages.createMessage(
- XSLTErrorResources.ER_NAMESPACE_CONTEXT_NULL_PREFIX, null));
-
- if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX))
- return XMLConstants.NULL_NS_URI;
- else if (prefix.equals(XMLConstants.XML_NS_PREFIX))
- return XMLConstants.XML_NS_URI;
- else if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE))
- return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
- else if (prefix.equals(EXSLT_PREFIX))
- return EXSLT_URI;
- else if (prefix.equals(EXSLT_MATH_PREFIX))
- return EXSLT_MATH_URI;
- else if (prefix.equals(EXSLT_SET_PREFIX))
- return EXSLT_SET_URI;
- else if (prefix.equals(EXSLT_STRING_PREFIX))
- return EXSLT_STRING_URI;
- else if (prefix.equals(EXSLT_DATETIME_PREFIX))
- return EXSLT_DATETIME_URI;
- else if (prefix.equals(EXSLT_DYNAMIC_PREFIX))
- return EXSLT_DYNAMIC_URI;
- else if (prefix.equals(JAVA_EXT_PREFIX))
- return JAVA_EXT_URI;
- else
- return XMLConstants.NULL_NS_URI;
- }
-
- /**
- * Return the prefix for a given namespace uri.
- */
- public String getPrefix(String namespace)
- {
- if (namespace == null)
- throw new IllegalArgumentException(
- Messages.createMessage(
- XSLTErrorResources.ER_NAMESPACE_CONTEXT_NULL_NAMESPACE, null));
-
- if (namespace.equals(XMLConstants.XML_NS_URI))
- return XMLConstants.XML_NS_PREFIX;
- else if (namespace.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI))
- return XMLConstants.XMLNS_ATTRIBUTE;
- else if (namespace.equals(EXSLT_URI))
- return EXSLT_PREFIX;
- else if (namespace.equals(EXSLT_MATH_URI))
- return EXSLT_MATH_PREFIX;
- else if (namespace.equals(EXSLT_SET_URI))
- return EXSLT_SET_PREFIX;
- else if (namespace.equals(EXSLT_STRING_URI))
- return EXSLT_STRING_PREFIX;
- else if (namespace.equals(EXSLT_DATETIME_URI))
- return EXSLT_DATETIME_PREFIX;
- else if (namespace.equals(EXSLT_DYNAMIC_URI))
- return EXSLT_DYNAMIC_PREFIX;
- else if (namespace.equals(JAVA_EXT_URI))
- return JAVA_EXT_PREFIX;
- else
- return null;
- }
-
- public Iterator getPrefixes(String namespace)
- {
- final String result = getPrefix(namespace);
-
- return new Iterator () {
-
- private boolean isFirstIteration = (result != null);
-
- public boolean hasNext() {
- return isFirstIteration;
- }
-
- public Object next() {
- if (isFirstIteration) {
- isFirstIteration = false;
- return result;
- }
- else
- return null;
- }
-
- public void remove() {
- throw new UnsupportedOperationException();
- }
- };
- }
+public class ExtensionNamespaceContext implements NamespaceContext {
+ public static final String EXSLT_PREFIX = "exslt";
+ public static final String EXSLT_URI = "http://exslt.org/common";
+ public static final String EXSLT_MATH_PREFIX = "math";
+ public static final String EXSLT_MATH_URI = "http://exslt.org/math";
+ public static final String EXSLT_SET_PREFIX = "set";
+ public static final String EXSLT_SET_URI = "http://exslt.org/sets";
+ public static final String EXSLT_STRING_PREFIX = "str";
+ public static final String EXSLT_STRING_URI = "http://exslt.org/strings";
+ public static final String EXSLT_DATETIME_PREFIX = "datetime";
+ public static final String EXSLT_DATETIME_URI = "http://exslt.org/dates-and-times";
+ public static final String EXSLT_DYNAMIC_PREFIX = "dyn";
+ public static final String EXSLT_DYNAMIC_URI = "http://exslt.org/dynamic";
+ public static final String JAVA_EXT_PREFIX = "java";
+ public static final String JAVA_EXT_URI = "http://xml.apache.org/xalan/java";
+
+ /**
+ * Return the namespace uri for a given prefix
+ */
+ public String getNamespaceURI(String prefix) {
+ if (prefix == null)
+ throw new IllegalArgumentException(Messages.createMessage(
+ XSLTErrorResources.ER_NAMESPACE_CONTEXT_NULL_PREFIX, null));
+
+ if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX))
+ return XMLConstants.NULL_NS_URI;
+ else if (prefix.equals(XMLConstants.XML_NS_PREFIX))
+ return XMLConstants.XML_NS_URI;
+ else if (prefix.equals(XMLConstants.XMLNS_ATTRIBUTE))
+ return XMLConstants.XMLNS_ATTRIBUTE_NS_URI;
+ else if (prefix.equals(EXSLT_PREFIX))
+ return EXSLT_URI;
+ else if (prefix.equals(EXSLT_MATH_PREFIX))
+ return EXSLT_MATH_URI;
+ else if (prefix.equals(EXSLT_SET_PREFIX))
+ return EXSLT_SET_URI;
+ else if (prefix.equals(EXSLT_STRING_PREFIX))
+ return EXSLT_STRING_URI;
+ else if (prefix.equals(EXSLT_DATETIME_PREFIX))
+ return EXSLT_DATETIME_URI;
+ else if (prefix.equals(EXSLT_DYNAMIC_PREFIX))
+ return EXSLT_DYNAMIC_URI;
+ else if (prefix.equals(JAVA_EXT_PREFIX))
+ return JAVA_EXT_URI;
+ else
+ return XMLConstants.NULL_NS_URI;
+ }
+
+ /**
+ * Return the prefix for a given namespace uri.
+ */
+ public String getPrefix(String namespace) {
+ if (namespace == null)
+ throw new IllegalArgumentException(Messages.createMessage(
+ XSLTErrorResources.ER_NAMESPACE_CONTEXT_NULL_NAMESPACE,
+ null));
+
+ if (namespace.equals(XMLConstants.XML_NS_URI))
+ return XMLConstants.XML_NS_PREFIX;
+ else if (namespace.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI))
+ return XMLConstants.XMLNS_ATTRIBUTE;
+ else if (namespace.equals(EXSLT_URI))
+ return EXSLT_PREFIX;
+ else if (namespace.equals(EXSLT_MATH_URI))
+ return EXSLT_MATH_PREFIX;
+ else if (namespace.equals(EXSLT_SET_URI))
+ return EXSLT_SET_PREFIX;
+ else if (namespace.equals(EXSLT_STRING_URI))
+ return EXSLT_STRING_PREFIX;
+ else if (namespace.equals(EXSLT_DATETIME_URI))
+ return EXSLT_DATETIME_PREFIX;
+ else if (namespace.equals(EXSLT_DYNAMIC_URI))
+ return EXSLT_DYNAMIC_PREFIX;
+ else if (namespace.equals(JAVA_EXT_URI))
+ return JAVA_EXT_PREFIX;
+ else
+ return null;
+ }
+
+ public Iterator getPrefixes(String namespace) {
+ final String result = getPrefix(namespace);
+
+ return new Iterator() {
+
+ private boolean isFirstIteration = (result != null);
+
+ public boolean hasNext() {
+ return isFirstIteration;
+ }
+
+ public Object next() {
+ if (isFirstIteration) {
+ isFirstIteration = false;
+ return result;
+ } else
+ return null;
+ }
+
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceSupport.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceSupport.java
index e2e91c5..5f026dd 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceSupport.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespaceSupport.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionNamespaceSupport.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExtensionNamespaceSupport.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -35,82 +35,75 @@
import javax.xml.transform.TransformerException;
/**
- * During styleseet composition, an ExtensionNamespaceSupport object is created for each extension
- * namespace the stylesheet uses. At the beginning of a transformation, TransformerImpl generates
- * an ExtensionHandler for each of these objects and adds an entry to the ExtensionsTable hashtable.
+ * During styleseet composition, an ExtensionNamespaceSupport object is created
+ * for each extension namespace the stylesheet uses. At the beginning of a
+ * transformation, TransformerImpl generates an ExtensionHandler for each of
+ * these objects and adds an entry to the ExtensionsTable hashtable.
*/
-public class ExtensionNamespaceSupport
-{
- // Namespace, ExtensionHandler class name, constructor signature
- // and arguments.
- String m_namespace = null;
- String m_handlerClass = null;
- Class [] m_sig = null;
- Object [] m_args = null;
-
- public ExtensionNamespaceSupport(String namespace,
- String handlerClass,
- Object[] constructorArgs)
- {
- m_namespace = namespace;
- m_handlerClass = handlerClass;
- m_args = constructorArgs;
- // Create the constructor signature.
- m_sig = new Class[m_args.length];
- for (int i = 0; i < m_args.length; i++)
- {
- if (m_args[i] != null)
- m_sig[i] = m_args[i].getClass();//System.out.println("arg class " + i + " " +m_sig[i]);
- else // If an arguments is null, pick the constructor later.
- {
- m_sig = null;
- break;
- }
- }
- }
-
- public String getNamespace()
- {
- return m_namespace;
- }
-
- /**
- * Launch the ExtensionHandler that this ExtensionNamespaceSupport object defines.
- */
- public ExtensionHandler launch()
- throws TransformerException
- {
- ExtensionHandler handler = null;
- try
- {
- Class cl = ExtensionHandler.getClassForName(m_handlerClass);
- Constructor con = null;
- //System.out.println("class " + cl + " " + m_args + " " + m_args.length + " " + m_sig);
- if (m_sig != null)
- con = cl.getConstructor(m_sig);
- else // Pick the constructor based on number of args.
- {
- Constructor[] cons = cl.getConstructors();
- for (int i = 0; i < cons.length; i ++)
- {
- if (cons[i].getParameterTypes().length == m_args.length)
- {
- con = cons[i];
- break;
- }
- }
- }
- // System.out.println("constructor " + con);
- if (con != null)
- handler = (ExtensionHandler)con.newInstance(m_args);
- else
- throw new TransformerException("ExtensionHandler constructor not found");
- }
- catch (Exception e)
- {
- throw new TransformerException(e);
- }
- return handler;
- }
+public class ExtensionNamespaceSupport {
+ // Namespace, ExtensionHandler class name, constructor signature
+ // and arguments.
+ String m_namespace = null;
+ String m_handlerClass = null;
+ Class[] m_sig = null;
+ Object[] m_args = null;
+
+ public ExtensionNamespaceSupport(String namespace, String handlerClass,
+ Object[] constructorArgs) {
+ m_namespace = namespace;
+ m_handlerClass = handlerClass;
+ m_args = constructorArgs;
+ // Create the constructor signature.
+ m_sig = new Class[m_args.length];
+ for (int i = 0; i < m_args.length; i++) {
+ if (m_args[i] != null)
+ m_sig[i] = m_args[i].getClass();// System.out.println("arg class
+ // " + i + " " +m_sig[i]);
+ else // If an arguments is null, pick the constructor later.
+ {
+ m_sig = null;
+ break;
+ }
+ }
+ }
+
+ public String getNamespace() {
+ return m_namespace;
+ }
+
+ /**
+ * Launch the ExtensionHandler that this ExtensionNamespaceSupport object
+ * defines.
+ */
+ public ExtensionHandler launch() throws TransformerException {
+ ExtensionHandler handler = null;
+ try {
+ Class cl = ExtensionHandler.getClassForName(m_handlerClass);
+ Constructor con = null;
+ // System.out.println("class " + cl + " " + m_args + " " +
+ // m_args.length + " " + m_sig);
+ if (m_sig != null)
+ con = cl.getConstructor(m_sig);
+ else // Pick the constructor based on number of args.
+ {
+ Constructor[] cons = cl.getConstructors();
+ for (int i = 0; i < cons.length; i++) {
+ if (cons[i].getParameterTypes().length == m_args.length) {
+ con = cons[i];
+ break;
+ }
+ }
+ }
+ // System.out.println("constructor " + con);
+ if (con != null)
+ handler = (ExtensionHandler) con.newInstance(m_args);
+ else
+ throw new TransformerException(
+ "ExtensionHandler constructor not found");
+ } catch (Exception e) {
+ throw new TransformerException(e);
+ }
+ return handler;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespacesManager.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespacesManager.java
index 3173921..cc86fe5 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespacesManager.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionNamespacesManager.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionNamespacesManager.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ExtensionNamespacesManager.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -35,262 +35,247 @@
import org.apache.xalan.templates.Constants;
/**
- * Used during assembly of a stylesheet to collect the information for each
- * extension namespace that is required during the transformation process
- * to generate an {@link ExtensionHandler}.
+ * Used during assembly of a stylesheet to collect the information for each
+ * extension namespace that is required during the transformation process to
+ * generate an {@link ExtensionHandler}.
*
*/
-public class ExtensionNamespacesManager
-{
- /**
- * Vector of ExtensionNamespaceSupport objects to be used to generate ExtensionHandlers.
- */
- private Vector m_extensions = new Vector();
- /**
- * Vector of ExtensionNamespaceSupport objects for predefined ExtensionNamespaces. Elements
- * from this vector are added to the m_extensions vector when encountered in the stylesheet.
- */
- private Vector m_predefExtensions = new Vector(7);
- /**
- * Vector of extension namespaces for which sufficient information is not yet available to
- * complete the registration process.
- */
- private Vector m_unregisteredExtensions = new Vector();
-
- /**
- * An ExtensionNamespacesManager is instantiated the first time an extension function or
- * element is found in the stylesheet. During initialization, a vector of ExtensionNamespaceSupport
- * objects is created, one for each predefined extension namespace.
- */
- public ExtensionNamespacesManager()
- {
- setPredefinedNamespaces();
- }
-
- /**
- * If necessary, register the extension namespace found compiling a function or
- * creating an extension element.
- *
- * If it is a predefined namespace, create a
- * support object to simplify the instantiate of an appropriate ExtensionHandler
- * during transformation runtime. Otherwise, add the namespace, if necessary,
- * to a vector of undefined extension namespaces, to be defined later.
- *
- */
- public void registerExtension(String namespace)
- {
- if (namespaceIndex(namespace, m_extensions) == -1)
- {
- int predef = namespaceIndex(namespace, m_predefExtensions);
- if (predef !=-1)
- m_extensions.addElement(m_predefExtensions.elementAt(predef));
- else if (!(m_unregisteredExtensions.contains(namespace)))
- m_unregisteredExtensions.addElement(namespace);
- }
- }
-
- /**
- * Register the extension namespace for an ElemExtensionDecl or ElemFunction,
- * and prepare a support object to launch the appropriate ExtensionHandler at
- * transformation runtime.
- */
- public void registerExtension(ExtensionNamespaceSupport extNsSpt)
- {
- String namespace = extNsSpt.getNamespace();
- if (namespaceIndex(namespace, m_extensions) == -1)
- {
- m_extensions.addElement(extNsSpt);
- if (m_unregisteredExtensions.contains(namespace))
- m_unregisteredExtensions.removeElement(namespace);
- }
-
- }
-
- /**
- * Get the index for a namespace entry in the extension namespace Vector, -1 if
- * no such entry yet exists.
- */
- public int namespaceIndex(String namespace, Vector extensions)
- {
- for (int i = 0; i < extensions.size(); i++)
- {
- if (((ExtensionNamespaceSupport)extensions.elementAt(i)).getNamespace().equals(namespace))
- return i;
- }
- return -1;
- }
-
-
- /**
- * Get the vector of extension namespaces. Used to provide
- * the extensions table access to a list of extension
- * namespaces encountered during composition of a stylesheet.
- */
- public Vector getExtensions()
- {
- return m_extensions;
- }
-
- /**
- * Attempt to register any unregistered extension namespaces.
- */
- public void registerUnregisteredNamespaces()
- {
- for (int i = 0; i < m_unregisteredExtensions.size(); i++)
- {
- String ns = (String)m_unregisteredExtensions.elementAt(i);
- ExtensionNamespaceSupport extNsSpt = defineJavaNamespace(ns);
- if (extNsSpt != null)
- m_extensions.addElement(extNsSpt);
- }
- }
-
- /**
- * For any extension namespace that is not either predefined or defined
- * by a "component" declaration or exslt function declaration, attempt
- * to create an ExtensionNamespaceSuport object for the appropriate
- * Java class or Java package Extension Handler.
- *
- * Called by StylesheetRoot.recompose(), after all ElemTemplate compose()
- * operations have taken place, in order to set up handlers for
- * the remaining extension namespaces.
- *
- * @param ns The extension namespace URI.
- * @return An ExtensionNamespaceSupport object for this namespace
- * (which defines the ExtensionHandler to be used), or null if such
- * an object cannot be created.
- *
- * @throws javax.xml.transform.TransformerException
- */
- public ExtensionNamespaceSupport defineJavaNamespace(String ns)
- {
- return defineJavaNamespace(ns, ns);
- }
- public ExtensionNamespaceSupport defineJavaNamespace(String ns, String classOrPackage)
- {
- if(null == ns || ns.trim().length() == 0) // defensive. I don't think it's needed. -sb
- return null;
+public class ExtensionNamespacesManager {
+ /**
+ * Vector of ExtensionNamespaceSupport objects to be used to generate
+ * ExtensionHandlers.
+ */
+ private Vector m_extensions = new Vector();
+ /**
+ * Vector of ExtensionNamespaceSupport objects for predefined
+ * ExtensionNamespaces. Elements from this vector are added to the
+ * m_extensions vector when encountered in the stylesheet.
+ */
+ private Vector m_predefExtensions = new Vector(7);
+ /**
+ * Vector of extension namespaces for which sufficient information is not
+ * yet available to complete the registration process.
+ */
+ private Vector m_unregisteredExtensions = new Vector();
- // Prepare the name of the actual class or package, stripping
- // out any leading "class:". Next, see if there is a /. If so,
- // only look at the text to the right of the rightmost /.
- String className = classOrPackage;
- if (className.startsWith("class:"))
- className = className.substring(6);
+ /**
+ * An ExtensionNamespacesManager is instantiated the first time an extension
+ * function or element is found in the stylesheet. During initialization, a
+ * vector of ExtensionNamespaceSupport objects is created, one for each
+ * predefined extension namespace.
+ */
+ public ExtensionNamespacesManager() {
+ setPredefinedNamespaces();
+ }
- int lastSlash = className.lastIndexOf("/");
- if (-1 != lastSlash)
- className = className.substring(lastSlash + 1);
-
- // The className can be null here, and can cause an error in getClassForName
- // in JDK 1.8.
- if(null == className || className.trim().length() == 0)
- return null;
-
- try
- {
- ExtensionHandler.getClassForName(className);
- return new ExtensionNamespaceSupport(
- ns,
- "org.apache.xalan.extensions.ExtensionHandlerJavaClass",
- new Object[]{ns, "javaclass", className});
- }
- catch (ClassNotFoundException e)
- {
- return new ExtensionNamespaceSupport(
- ns,
- "org.apache.xalan.extensions.ExtensionHandlerJavaPackage",
- new Object[]{ns, "javapackage", className + "."});
- }
- }
-
-/*
- public ExtensionNamespaceSupport getSupport(int index, Vector extensions)
- {
- return (ExtensionNamespaceSupport)extensions.elementAt(index);
- }
-*/
-
-
- /**
- * Set up a Vector for predefined extension namespaces.
- */
- private void setPredefinedNamespaces()
- {
- String uri = Constants.S_EXTENSIONS_JAVA_URL;
- String handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaPackage";
- String lang = "javapackage";
- String lib = "";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXTENSIONS_OLD_JAVA_URL;
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXTENSIONS_LOTUSXSL_JAVA_URL;
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_BUILTIN_EXTENSIONS_URL;
- handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaClass";
- lang = "javaclass"; // for remaining predefined extension namespaces.
- lib = "org.apache.xalan.lib.Extensions";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_BUILTIN_OLD_EXTENSIONS_URL;
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- // Xalan extension namespaces (redirect, pipe and SQL).
- uri = Constants.S_EXTENSIONS_REDIRECT_URL;
- lib = "org.apache.xalan.lib.Redirect";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXTENSIONS_PIPE_URL;
- lib = "org.apache.xalan.lib.PipeDocument";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXTENSIONS_SQL_URL;
- lib = "org.apache.xalan.lib.sql.XConnection";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
-
- //EXSLT namespaces (not including EXSLT function namespaces which are
- // registered by the associated ElemFunction.
- uri = Constants.S_EXSLT_COMMON_URL;
- lib = "org.apache.xalan.lib.ExsltCommon";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
+ /**
+ * If necessary, register the extension namespace found compiling a function
+ * or creating an extension element.
+ *
+ * If it is a predefined namespace, create a support object to simplify the
+ * instantiate of an appropriate ExtensionHandler during transformation
+ * runtime. Otherwise, add the namespace, if necessary, to a vector of
+ * undefined extension namespaces, to be defined later.
+ *
+ */
+ public void registerExtension(String namespace) {
+ if (namespaceIndex(namespace, m_extensions) == -1) {
+ int predef = namespaceIndex(namespace, m_predefExtensions);
+ if (predef != -1)
+ m_extensions.addElement(m_predefExtensions.elementAt(predef));
+ else if (!(m_unregisteredExtensions.contains(namespace)))
+ m_unregisteredExtensions.addElement(namespace);
+ }
+ }
- uri = Constants.S_EXSLT_MATH_URL;
- lib = "org.apache.xalan.lib.ExsltMath";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXSLT_SETS_URL;
- lib = "org.apache.xalan.lib.ExsltSets";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXSLT_DATETIME_URL;
- lib = "org.apache.xalan.lib.ExsltDatetime";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
-
- uri = Constants.S_EXSLT_DYNAMIC_URL;
- lib = "org.apache.xalan.lib.ExsltDynamic";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
+ /**
+ * Register the extension namespace for an ElemExtensionDecl or
+ * ElemFunction, and prepare a support object to launch the appropriate
+ * ExtensionHandler at transformation runtime.
+ */
+ public void registerExtension(ExtensionNamespaceSupport extNsSpt) {
+ String namespace = extNsSpt.getNamespace();
+ if (namespaceIndex(namespace, m_extensions) == -1) {
+ m_extensions.addElement(extNsSpt);
+ if (m_unregisteredExtensions.contains(namespace))
+ m_unregisteredExtensions.removeElement(namespace);
+ }
- uri = Constants.S_EXSLT_STRINGS_URL;
- lib = "org.apache.xalan.lib.ExsltStrings";
- m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri, handlerClassName,
- new Object[]{uri, lang, lib}));
- }
-
+ }
+
+ /**
+ * Get the index for a namespace entry in the extension namespace Vector, -1
+ * if no such entry yet exists.
+ */
+ public int namespaceIndex(String namespace, Vector extensions) {
+ for (int i = 0; i < extensions.size(); i++) {
+ if (((ExtensionNamespaceSupport) extensions.elementAt(i))
+ .getNamespace().equals(namespace))
+ return i;
+ }
+ return -1;
+ }
+
+ /**
+ * Get the vector of extension namespaces. Used to provide the extensions
+ * table access to a list of extension namespaces encountered during
+ * composition of a stylesheet.
+ */
+ public Vector getExtensions() {
+ return m_extensions;
+ }
+
+ /**
+ * Attempt to register any unregistered extension namespaces.
+ */
+ public void registerUnregisteredNamespaces() {
+ for (int i = 0; i < m_unregisteredExtensions.size(); i++) {
+ String ns = (String) m_unregisteredExtensions.elementAt(i);
+ ExtensionNamespaceSupport extNsSpt = defineJavaNamespace(ns);
+ if (extNsSpt != null)
+ m_extensions.addElement(extNsSpt);
+ }
+ }
+
+ /**
+ * For any extension namespace that is not either predefined or defined by a
+ * "component" declaration or exslt function declaration, attempt to create
+ * an ExtensionNamespaceSuport object for the appropriate Java class or Java
+ * package Extension Handler.
+ *
+ * Called by StylesheetRoot.recompose(), after all ElemTemplate compose()
+ * operations have taken place, in order to set up handlers for the
+ * remaining extension namespaces.
+ *
+ * @param ns
+ * The extension namespace URI.
+ * @return An ExtensionNamespaceSupport object for this namespace (which
+ * defines the ExtensionHandler to be used), or null if such an
+ * object cannot be created.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public ExtensionNamespaceSupport defineJavaNamespace(String ns) {
+ return defineJavaNamespace(ns, ns);
+ }
+
+ public ExtensionNamespaceSupport defineJavaNamespace(String ns,
+ String classOrPackage) {
+ if (null == ns || ns.trim().length() == 0) // defensive. I don't think
+ // it's needed. -sb
+ return null;
+
+ // Prepare the name of the actual class or package, stripping
+ // out any leading "class:". Next, see if there is a /. If so,
+ // only look at the text to the right of the rightmost /.
+ String className = classOrPackage;
+ if (className.startsWith("class:"))
+ className = className.substring(6);
+
+ int lastSlash = className.lastIndexOf("/");
+ if (-1 != lastSlash)
+ className = className.substring(lastSlash + 1);
+
+ // The className can be null here, and can cause an error in
+ // getClassForName
+ // in JDK 1.8.
+ if (null == className || className.trim().length() == 0)
+ return null;
+
+ try {
+ ExtensionHandler.getClassForName(className);
+ return new ExtensionNamespaceSupport(ns,
+ "org.apache.xalan.extensions.ExtensionHandlerJavaClass",
+ new Object[] { ns, "javaclass", className });
+ } catch (ClassNotFoundException e) {
+ return new ExtensionNamespaceSupport(ns,
+ "org.apache.xalan.extensions.ExtensionHandlerJavaPackage",
+ new Object[] { ns, "javapackage", className + "." });
+ }
+ }
+
+ /*
+ * public ExtensionNamespaceSupport getSupport(int index, Vector extensions) {
+ * return (ExtensionNamespaceSupport)extensions.elementAt(index); }
+ */
+
+ /**
+ * Set up a Vector for predefined extension namespaces.
+ */
+ private void setPredefinedNamespaces() {
+ String uri = org.apache.xml.utils.Constants.S_EXTENSIONS_JAVA_URL;
+ String handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaPackage";
+ String lang = "javapackage";
+ String lib = "";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXTENSIONS_OLD_JAVA_URL;
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXTENSIONS_LOTUSXSL_JAVA_URL;
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_BUILTIN_EXTENSIONS_URL;
+ handlerClassName = "org.apache.xalan.extensions.ExtensionHandlerJavaClass";
+ lang = "javaclass"; // for remaining predefined extension namespaces.
+ lib = "org.apache.xalan.lib.Extensions";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_BUILTIN_OLD_EXTENSIONS_URL;
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ // Xalan extension namespaces (redirect, pipe and SQL).
+ uri = org.apache.xml.utils.Constants.S_EXTENSIONS_REDIRECT_URL;
+ lib = "org.apache.xalan.lib.Redirect";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXTENSIONS_PIPE_URL;
+ lib = "org.apache.xalan.lib.PipeDocument";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXTENSIONS_SQL_URL;
+ lib = "org.apache.xalan.lib.sql.XConnection";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ // EXSLT namespaces (not including EXSLT function namespaces which are
+ // registered by the associated ElemFunction.
+ uri = org.apache.xml.utils.Constants.S_EXSLT_COMMON_URL;
+ lib = "org.apache.xalan.lib.ExsltCommon";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXSLT_MATH_URL;
+ lib = "org.apache.xalan.lib.ExsltMath";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXSLT_SETS_URL;
+ lib = "org.apache.xalan.lib.ExsltSets";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXSLT_DATETIME_URL;
+ lib = "org.apache.xalan.lib.ExsltDatetime";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXSLT_DYNAMIC_URL;
+ lib = "org.apache.xalan.lib.ExsltDynamic";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+
+ uri = org.apache.xml.utils.Constants.S_EXSLT_STRINGS_URL;
+ lib = "org.apache.xalan.lib.ExsltStrings";
+ m_predefExtensions.addElement(new ExtensionNamespaceSupport(uri,
+ handlerClassName, new Object[] { uri, lang, lib }));
+ }
+
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionsTable.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionsTable.java
index 34aab1d..4b95052 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionsTable.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ExtensionsTable.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ExtensionsTable.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: ExtensionsTable.java,v 1.3 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -41,211 +41,207 @@
/**
* Class holding a table registered extension namespace handlers
+ *
* @xsl.usage internal
*/
-public class ExtensionsTable
-{
- /**
- * Table of extensions that may be called from the expression language
- * via the call(name, ...) function. Objects are keyed on the call
- * name.
- * @xsl.usage internal
- */
- public Hashtable m_extensionFunctionNamespaces = new Hashtable();
-
- /**
- * The StylesheetRoot associated with this extensions table.
- */
- private StylesheetRoot m_sroot;
-
- /**
- * The constructor (called from TransformerImpl) registers the
- * StylesheetRoot for the transformation and instantiates an
- * ExtensionHandler for each extension namespace.
- * @xsl.usage advanced
- */
- public ExtensionsTable(StylesheetRoot sroot)
- throws javax.xml.transform.TransformerException
- {
- m_sroot = sroot;
- Vector extensions = m_sroot.getExtensions();
- for (int i = 0; i < extensions.size(); i++)
- {
- ExtensionNamespaceSupport extNamespaceSpt =
- (ExtensionNamespaceSupport)extensions.elementAt(i);
- ExtensionHandler extHandler = extNamespaceSpt.launch();
- if (extHandler != null)
- addExtensionNamespace(extNamespaceSpt.getNamespace(), extHandler);
- }
- }
-
- /**
- * Get an ExtensionHandler object that represents the
- * given namespace.
- * @param extns A valid extension namespace.
- *
- * @return ExtensionHandler object that represents the
- * given namespace.
- */
- public ExtensionHandler get(String extns)
- {
- return (ExtensionHandler) m_extensionFunctionNamespaces.get(extns);
- }
+public class ExtensionsTable {
+ /**
+ * Table of extensions that may be called from the expression language via
+ * the call(name, ...) function. Objects are keyed on the call name.
+ *
+ * @xsl.usage internal
+ */
+ public Hashtable m_extensionFunctionNamespaces = new Hashtable();
- /**
- * Register an extension namespace handler. This handler provides
- * functions for testing whether a function is known within the
- * namespace and also for invoking the functions.
- *
- * @param uri the URI for the extension.
- * @param extNS the extension handler.
- * @xsl.usage advanced
- */
- public void addExtensionNamespace(String uri, ExtensionHandler extNS)
- {
- m_extensionFunctionNamespaces.put(uri, extNS);
- }
+ /**
+ * The StylesheetRoot associated with this extensions table.
+ */
+ private StylesheetRoot m_sroot;
- /**
- * Execute the function-available() function.
- * @param ns the URI of namespace in which the function is needed
- * @param funcName the function name being tested
- *
- * @return whether the given function is available or not.
- *
- * @throws javax.xml.transform.TransformerException
- */
- public boolean functionAvailable(String ns, String funcName)
- throws javax.xml.transform.TransformerException
- {
- boolean isAvailable = false;
-
- if (null != ns)
- {
- ExtensionHandler extNS =
- (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
- if (extNS != null)
- isAvailable = extNS.isFunctionAvailable(funcName);
- }
- return isAvailable;
- }
-
- /**
- * Execute the element-available() function.
- * @param ns the URI of namespace in which the function is needed
- * @param elemName name of element being tested
- *
- * @return whether the given element is available or not.
- *
- * @throws javax.xml.transform.TransformerException
- */
- public boolean elementAvailable(String ns, String elemName)
- throws javax.xml.transform.TransformerException
- {
- boolean isAvailable = false;
- if (null != ns)
- {
- ExtensionHandler extNS =
- (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
- if (extNS != null) // defensive
- isAvailable = extNS.isElementAvailable(elemName);
- }
- return isAvailable;
- }
-
- /**
- * Handle an extension function.
- * @param ns the URI of namespace in which the function is needed
- * @param funcName the function name being called
- * @param argVec arguments to the function in a vector
- * @param methodKey a unique key identifying this function instance in the
- * stylesheet
- * @param exprContext a context which may be passed to an extension function
- * and provides callback functions to access various
- * areas in the environment
- *
- * @return result of executing the function
- *
- * @throws javax.xml.transform.TransformerException
- */
- public Object extFunction(String ns, String funcName,
- Vector argVec, Object methodKey,
- ExpressionContext exprContext)
- throws javax.xml.transform.TransformerException
- {
- Object result = null;
- if (null != ns)
- {
- ExtensionHandler extNS =
- (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
- if (null != extNS)
- {
- try
- {
- result = extNS.callFunction(funcName, argVec, methodKey,
- exprContext);
- }
- catch (javax.xml.transform.TransformerException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new javax.xml.transform.TransformerException(e);
- }
- }
- else
- {
- throw new XPathProcessorException(Messages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN, new Object[]{ns, funcName }));
- //"Extension function '" + ns + ":" + funcName + "' is unknown");
- }
- }
- return result;
- }
-
- /**
- * Handle an extension function.
- * @param extFunction the extension function
- * @param argVec arguments to the function in a vector
- * @param exprContext a context which may be passed to an extension function
- * and provides callback functions to access various
- * areas in the environment
- *
- * @return result of executing the function
- *
- * @throws javax.xml.transform.TransformerException
- */
- public Object extFunction(FuncExtFunction extFunction, Vector argVec,
- ExpressionContext exprContext)
- throws javax.xml.transform.TransformerException
- {
- Object result = null;
- String ns = extFunction.getNamespace();
- if (null != ns)
- {
- ExtensionHandler extNS =
- (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
- if (null != extNS)
- {
- try
- {
- result = extNS.callFunction(extFunction, argVec, exprContext);
- }
- catch (javax.xml.transform.TransformerException e)
- {
- throw e;
- }
- catch (Exception e)
- {
- throw new javax.xml.transform.TransformerException(e);
- }
- }
- else
- {
- throw new XPathProcessorException(Messages.createMessage(XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN,
- new Object[]{ns, extFunction.getFunctionName()}));
- }
- }
- return result;
- }
+ /**
+ * The constructor (called from TransformerImpl) registers the
+ * StylesheetRoot for the transformation and instantiates an
+ * ExtensionHandler for each extension namespace.
+ *
+ * @xsl.usage advanced
+ */
+ public ExtensionsTable(StylesheetRoot sroot)
+ throws javax.xml.transform.TransformerException {
+ m_sroot = sroot;
+ Vector extensions = m_sroot.getExtensions();
+ for (int i = 0; i < extensions.size(); i++) {
+ ExtensionNamespaceSupport extNamespaceSpt = (ExtensionNamespaceSupport) extensions
+ .elementAt(i);
+ ExtensionHandler extHandler = extNamespaceSpt.launch();
+ if (extHandler != null)
+ addExtensionNamespace(extNamespaceSpt.getNamespace(),
+ extHandler);
+ }
+ }
+
+ /**
+ * Get an ExtensionHandler object that represents the given namespace.
+ *
+ * @param extns
+ * A valid extension namespace.
+ *
+ * @return ExtensionHandler object that represents the given namespace.
+ */
+ public ExtensionHandler get(String extns) {
+ return (ExtensionHandler) m_extensionFunctionNamespaces.get(extns);
+ }
+
+ /**
+ * Register an extension namespace handler. This handler provides functions
+ * for testing whether a function is known within the namespace and also for
+ * invoking the functions.
+ *
+ * @param uri
+ * the URI for the extension.
+ * @param extNS
+ * the extension handler.
+ * @xsl.usage advanced
+ */
+ public void addExtensionNamespace(String uri, ExtensionHandler extNS) {
+ m_extensionFunctionNamespaces.put(uri, extNS);
+ }
+
+ /**
+ * Execute the function-available() function.
+ *
+ * @param ns
+ * the URI of namespace in which the function is needed
+ * @param funcName
+ * the function name being tested
+ *
+ * @return whether the given function is available or not.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public boolean functionAvailable(String ns, String funcName)
+ throws javax.xml.transform.TransformerException {
+ boolean isAvailable = false;
+
+ if (null != ns) {
+ ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces
+ .get(ns);
+ if (extNS != null)
+ isAvailable = extNS.isFunctionAvailable(funcName);
+ }
+ return isAvailable;
+ }
+
+ /**
+ * Execute the element-available() function.
+ *
+ * @param ns
+ * the URI of namespace in which the function is needed
+ * @param elemName
+ * name of element being tested
+ *
+ * @return whether the given element is available or not.
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public boolean elementAvailable(String ns, String elemName)
+ throws javax.xml.transform.TransformerException {
+ boolean isAvailable = false;
+ if (null != ns) {
+ ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces
+ .get(ns);
+ if (extNS != null) // defensive
+ isAvailable = extNS.isElementAvailable(elemName);
+ }
+ return isAvailable;
+ }
+
+ /**
+ * Handle an extension function.
+ *
+ * @param ns
+ * the URI of namespace in which the function is needed
+ * @param funcName
+ * the function name being called
+ * @param argVec
+ * arguments to the function in a vector
+ * @param methodKey
+ * a unique key identifying this function instance in the
+ * stylesheet
+ * @param exprContext
+ * a context which may be passed to an extension function and
+ * provides callback functions to access various areas in the
+ * environment
+ *
+ * @return result of executing the function
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public Object extFunction(String ns, String funcName, Vector argVec,
+ Object methodKey, ExpressionContext exprContext)
+ throws javax.xml.transform.TransformerException {
+ Object result = null;
+ if (null != ns) {
+ ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces
+ .get(ns);
+ if (null != extNS) {
+ try {
+ result = extNS.callFunction(funcName, argVec, methodKey,
+ exprContext);
+ } catch (javax.xml.transform.TransformerException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new javax.xml.transform.TransformerException(e);
+ }
+ } else {
+ throw new XPathProcessorException(Messages.createMessage(
+ XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN,
+ new Object[] { ns, funcName }));
+ // "Extension function '" + ns + ":" + funcName + "' is
+ // unknown");
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Handle an extension function.
+ *
+ * @param extFunction
+ * the extension function
+ * @param argVec
+ * arguments to the function in a vector
+ * @param exprContext
+ * a context which may be passed to an extension function and
+ * provides callback functions to access various areas in the
+ * environment
+ *
+ * @return result of executing the function
+ *
+ * @throws javax.xml.transform.TransformerException
+ */
+ public Object extFunction(FuncExtFunction extFunction, Vector argVec,
+ ExpressionContext exprContext)
+ throws javax.xml.transform.TransformerException {
+ Object result = null;
+ String ns = extFunction.getNamespace();
+ if (null != ns) {
+ ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces
+ .get(ns);
+ if (null != extNS) {
+ try {
+ result = extNS.callFunction(extFunction, argVec,
+ exprContext);
+ } catch (javax.xml.transform.TransformerException e) {
+ throw e;
+ } catch (Exception e) {
+ throw new javax.xml.transform.TransformerException(e);
+ }
+ } else {
+ throw new XPathProcessorException(Messages.createMessage(
+ XSLTErrorResources.ER_EXTENSION_FUNC_UNKNOWN,
+ new Object[] { ns, extFunction.getFunctionName() }));
+ }
+ }
+ return result;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/MethodResolver.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/MethodResolver.java
index 6a782fd..a8d0325 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/MethodResolver.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/MethodResolver.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: MethodResolver.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: MethodResolver.java,v 1.3 2008/03/28 02:38:17 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -49,956 +49,875 @@
import org.w3c.dom.traversal.NodeIterator;
/**
- * Utility class to help resolve method overloading with Xalan XSLT
- * argument types.
+ * Utility class to help resolve method overloading with Xalan XSLT argument
+ * types.
*/
-public class MethodResolver
-{
+public class MethodResolver {
- /**
- * Specifies a search for static methods only.
- */
- public static final int STATIC_ONLY = 1;
+ /**
+ * Specifies a search for static methods only.
+ */
+ public static final int STATIC_ONLY = 1;
- /**
- * Specifies a search for instance methods only.
- */
- public static final int INSTANCE_ONLY = 2;
+ /**
+ * Specifies a search for instance methods only.
+ */
+ public static final int INSTANCE_ONLY = 2;
- /**
- * Specifies a search for both static and instance methods.
- */
- public static final int STATIC_AND_INSTANCE = 3;
+ /**
+ * Specifies a search for both static and instance methods.
+ */
+ public static final int STATIC_AND_INSTANCE = 3;
- /**
- * Specifies a Dynamic method search. If the method being
- * evaluated is a static method, all arguments are used.
- * Otherwise, it is an instance method and only arguments
- * beginning with the second argument are used.
- */
- public static final int DYNAMIC = 4;
+ /**
+ * Specifies a Dynamic method search. If the method being evaluated is a
+ * static method, all arguments are used. Otherwise, it is an instance
+ * method and only arguments beginning with the second argument are used.
+ */
+ public static final int DYNAMIC = 4;
- /**
- * Given a class, figure out the resolution of
- * the Java Constructor from the XSLT argument types, and perform the
- * conversion of the arguments.
- * @param classObj the Class of the object to be constructed.
- * @param argsIn An array of XSLT/XPath arguments.
- * @param argsOut An array of the exact size as argsIn, which will be
- * populated with converted arguments if a suitable method is found.
- * @return A constructor that will work with the argsOut array.
- * @throws TransformerException may be thrown for Xalan conversion
- * exceptions.
- */
- public static Constructor getConstructor(Class classObj,
- Object[] argsIn,
- Object[][] argsOut,
- ExpressionContext exprContext)
- throws NoSuchMethodException,
- SecurityException,
- TransformerException
- {
- Constructor bestConstructor = null;
- Class[] bestParamTypes = null;
- Constructor[] constructors = classObj.getConstructors();
- int nMethods = constructors.length;
- int bestScore = Integer.MAX_VALUE;
- int bestScoreCount = 0;
- for(int i = 0; i < nMethods; i++)
- {
- Constructor ctor = constructors[i];
- Class[] paramTypes = ctor.getParameterTypes();
- int numberMethodParams = paramTypes.length;
- int paramStart = 0;
- boolean isFirstExpressionContext = false;
- int scoreStart;
- // System.out.println("numberMethodParams: "+numberMethodParams);
- // System.out.println("argsIn.length: "+argsIn.length);
- // System.out.println("exprContext: "+exprContext);
- if(numberMethodParams == (argsIn.length+1))
- {
- Class javaClass = paramTypes[0];
- // System.out.println("first javaClass: "+javaClass.getName());
- if(ExpressionContext.class.isAssignableFrom(javaClass))
- {
- isFirstExpressionContext = true;
- scoreStart = 0;
- paramStart++;
- // System.out.println("Incrementing paramStart: "+paramStart);
- }
- else
- continue;
- }
- else
- scoreStart = 1000;
-
- if(argsIn.length == (numberMethodParams - paramStart))
- {
- // then we have our candidate.
- int score = scoreMatch(paramTypes, paramStart, argsIn, scoreStart);
- // System.out.println("score: "+score);
- if(-1 == score)
- continue;
- if(score < bestScore)
- {
- // System.out.println("Assigning best ctor: "+ctor);
- bestConstructor = ctor;
- bestParamTypes = paramTypes;
- bestScore = score;
- bestScoreCount = 1;
- }
- else if (score == bestScore)
- bestScoreCount++;
- }
- }
+ /**
+ * Given a class, figure out the resolution of the Java Constructor from the
+ * XSLT argument types, and perform the conversion of the arguments.
+ *
+ * @param classObj
+ * the Class of the object to be constructed.
+ * @param argsIn
+ * An array of XSLT/XPath arguments.
+ * @param argsOut
+ * An array of the exact size as argsIn, which will be populated
+ * with converted arguments if a suitable method is found.
+ * @return A constructor that will work with the argsOut array.
+ * @throws TransformerException
+ * may be thrown for Xalan conversion exceptions.
+ */
+ public static Constructor getConstructor(Class classObj, Object[] argsIn,
+ Object[][] argsOut, ExpressionContext exprContext)
+ throws NoSuchMethodException, SecurityException,
+ TransformerException {
+ Constructor bestConstructor = null;
+ Class[] bestParamTypes = null;
+ Constructor[] constructors = classObj.getConstructors();
+ int nMethods = constructors.length;
+ int bestScore = Integer.MAX_VALUE;
+ int bestScoreCount = 0;
+ for (int i = 0; i < nMethods; i++) {
+ Constructor ctor = constructors[i];
+ Class[] paramTypes = ctor.getParameterTypes();
+ int numberMethodParams = paramTypes.length;
+ int paramStart = 0;
+ boolean isFirstExpressionContext = false;
+ int scoreStart;
+ // System.out.println("numberMethodParams: "+numberMethodParams);
+ // System.out.println("argsIn.length: "+argsIn.length);
+ // System.out.println("exprContext: "+exprContext);
+ if (numberMethodParams == (argsIn.length + 1)) {
+ Class javaClass = paramTypes[0];
+ // System.out.println("first javaClass: "+javaClass.getName());
+ if (ExpressionContext.class.isAssignableFrom(javaClass)) {
+ isFirstExpressionContext = true;
+ scoreStart = 0;
+ paramStart++;
+ // System.out.println("Incrementing paramStart:
+ // "+paramStart);
+ } else
+ continue;
+ } else
+ scoreStart = 1000;
- if(null == bestConstructor)
- {
- throw new NoSuchMethodException(errString("function", "constructor", classObj,
- "", 0, argsIn));
- }
- /*** This is commented out until we can do a better object -> object scoring
- else if (bestScoreCount > 1)
- throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_CONSTRUCTOR, new Object[]{classObj.getName()})); //"More than one best match for constructor for "
- + classObj.getName());
- ***/
- else
- convertParams(argsIn, argsOut, bestParamTypes, exprContext);
-
- return bestConstructor;
- }
+ if (argsIn.length == (numberMethodParams - paramStart)) {
+ // then we have our candidate.
+ int score = scoreMatch(paramTypes, paramStart, argsIn,
+ scoreStart);
+ // System.out.println("score: "+score);
+ if (-1 == score)
+ continue;
+ if (score < bestScore) {
+ // System.out.println("Assigning best ctor: "+ctor);
+ bestConstructor = ctor;
+ bestParamTypes = paramTypes;
+ bestScore = score;
+ bestScoreCount = 1;
+ } else if (score == bestScore)
+ bestScoreCount++;
+ }
+ }
-
- /**
- * Given the name of a method, figure out the resolution of
- * the Java Method from the XSLT argument types, and perform the
- * conversion of the arguments.
- * @param classObj The Class of the object that should have the method.
- * @param name The name of the method to be invoked.
- * @param argsIn An array of XSLT/XPath arguments.
- * @param argsOut An array of the exact size as argsIn, which will be
- * populated with converted arguments if a suitable method is found.
- * @return A method that will work with the argsOut array.
- * @throws TransformerException may be thrown for Xalan conversion
- * exceptions.
- */
- public static Method getMethod(Class classObj,
- String name,
- Object[] argsIn,
- Object[][] argsOut,
- ExpressionContext exprContext,
- int searchMethod)
- throws NoSuchMethodException,
- SecurityException,
- TransformerException
- {
- // System.out.println("---> Looking for method: "+name);
- // System.out.println("---> classObj: "+classObj);
- if (name.indexOf("-")>0)
- name = replaceDash(name);
- Method bestMethod = null;
- Class[] bestParamTypes = null;
- Method[] methods = classObj.getMethods();
- int nMethods = methods.length;
- int bestScore = Integer.MAX_VALUE;
- int bestScoreCount = 0;
- boolean isStatic;
- for(int i = 0; i < nMethods; i++)
- {
- Method method = methods[i];
- // System.out.println("looking at method: "+method);
- int xsltParamStart = 0;
- if(method.getName().equals(name))
- {
- isStatic = Modifier.isStatic(method.getModifiers());
- switch(searchMethod)
- {
- case STATIC_ONLY:
- if (!isStatic)
- {
- continue;
- }
- break;
+ if (null == bestConstructor) {
+ throw new NoSuchMethodException(errString("function",
+ "constructor", classObj, "", 0, argsIn));
+ }
+ /***********************************************************************
+ * * This is commented out until we can do a better object -> object
+ * scoring else if (bestScoreCount > 1) throw new
+ * TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_CONSTRUCTOR,
+ * new Object[]{classObj.getName()})); //"More than one best match for
+ * constructor for " + classObj.getName());
+ **********************************************************************/
+ else
+ convertParams(argsIn, argsOut, bestParamTypes, exprContext);
- case INSTANCE_ONLY:
- if (isStatic)
- {
- continue;
- }
- break;
+ return bestConstructor;
+ }
- case STATIC_AND_INSTANCE:
- break;
+ /**
+ * Given the name of a method, figure out the resolution of the Java Method
+ * from the XSLT argument types, and perform the conversion of the
+ * arguments.
+ *
+ * @param classObj
+ * The Class of the object that should have the method.
+ * @param name
+ * The name of the method to be invoked.
+ * @param argsIn
+ * An array of XSLT/XPath arguments.
+ * @param argsOut
+ * An array of the exact size as argsIn, which will be populated
+ * with converted arguments if a suitable method is found.
+ * @return A method that will work with the argsOut array.
+ * @throws TransformerException
+ * may be thrown for Xalan conversion exceptions.
+ */
+ public static Method getMethod(Class classObj, String name,
+ Object[] argsIn, Object[][] argsOut, ExpressionContext exprContext,
+ int searchMethod) throws NoSuchMethodException, SecurityException,
+ TransformerException {
+ // System.out.println("---> Looking for method: "+name);
+ // System.out.println("---> classObj: "+classObj);
+ if (name.indexOf("-") > 0)
+ name = replaceDash(name);
+ Method bestMethod = null;
+ Class[] bestParamTypes = null;
+ Method[] methods = classObj.getMethods();
+ int nMethods = methods.length;
+ int bestScore = Integer.MAX_VALUE;
+ int bestScoreCount = 0;
+ boolean isStatic;
+ for (int i = 0; i < nMethods; i++) {
+ Method method = methods[i];
+ // System.out.println("looking at method: "+method);
+ int xsltParamStart = 0;
+ if (method.getName().equals(name)) {
+ isStatic = Modifier.isStatic(method.getModifiers());
+ switch (searchMethod) {
+ case STATIC_ONLY:
+ if (!isStatic) {
+ continue;
+ }
+ break;
- case DYNAMIC:
- if (!isStatic)
- xsltParamStart = 1;
- }
- int javaParamStart = 0;
- Class[] paramTypes = method.getParameterTypes();
- int numberMethodParams = paramTypes.length;
- boolean isFirstExpressionContext = false;
- int scoreStart;
- // System.out.println("numberMethodParams: "+numberMethodParams);
- // System.out.println("argsIn.length: "+argsIn.length);
- // System.out.println("exprContext: "+exprContext);
- int argsLen = (null != argsIn) ? argsIn.length : 0;
- if(numberMethodParams == (argsLen-xsltParamStart+1))
- {
- Class javaClass = paramTypes[0];
- if(ExpressionContext.class.isAssignableFrom(javaClass))
- {
- isFirstExpressionContext = true;
- scoreStart = 0;
- javaParamStart++;
- }
- else
- {
- continue;
- }
- }
- else
- scoreStart = 1000;
-
- if((argsLen - xsltParamStart) == (numberMethodParams - javaParamStart))
- {
- // then we have our candidate.
- int score = scoreMatch(paramTypes, javaParamStart, argsIn, scoreStart);
- // System.out.println("score: "+score);
- if(-1 == score)
- continue;
- if(score < bestScore)
- {
- // System.out.println("Assigning best method: "+method);
- bestMethod = method;
- bestParamTypes = paramTypes;
- bestScore = score;
- bestScoreCount = 1;
- }
- else if (score == bestScore)
- bestScoreCount++;
- }
- }
- }
-
- if (null == bestMethod)
- {
- throw new NoSuchMethodException(errString("function", "method", classObj,
- name, searchMethod, argsIn));
- }
- /*** This is commented out until we can do a better object -> object scoring
- else if (bestScoreCount > 1)
- throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_METHOD, new Object[]{name})); //"More than one best match for method " + name);
- ***/
- else
- convertParams(argsIn, argsOut, bestParamTypes, exprContext);
-
- return bestMethod;
- }
-
- /**
- * To support EXSLT extensions, convert names with dash to allowable Java names:
- * e.g., convert abc-xyz to abcXyz.
- * Note: dashes only appear in middle of an EXSLT function or element name.
- */
- private static String replaceDash(String name)
- {
- char dash = '-';
- StringBuffer buff = new StringBuffer("");
- for (int i=0; i<name.length(); i++)
- {
- if (name.charAt(i) == dash)
- {}
- else if (i > 0 && name.charAt(i-1) == dash)
- buff.append(Character.toUpperCase(name.charAt(i)));
- else
- buff.append(name.charAt(i));
- }
- return buff.toString();
- }
-
- /**
- * Given the name of a method, figure out the resolution of
- * the Java Method
- * @param classObj The Class of the object that should have the method.
- * @param name The name of the method to be invoked.
- * @return A method that will work to be called as an element.
- * @throws TransformerException may be thrown for Xalan conversion
- * exceptions.
- */
- public static Method getElementMethod(Class classObj,
- String name)
- throws NoSuchMethodException,
- SecurityException,
- TransformerException
- {
- // System.out.println("---> Looking for element method: "+name);
- // System.out.println("---> classObj: "+classObj);
- Method bestMethod = null;
- Method[] methods = classObj.getMethods();
- int nMethods = methods.length;
- int bestScoreCount = 0;
- for(int i = 0; i < nMethods; i++)
- {
- Method method = methods[i];
- // System.out.println("looking at method: "+method);
- if(method.getName().equals(name))
- {
- Class[] paramTypes = method.getParameterTypes();
- if ( (paramTypes.length == 2)
- && paramTypes[1].isAssignableFrom(org.apache.xalan.templates.ElemExtensionCall.class)
- && paramTypes[0].isAssignableFrom(org.apache.xalan.extensions.XSLProcessorContext.class) )
- {
- if ( ++bestScoreCount == 1 )
- bestMethod = method;
- else
- break;
- }
- }
- }
-
- if (null == bestMethod)
- {
- throw new NoSuchMethodException(errString("element", "method", classObj,
- name, 0, null));
- }
- else if (bestScoreCount > 1)
- throw new TransformerException(Messages.createMessage(XSLTErrorResources.ER_MORE_MATCH_ELEMENT, new Object[]{name})); //"More than one best match for element method " + name);
-
- return bestMethod;
- }
-
+ case INSTANCE_ONLY:
+ if (isStatic) {
+ continue;
+ }
+ break;
- /**
- * Convert a set of parameters based on a set of paramTypes.
- * @param argsIn An array of XSLT/XPath arguments.
- * @param argsOut An array of the exact size as argsIn, which will be
- * populated with converted arguments.
- * @param paramTypes An array of class objects, of the exact same
- * size as argsIn and argsOut.
- * @throws TransformerException may be thrown for Xalan conversion
- * exceptions.
- */
- public static void convertParams(Object[] argsIn,
- Object[][] argsOut, Class[] paramTypes,
- ExpressionContext exprContext)
- throws javax.xml.transform.TransformerException
- {
- // System.out.println("In convertParams");
- if (paramTypes == null)
- argsOut[0] = null;
- else
- {
- int nParams = paramTypes.length;
- argsOut[0] = new Object[nParams];
- int paramIndex = 0;
- if((nParams > 0)
- && ExpressionContext.class.isAssignableFrom(paramTypes[0]))
- {
- argsOut[0][0] = exprContext;
- // System.out.println("Incrementing paramIndex in convertParams: "+paramIndex);
- paramIndex++;
- }
+ case STATIC_AND_INSTANCE:
+ break;
- if (argsIn != null)
- {
- for(int i = argsIn.length - nParams + paramIndex ; paramIndex < nParams; i++, paramIndex++)
- {
- // System.out.println("paramTypes[i]: "+paramTypes[i]);
- argsOut[0][paramIndex] = convert(argsIn[i], paramTypes[paramIndex]);
- }
- }
- }
- }
-
- /**
- * Simple class to hold information about allowed conversions
- * and their relative scores, for use by the table below.
- */
- static class ConversionInfo
- {
- ConversionInfo(Class cl, int score)
- {
- m_class = cl;
- m_score = score;
- }
-
- Class m_class; // Java class to convert to.
- int m_score; // Match score, closer to zero is more matched.
- }
-
- private static final int SCOREBASE=1;
-
- /**
- * Specification of conversions from XSLT type CLASS_UNKNOWN
- * (i.e. some unknown Java object) to allowed Java types.
- */
- private final static ConversionInfo[] m_javaObjConversions = {
- new ConversionInfo(Double.TYPE, 11),
- new ConversionInfo(Float.TYPE, 12),
- new ConversionInfo(Long.TYPE, 13),
- new ConversionInfo(Integer.TYPE, 14),
- new ConversionInfo(Short.TYPE, 15),
- new ConversionInfo(Character.TYPE, 16),
- new ConversionInfo(Byte.TYPE, 17),
- new ConversionInfo(java.lang.String.class, 18)
- };
-
- /**
- * Specification of conversions from XSLT type CLASS_BOOLEAN
- * to allowed Java types.
- */
- private final static ConversionInfo[] m_booleanConversions = {
- new ConversionInfo(Boolean.TYPE, 0),
- new ConversionInfo(java.lang.Boolean.class, 1),
- new ConversionInfo(java.lang.Object.class, 2),
- new ConversionInfo(java.lang.String.class, 3)
- };
+ case DYNAMIC:
+ if (!isStatic)
+ xsltParamStart = 1;
+ }
+ int javaParamStart = 0;
+ Class[] paramTypes = method.getParameterTypes();
+ int numberMethodParams = paramTypes.length;
+ boolean isFirstExpressionContext = false;
+ int scoreStart;
+ // System.out.println("numberMethodParams:
+ // "+numberMethodParams);
+ // System.out.println("argsIn.length: "+argsIn.length);
+ // System.out.println("exprContext: "+exprContext);
+ int argsLen = (null != argsIn) ? argsIn.length : 0;
+ if (numberMethodParams == (argsLen - xsltParamStart + 1)) {
+ Class javaClass = paramTypes[0];
+ if (ExpressionContext.class.isAssignableFrom(javaClass)) {
+ isFirstExpressionContext = true;
+ scoreStart = 0;
+ javaParamStart++;
+ } else {
+ continue;
+ }
+ } else
+ scoreStart = 1000;
- /**
- * Specification of conversions from XSLT type CLASS_NUMBER
- * to allowed Java types.
- */
- private final static ConversionInfo[] m_numberConversions = {
- new ConversionInfo(Double.TYPE, 0),
- new ConversionInfo(java.lang.Double.class, 1),
- new ConversionInfo(Float.TYPE, 3),
- new ConversionInfo(Long.TYPE, 4),
- new ConversionInfo(Integer.TYPE, 5),
- new ConversionInfo(Short.TYPE, 6),
- new ConversionInfo(Character.TYPE, 7),
- new ConversionInfo(Byte.TYPE, 8),
- new ConversionInfo(Boolean.TYPE, 9),
- new ConversionInfo(java.lang.String.class, 10),
- new ConversionInfo(java.lang.Object.class, 11)
- };
+ if ((argsLen - xsltParamStart) == (numberMethodParams - javaParamStart)) {
+ // then we have our candidate.
+ int score = scoreMatch(paramTypes, javaParamStart, argsIn,
+ scoreStart);
+ // System.out.println("score: "+score);
+ if (-1 == score)
+ continue;
+ if (score < bestScore) {
+ // System.out.println("Assigning best method: "+method);
+ bestMethod = method;
+ bestParamTypes = paramTypes;
+ bestScore = score;
+ bestScoreCount = 1;
+ } else if (score == bestScore)
+ bestScoreCount++;
+ }
+ }
+ }
- /**
- * Specification of conversions from XSLT type CLASS_STRING
- * to allowed Java types.
- */
- private final static ConversionInfo[] m_stringConversions = {
- new ConversionInfo(java.lang.String.class, 0),
- new ConversionInfo(java.lang.Object.class, 1),
- new ConversionInfo(Character.TYPE, 2),
- new ConversionInfo(Double.TYPE, 3),
- new ConversionInfo(Float.TYPE, 3),
- new ConversionInfo(Long.TYPE, 3),
- new ConversionInfo(Integer.TYPE, 3),
- new ConversionInfo(Short.TYPE, 3),
- new ConversionInfo(Byte.TYPE, 3),
- new ConversionInfo(Boolean.TYPE, 4)
- };
+ if (null == bestMethod) {
+ throw new NoSuchMethodException(errString("function", "method",
+ classObj, name, searchMethod, argsIn));
+ }
+ /***********************************************************************
+ * * This is commented out until we can do a better object -> object
+ * scoring else if (bestScoreCount > 1) throw new
+ * TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_MORE_MATCH_METHOD,
+ * new Object[]{name})); //"More than one best match for method " +
+ * name);
+ **********************************************************************/
+ else
+ convertParams(argsIn, argsOut, bestParamTypes, exprContext);
- /**
- * Specification of conversions from XSLT type CLASS_RTREEFRAG
- * to allowed Java types.
- */
- private final static ConversionInfo[] m_rtfConversions = {
- new ConversionInfo(org.w3c.dom.traversal.NodeIterator.class, 0),
- new ConversionInfo(org.w3c.dom.NodeList.class, 1),
- new ConversionInfo(org.w3c.dom.Node.class, 2),
- new ConversionInfo(java.lang.String.class, 3),
- new ConversionInfo(java.lang.Object.class, 5),
- new ConversionInfo(Character.TYPE, 6),
- new ConversionInfo(Double.TYPE, 7),
- new ConversionInfo(Float.TYPE, 7),
- new ConversionInfo(Long.TYPE, 7),
- new ConversionInfo(Integer.TYPE, 7),
- new ConversionInfo(Short.TYPE, 7),
- new ConversionInfo(Byte.TYPE, 7),
- new ConversionInfo(Boolean.TYPE, 8)
- };
-
- /**
- * Specification of conversions from XSLT type CLASS_NODESET
- * to allowed Java types. (This is the same as for CLASS_RTREEFRAG)
- */
- private final static ConversionInfo[] m_nodesetConversions = {
- new ConversionInfo(org.w3c.dom.traversal.NodeIterator.class, 0),
- new ConversionInfo(org.w3c.dom.NodeList.class, 1),
- new ConversionInfo(org.w3c.dom.Node.class, 2),
- new ConversionInfo(java.lang.String.class, 3),
- new ConversionInfo(java.lang.Object.class, 5),
- new ConversionInfo(Character.TYPE, 6),
- new ConversionInfo(Double.TYPE, 7),
- new ConversionInfo(Float.TYPE, 7),
- new ConversionInfo(Long.TYPE, 7),
- new ConversionInfo(Integer.TYPE, 7),
- new ConversionInfo(Short.TYPE, 7),
- new ConversionInfo(Byte.TYPE, 7),
- new ConversionInfo(Boolean.TYPE, 8)
- };
-
- /**
- * Order is significant in the list below, based on
- * XObject.CLASS_XXX values.
- */
- private final static ConversionInfo[][] m_conversions =
- {
- m_javaObjConversions, // CLASS_UNKNOWN = 0;
- m_booleanConversions, // CLASS_BOOLEAN = 1;
- m_numberConversions, // CLASS_NUMBER = 2;
- m_stringConversions, // CLASS_STRING = 3;
- m_nodesetConversions, // CLASS_NODESET = 4;
- m_rtfConversions // CLASS_RTREEFRAG = 5;
- };
-
- /**
- * Score the conversion of a set of XSLT arguments to a
- * given set of Java parameters.
- * If any invocations of this function for a method with
- * the same name return the same positive value, then a conflict
- * has occured, and an error should be signaled.
- * @param javaParamTypes Must be filled with valid class names, and
- * of the same length as xsltArgs.
- * @param xsltArgs Must be filled with valid object instances, and
- * of the same length as javeParamTypes.
- * @return -1 for no allowed conversion, or a positive score
- * that is closer to zero for more preferred, or further from
- * zero for less preferred.
- */
- public static int scoreMatch(Class[] javaParamTypes, int javaParamsStart,
- Object[] xsltArgs, int score)
- {
- if ((xsltArgs == null) || (javaParamTypes == null))
- return score;
- int nParams = xsltArgs.length;
- for(int i = nParams - javaParamTypes.length + javaParamsStart, javaParamTypesIndex = javaParamsStart;
- i < nParams;
- i++, javaParamTypesIndex++)
- {
- Object xsltObj = xsltArgs[i];
- int xsltClassType = (xsltObj instanceof XObject)
- ? ((XObject)xsltObj).getType()
- : XObject.CLASS_UNKNOWN;
- Class javaClass = javaParamTypes[javaParamTypesIndex];
-
- // System.out.println("Checking xslt: "+xsltObj.getClass().getName()+
- // " against java: "+javaClass.getName());
-
- if(xsltClassType == XObject.CLASS_NULL)
- {
- // In Xalan I have objects of CLASS_NULL, though I'm not
- // sure they're used any more. For now, do something funky.
- if(!javaClass.isPrimitive())
- {
- // Then assume that a null can be used, but give it a low score.
- score += 10;
- continue;
- }
- else
- return -1; // no match.
- }
-
- ConversionInfo[] convInfo = m_conversions[xsltClassType];
- int nConversions = convInfo.length;
- int k;
- for(k = 0; k < nConversions; k++)
- {
- ConversionInfo cinfo = convInfo[k];
- if(javaClass.isAssignableFrom(cinfo.m_class))
- {
- score += cinfo.m_score;
- break; // from k loop
- }
- }
+ return bestMethod;
+ }
- if (k == nConversions)
- {
- // If we get here, we haven't made a match on this parameter using
- // the ConversionInfo array. We now try to handle the object -> object
- // mapping which we can't handle through the array mechanism. To do this,
- // we must determine the class of the argument passed from the stylesheet.
+ /**
+ * To support EXSLT extensions, convert names with dash to allowable Java
+ * names: e.g., convert abc-xyz to abcXyz. Note: dashes only appear in
+ * middle of an EXSLT function or element name.
+ */
+ private static String replaceDash(String name) {
+ char dash = '-';
+ StringBuffer buff = new StringBuffer("");
+ for (int i = 0; i < name.length(); i++) {
+ if (name.charAt(i) == dash) {
+ } else if (i > 0 && name.charAt(i - 1) == dash)
+ buff.append(Character.toUpperCase(name.charAt(i)));
+ else
+ buff.append(name.charAt(i));
+ }
+ return buff.toString();
+ }
- // If we were passed a subclass of XObject, representing one of the actual
- // XSLT types, and we are here, we reject this extension method as a candidate
- // because a match should have been made using the ConversionInfo array. If we
- // were passed an XObject that encapsulates a non-XSLT type or we
- // were passed a non-XSLT type directly, we continue.
+ /**
+ * Given the name of a method, figure out the resolution of the Java Method
+ *
+ * @param classObj
+ * The Class of the object that should have the method.
+ * @param name
+ * The name of the method to be invoked.
+ * @return A method that will work to be called as an element.
+ * @throws TransformerException
+ * may be thrown for Xalan conversion exceptions.
+ */
+ public static Method getElementMethod(Class classObj, String name)
+ throws NoSuchMethodException, SecurityException,
+ TransformerException {
+ // System.out.println("---> Looking for element method: "+name);
+ // System.out.println("---> classObj: "+classObj);
+ Method bestMethod = null;
+ Method[] methods = classObj.getMethods();
+ int nMethods = methods.length;
+ int bestScoreCount = 0;
+ for (int i = 0; i < nMethods; i++) {
+ Method method = methods[i];
+ // System.out.println("looking at method: "+method);
+ if (method.getName().equals(name)) {
+ Class[] paramTypes = method.getParameterTypes();
+ if ((paramTypes.length == 2)
+ && paramTypes[1]
+ .isAssignableFrom(org.apache.xalan.templates.ElemExtensionCall.class)
+ && paramTypes[0]
+ .isAssignableFrom(org.apache.xalan.extensions.XSLProcessorContext.class)) {
+ if (++bestScoreCount == 1)
+ bestMethod = method;
+ else
+ break;
+ }
+ }
+ }
- // The current implementation (contributed by Kelly Campbell <camk@channelpoint.com>)
- // checks to see if we were passed an XObject from the XSLT stylesheet. If not,
- // we use the class of the object that was passed and make sure that it will
- // map to the class type of the parameter in the extension function.
- // If we were passed an XObject, we attempt to get the class of the actual
- // object encapsulated inside the XObject. If the encapsulated object is null,
- // we judge this method as a match but give it a low score.
- // If the encapsulated object is not null, we use its type to determine
- // whether this java method is a valid match for this extension function call.
- // This approach eliminates the NullPointerException in the earlier implementation
- // that resulted from passing an XObject encapsulating the null java object.
-
- // TODO: This needs to be improved to assign relative scores to subclasses,
- // etc.
+ if (null == bestMethod) {
+ throw new NoSuchMethodException(errString("element", "method",
+ classObj, name, 0, null));
+ } else if (bestScoreCount > 1)
+ throw new TransformerException(Messages.createMessage(
+ XSLTErrorResources.ER_MORE_MATCH_ELEMENT,
+ new Object[] { name })); // "More than one best match for
+ // element method " + name);
- if (XObject.CLASS_UNKNOWN == xsltClassType)
- {
- Class realClass = null;
+ return bestMethod;
+ }
- if (xsltObj instanceof XObject)
- {
- Object realObj = ((XObject) xsltObj).object();
- if (null != realObj)
- {
- realClass = realObj.getClass();
- }
- else
- {
- // do the same as if we were passed XObject.CLASS_NULL
- score += 10;
- continue;
- }
- }
- else
- {
- realClass = xsltObj.getClass();
- }
+ /**
+ * Convert a set of parameters based on a set of paramTypes.
+ *
+ * @param argsIn
+ * An array of XSLT/XPath arguments.
+ * @param argsOut
+ * An array of the exact size as argsIn, which will be populated
+ * with converted arguments.
+ * @param paramTypes
+ * An array of class objects, of the exact same size as argsIn
+ * and argsOut.
+ * @throws TransformerException
+ * may be thrown for Xalan conversion exceptions.
+ */
+ public static void convertParams(Object[] argsIn, Object[][] argsOut,
+ Class[] paramTypes, ExpressionContext exprContext)
+ throws javax.xml.transform.TransformerException {
+ // System.out.println("In convertParams");
+ if (paramTypes == null)
+ argsOut[0] = null;
+ else {
+ int nParams = paramTypes.length;
+ argsOut[0] = new Object[nParams];
+ int paramIndex = 0;
+ if ((nParams > 0)
+ && ExpressionContext.class.isAssignableFrom(paramTypes[0])) {
+ argsOut[0][0] = exprContext;
+ // System.out.println("Incrementing paramIndex in convertParams:
+ // "+paramIndex);
+ paramIndex++;
+ }
- if (javaClass.isAssignableFrom(realClass))
- {
- score += 0; // TODO: To be assigned based on subclass "distance"
- }
- else
- return -1;
- }
- else
- return -1;
- }
- }
- return score;
- }
-
- /**
- * Convert the given XSLT object to an object of
- * the given class.
- * @param xsltObj The XSLT object that needs conversion.
- * @param javaClass The type of object to convert to.
- * @returns An object suitable for passing to the Method.invoke
- * function in the args array, which may be null in some cases.
- * @throws TransformerException may be thrown for Xalan conversion
- * exceptions.
- */
- static Object convert(Object xsltObj, Class javaClass)
- throws javax.xml.transform.TransformerException
- {
- if(xsltObj instanceof XObject)
- {
- XObject xobj = ((XObject)xsltObj);
- int xsltClassType = xobj.getType();
+ if (argsIn != null) {
+ for (int i = argsIn.length - nParams + paramIndex; paramIndex < nParams; i++, paramIndex++) {
+ // System.out.println("paramTypes[i]: "+paramTypes[i]);
+ argsOut[0][paramIndex] = convert(argsIn[i],
+ paramTypes[paramIndex]);
+ }
+ }
+ }
+ }
- switch(xsltClassType)
- {
- case XObject.CLASS_NULL:
- return null;
-
- case XObject.CLASS_BOOLEAN:
- {
- if(javaClass == java.lang.String.class)
- return xobj.str();
- else
- return new Boolean(xobj.bool());
- }
- // break; Unreachable
- case XObject.CLASS_NUMBER:
- {
- if(javaClass == java.lang.String.class)
- return xobj.str();
- else if(javaClass == Boolean.TYPE)
- return new Boolean(xobj.bool());
- else
- {
- return convertDoubleToNumber(xobj.num(), javaClass);
- }
- }
- // break; Unreachable
-
- case XObject.CLASS_STRING:
- {
- if((javaClass == java.lang.String.class) ||
- (javaClass == java.lang.Object.class))
- return xobj.str();
- else if(javaClass == Character.TYPE)
- {
- String str = xobj.str();
- if(str.length() > 0)
- return new Character(str.charAt(0));
- else
- return null; // ??
- }
- else if(javaClass == Boolean.TYPE)
- return new Boolean(xobj.bool());
- else
- {
- return convertDoubleToNumber(xobj.num(), javaClass);
- }
- }
- // break; Unreachable
-
- case XObject.CLASS_RTREEFRAG:
- {
- // GLP: I don't see the reason for the isAssignableFrom call
- // instead of an == test as is used everywhere else.
- // Besides, if the javaClass is a subclass of NodeIterator
- // the condition will be true and we'll create a NodeIterator
- // which may not match the javaClass, causing a RuntimeException.
- // if((NodeIterator.class.isAssignableFrom(javaClass)) ||
- if ( (javaClass == NodeIterator.class) ||
- (javaClass == java.lang.Object.class) )
- {
- DTMIterator dtmIter = ((XRTreeFrag) xobj).asNodeIterator();
- return new DTMNodeIterator(dtmIter);
- }
- else if (javaClass == NodeList.class)
- {
- return ((XRTreeFrag) xobj).convertToNodeset();
- }
- // Same comment as above
- // else if(Node.class.isAssignableFrom(javaClass))
- else if(javaClass == Node.class)
- {
- DTMIterator iter = ((XRTreeFrag) xobj).asNodeIterator();
- int rootHandle = iter.nextNode();
- DTM dtm = iter.getDTM(rootHandle);
- return dtm.getNode(dtm.getFirstChild(rootHandle));
- }
- else if(javaClass == java.lang.String.class)
- {
- return xobj.str();
- }
- else if(javaClass == Boolean.TYPE)
- {
- return new Boolean(xobj.bool());
- }
- else if(javaClass.isPrimitive())
- {
- return convertDoubleToNumber(xobj.num(), javaClass);
- }
- else
- {
- DTMIterator iter = ((XRTreeFrag) xobj).asNodeIterator();
- int rootHandle = iter.nextNode();
- DTM dtm = iter.getDTM(rootHandle);
- Node child = dtm.getNode(dtm.getFirstChild(rootHandle));
+ /**
+ * Simple class to hold information about allowed conversions and their
+ * relative scores, for use by the table below.
+ */
+ static class ConversionInfo {
+ ConversionInfo(Class cl, int score) {
+ m_class = cl;
+ m_score = score;
+ }
- if(javaClass.isAssignableFrom(child.getClass()))
- return child;
- else
- return null;
- }
- }
- // break; Unreachable
-
- case XObject.CLASS_NODESET:
- {
- // GLP: I don't see the reason for the isAssignableFrom call
- // instead of an == test as is used everywhere else.
- // Besides, if the javaClass is a subclass of NodeIterator
- // the condition will be true and we'll create a NodeIterator
- // which may not match the javaClass, causing a RuntimeException.
- // if((NodeIterator.class.isAssignableFrom(javaClass)) ||
- if ( (javaClass == NodeIterator.class) ||
- (javaClass == java.lang.Object.class) )
- {
- return xobj.nodeset();
- }
- // Same comment as above
- // else if(NodeList.class.isAssignableFrom(javaClass))
- else if(javaClass == NodeList.class)
- {
- return xobj.nodelist();
- }
- // Same comment as above
- // else if(Node.class.isAssignableFrom(javaClass))
- else if(javaClass == Node.class)
- {
- // Xalan ensures that iter() always returns an
- // iterator positioned at the beginning.
- DTMIterator ni = xobj.iter();
- int handle = ni.nextNode();
- if (handle != DTM.NULL)
- return ni.getDTM(handle).getNode(handle); // may be null.
- else
- return null;
- }
- else if(javaClass == java.lang.String.class)
- {
- return xobj.str();
- }
- else if(javaClass == Boolean.TYPE)
- {
- return new Boolean(xobj.bool());
- }
- else if(javaClass.isPrimitive())
- {
- return convertDoubleToNumber(xobj.num(), javaClass);
- }
- else
- {
- DTMIterator iter = xobj.iter();
- int childHandle = iter.nextNode();
- DTM dtm = iter.getDTM(childHandle);
- Node child = dtm.getNode(childHandle);
- if(javaClass.isAssignableFrom(child.getClass()))
- return child;
- else
- return null;
- }
- }
- // break; Unreachable
-
- // No default:, fall-through on purpose
- } // end switch
- xsltObj = xobj.object();
-
- } // end if if(xsltObj instanceof XObject)
-
- // At this point, we have a raw java object, not an XObject.
- if (null != xsltObj)
- {
- if(javaClass == java.lang.String.class)
- {
- return xsltObj.toString();
- }
- else if(javaClass.isPrimitive())
- {
- // Assume a number conversion
- XString xstr = new XString(xsltObj.toString());
- double num = xstr.num();
- return convertDoubleToNumber(num, javaClass);
- }
- else if(javaClass == java.lang.Class.class)
- {
- return xsltObj.getClass();
- }
- else
- {
- // Just pass the object directly, and hope for the best.
- return xsltObj;
- }
- }
- else
- {
- // Just pass the object directly, and hope for the best.
- return xsltObj;
- }
- }
-
- /**
- * Do a standard conversion of a double to the specified type.
- * @param num The number to be converted.
- * @param javaClass The class type to be converted to.
- * @return An object specified by javaClass, or a Double instance.
- */
- static Object convertDoubleToNumber(double num, Class javaClass)
- {
- // In the code below, I don't check for NaN, etc., instead
- // using the standard Java conversion, as I think we should
- // specify. See issue-runtime-errors.
- if((javaClass == Double.TYPE) ||
- (javaClass == java.lang.Double.class))
- return new Double(num);
- else if(javaClass == Float.TYPE)
- return new Float(num);
- else if(javaClass == Long.TYPE)
- {
- // Use standard Java Narrowing Primitive Conversion
- // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
- return new Long((long)num);
- }
- else if(javaClass == Integer.TYPE)
- {
- // Use standard Java Narrowing Primitive Conversion
- // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
- return new Integer((int)num);
- }
- else if(javaClass == Short.TYPE)
- {
- // Use standard Java Narrowing Primitive Conversion
- // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
- return new Short((short)num);
- }
- else if(javaClass == Character.TYPE)
- {
- // Use standard Java Narrowing Primitive Conversion
- // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
- return new Character((char)num);
- }
- else if(javaClass == Byte.TYPE)
- {
- // Use standard Java Narrowing Primitive Conversion
- // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
- return new Byte((byte)num);
- }
- else // Some other type of object
- {
- return new Double(num);
- }
- }
+ Class m_class; // Java class to convert to.
+ int m_score; // Match score, closer to zero is more matched.
+ }
+ private static final int SCOREBASE = 1;
- /**
- * Format the message for the NoSuchMethodException containing
- * all the information about the method we're looking for.
- */
- private static String errString(String callType, // "function" or "element"
- String searchType, // "method" or "constructor"
- Class classObj,
- String funcName,
- int searchMethod,
- Object[] xsltArgs)
- {
- String resultString = "For extension " + callType
- + ", could not find " + searchType + " ";
- switch (searchMethod)
- {
- case STATIC_ONLY:
- return resultString + "static " + classObj.getName() + "."
- + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").";
+ /**
+ * Specification of conversions from XSLT type CLASS_UNKNOWN (i.e. some
+ * unknown Java object) to allowed Java types.
+ */
+ private final static ConversionInfo[] m_javaObjConversions = {
+ new ConversionInfo(Double.TYPE, 11),
+ new ConversionInfo(Float.TYPE, 12),
+ new ConversionInfo(Long.TYPE, 13),
+ new ConversionInfo(Integer.TYPE, 14),
+ new ConversionInfo(Short.TYPE, 15),
+ new ConversionInfo(Character.TYPE, 16),
+ new ConversionInfo(Byte.TYPE, 17),
+ new ConversionInfo(java.lang.String.class, 18) };
- case INSTANCE_ONLY:
- return resultString + classObj.getName() + "."
- + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").";
+ /**
+ * Specification of conversions from XSLT type CLASS_BOOLEAN to allowed Java
+ * types.
+ */
+ private final static ConversionInfo[] m_booleanConversions = {
+ new ConversionInfo(Boolean.TYPE, 0),
+ new ConversionInfo(java.lang.Boolean.class, 1),
+ new ConversionInfo(java.lang.Object.class, 2),
+ new ConversionInfo(java.lang.String.class, 3) };
- case STATIC_AND_INSTANCE:
- return resultString + classObj.getName() + "." + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").\n"
- + "Checked both static and instance methods.";
+ /**
+ * Specification of conversions from XSLT type CLASS_NUMBER to allowed Java
+ * types.
+ */
+ private final static ConversionInfo[] m_numberConversions = {
+ new ConversionInfo(Double.TYPE, 0),
+ new ConversionInfo(java.lang.Double.class, 1),
+ new ConversionInfo(Float.TYPE, 3),
+ new ConversionInfo(Long.TYPE, 4),
+ new ConversionInfo(Integer.TYPE, 5),
+ new ConversionInfo(Short.TYPE, 6),
+ new ConversionInfo(Character.TYPE, 7),
+ new ConversionInfo(Byte.TYPE, 8),
+ new ConversionInfo(Boolean.TYPE, 9),
+ new ConversionInfo(java.lang.String.class, 10),
+ new ConversionInfo(java.lang.Object.class, 11) };
- case DYNAMIC:
- return resultString + "static " + classObj.getName() + "." + funcName
- + "([ExpressionContext, ]" + errArgs(xsltArgs, 0) + ") nor\n"
- + classObj + "." + funcName + "([ExpressionContext,] " + errArgs(xsltArgs, 1) + ").";
+ /**
+ * Specification of conversions from XSLT type CLASS_STRING to allowed Java
+ * types.
+ */
+ private final static ConversionInfo[] m_stringConversions = {
+ new ConversionInfo(java.lang.String.class, 0),
+ new ConversionInfo(java.lang.Object.class, 1),
+ new ConversionInfo(Character.TYPE, 2),
+ new ConversionInfo(Double.TYPE, 3),
+ new ConversionInfo(Float.TYPE, 3),
+ new ConversionInfo(Long.TYPE, 3),
+ new ConversionInfo(Integer.TYPE, 3),
+ new ConversionInfo(Short.TYPE, 3),
+ new ConversionInfo(Byte.TYPE, 3),
+ new ConversionInfo(Boolean.TYPE, 4) };
- default:
- if (callType.equals("function")) // must be a constructor
- {
- return resultString + classObj.getName()
- + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").";
- }
- else // must be an element call
- {
- return resultString + classObj.getName() + "." + funcName
- + "(org.apache.xalan.extensions.XSLProcessorContext, "
- + "org.apache.xalan.templates.ElemExtensionCall).";
- }
- }
-
- }
+ /**
+ * Specification of conversions from XSLT type CLASS_RTREEFRAG to allowed
+ * Java types.
+ */
+ private final static ConversionInfo[] m_rtfConversions = {
+ new ConversionInfo(org.w3c.dom.traversal.NodeIterator.class, 0),
+ new ConversionInfo(org.w3c.dom.NodeList.class, 1),
+ new ConversionInfo(org.w3c.dom.Node.class, 2),
+ new ConversionInfo(java.lang.String.class, 3),
+ new ConversionInfo(java.lang.Object.class, 5),
+ new ConversionInfo(Character.TYPE, 6),
+ new ConversionInfo(Double.TYPE, 7),
+ new ConversionInfo(Float.TYPE, 7),
+ new ConversionInfo(Long.TYPE, 7),
+ new ConversionInfo(Integer.TYPE, 7),
+ new ConversionInfo(Short.TYPE, 7),
+ new ConversionInfo(Byte.TYPE, 7),
+ new ConversionInfo(Boolean.TYPE, 8) };
+ /**
+ * Specification of conversions from XSLT type CLASS_NODESET to allowed Java
+ * types. (This is the same as for CLASS_RTREEFRAG)
+ */
+ private final static ConversionInfo[] m_nodesetConversions = {
+ new ConversionInfo(org.w3c.dom.traversal.NodeIterator.class, 0),
+ new ConversionInfo(org.w3c.dom.NodeList.class, 1),
+ new ConversionInfo(org.w3c.dom.Node.class, 2),
+ new ConversionInfo(java.lang.String.class, 3),
+ new ConversionInfo(java.lang.Object.class, 5),
+ new ConversionInfo(Character.TYPE, 6),
+ new ConversionInfo(Double.TYPE, 7),
+ new ConversionInfo(Float.TYPE, 7),
+ new ConversionInfo(Long.TYPE, 7),
+ new ConversionInfo(Integer.TYPE, 7),
+ new ConversionInfo(Short.TYPE, 7),
+ new ConversionInfo(Byte.TYPE, 7),
+ new ConversionInfo(Boolean.TYPE, 8) };
- private static String errArgs(Object[] xsltArgs, int startingArg)
- {
- StringBuffer returnArgs = new StringBuffer();
- for (int i = startingArg; i < xsltArgs.length; i++)
- {
- if (i != startingArg)
- returnArgs.append(", ");
- if (xsltArgs[i] instanceof XObject)
- returnArgs.append(((XObject) xsltArgs[i]).getTypeString());
- else
- returnArgs.append(xsltArgs[i].getClass().getName());
- }
- return returnArgs.toString();
- }
+ /**
+ * Order is significant in the list below, based on XObject.CLASS_XXX
+ * values.
+ */
+ private final static ConversionInfo[][] m_conversions = {
+ m_javaObjConversions, // CLASS_UNKNOWN = 0;
+ m_booleanConversions, // CLASS_BOOLEAN = 1;
+ m_numberConversions, // CLASS_NUMBER = 2;
+ m_stringConversions, // CLASS_STRING = 3;
+ m_nodesetConversions, // CLASS_NODESET = 4;
+ m_rtfConversions // CLASS_RTREEFRAG = 5;
+ };
+
+ /**
+ * Score the conversion of a set of XSLT arguments to a given set of Java
+ * parameters. If any invocations of this function for a method with the
+ * same name return the same positive value, then a conflict has occured,
+ * and an error should be signaled.
+ *
+ * @param javaParamTypes
+ * Must be filled with valid class names, and of the same length
+ * as xsltArgs.
+ * @param xsltArgs
+ * Must be filled with valid object instances, and of the same
+ * length as javeParamTypes.
+ * @return -1 for no allowed conversion, or a positive score that is closer
+ * to zero for more preferred, or further from zero for less
+ * preferred.
+ */
+ public static int scoreMatch(Class[] javaParamTypes, int javaParamsStart,
+ Object[] xsltArgs, int score) {
+ if ((xsltArgs == null) || (javaParamTypes == null))
+ return score;
+ int nParams = xsltArgs.length;
+ for (int i = nParams - javaParamTypes.length + javaParamsStart, javaParamTypesIndex = javaParamsStart; i < nParams; i++, javaParamTypesIndex++) {
+ Object xsltObj = xsltArgs[i];
+ int xsltClassType = (xsltObj instanceof XObject) ? ((XObject) xsltObj)
+ .getType()
+ : XObject.CLASS_UNKNOWN;
+ Class javaClass = javaParamTypes[javaParamTypesIndex];
+
+ // System.out.println("Checking xslt:
+ // "+xsltObj.getClass().getName()+
+ // " against java: "+javaClass.getName());
+
+ if (xsltClassType == XObject.CLASS_NULL) {
+ // In Xalan I have objects of CLASS_NULL, though I'm not
+ // sure they're used any more. For now, do something funky.
+ if (!javaClass.isPrimitive()) {
+ // Then assume that a null can be used, but give it a low
+ // score.
+ score += 10;
+ continue;
+ } else
+ return -1; // no match.
+ }
+
+ ConversionInfo[] convInfo = m_conversions[xsltClassType];
+ int nConversions = convInfo.length;
+ int k;
+ for (k = 0; k < nConversions; k++) {
+ ConversionInfo cinfo = convInfo[k];
+ if (javaClass.isAssignableFrom(cinfo.m_class)) {
+ score += cinfo.m_score;
+ break; // from k loop
+ }
+ }
+
+ if (k == nConversions) {
+ // If we get here, we haven't made a match on this parameter
+ // using
+ // the ConversionInfo array. We now try to handle the object ->
+ // object
+ // mapping which we can't handle through the array mechanism. To
+ // do this,
+ // we must determine the class of the argument passed from the
+ // stylesheet.
+
+ // If we were passed a subclass of XObject, representing one of
+ // the actual
+ // XSLT types, and we are here, we reject this extension method
+ // as a candidate
+ // because a match should have been made using the
+ // ConversionInfo array. If we
+ // were passed an XObject that encapsulates a non-XSLT type or
+ // we
+ // were passed a non-XSLT type directly, we continue.
+
+ // The current implementation (contributed by Kelly Campbell
+ // <camk@channelpoint.com>)
+ // checks to see if we were passed an XObject from the XSLT
+ // stylesheet. If not,
+ // we use the class of the object that was passed and make sure
+ // that it will
+ // map to the class type of the parameter in the extension
+ // function.
+ // If we were passed an XObject, we attempt to get the class of
+ // the actual
+ // object encapsulated inside the XObject. If the encapsulated
+ // object is null,
+ // we judge this method as a match but give it a low score.
+ // If the encapsulated object is not null, we use its type to
+ // determine
+ // whether this java method is a valid match for this extension
+ // function call.
+ // This approach eliminates the NullPointerException in the
+ // earlier implementation
+ // that resulted from passing an XObject encapsulating the null
+ // java object.
+
+ // TODO: This needs to be improved to assign relative scores to
+ // subclasses,
+ // etc.
+
+ if (XObject.CLASS_UNKNOWN == xsltClassType) {
+ Class realClass = null;
+
+ if (xsltObj instanceof XObject) {
+ Object realObj = ((XObject) xsltObj).object();
+ if (null != realObj) {
+ realClass = realObj.getClass();
+ } else {
+ // do the same as if we were passed
+ // XObject.CLASS_NULL
+ score += 10;
+ continue;
+ }
+ } else {
+ realClass = xsltObj.getClass();
+ }
+
+ if (javaClass.isAssignableFrom(realClass)) {
+ score += 0; // TODO: To be assigned based on subclass
+ // "distance"
+ } else
+ return -1;
+ } else
+ return -1;
+ }
+ }
+ return score;
+ }
+
+ /**
+ * Convert the given XSLT object to an object of the given class.
+ *
+ * @param xsltObj
+ * The XSLT object that needs conversion.
+ * @param javaClass
+ * The type of object to convert to.
+ * @returns An object suitable for passing to the Method.invoke function in
+ * the args array, which may be null in some cases.
+ * @throws TransformerException
+ * may be thrown for Xalan conversion exceptions.
+ */
+ static Object convert(Object xsltObj, Class javaClass)
+ throws javax.xml.transform.TransformerException {
+ if (xsltObj instanceof XObject) {
+ XObject xobj = ((XObject) xsltObj);
+ int xsltClassType = xobj.getType();
+
+ switch (xsltClassType) {
+ case XObject.CLASS_NULL:
+ return null;
+
+ case XObject.CLASS_BOOLEAN: {
+ if (javaClass == java.lang.String.class)
+ return xobj.str();
+ else
+ return new Boolean(xobj.bool());
+ }
+ // break; Unreachable
+ case XObject.CLASS_NUMBER: {
+ if (javaClass == java.lang.String.class)
+ return xobj.str();
+ else if (javaClass == Boolean.TYPE)
+ return new Boolean(xobj.bool());
+ else {
+ return convertDoubleToNumber(xobj.num(), javaClass);
+ }
+ }
+ // break; Unreachable
+
+ case XObject.CLASS_STRING: {
+ if ((javaClass == java.lang.String.class)
+ || (javaClass == java.lang.Object.class))
+ return xobj.str();
+ else if (javaClass == Character.TYPE) {
+ String str = xobj.str();
+ if (str.length() > 0)
+ return new Character(str.charAt(0));
+ else
+ return null; // ??
+ } else if (javaClass == Boolean.TYPE)
+ return new Boolean(xobj.bool());
+ else {
+ return convertDoubleToNumber(xobj.num(), javaClass);
+ }
+ }
+ // break; Unreachable
+
+ case XObject.CLASS_RTREEFRAG: {
+ // GLP: I don't see the reason for the isAssignableFrom call
+ // instead of an == test as is used everywhere else.
+ // Besides, if the javaClass is a subclass of NodeIterator
+ // the condition will be true and we'll create a NodeIterator
+ // which may not match the javaClass, causing a
+ // RuntimeException.
+ // if((NodeIterator.class.isAssignableFrom(javaClass)) ||
+ if ((javaClass == NodeIterator.class)
+ || (javaClass == java.lang.Object.class)) {
+ DTMIterator dtmIter = ((XRTreeFrag) xobj).asNodeIterator();
+ return new DTMNodeIterator(dtmIter);
+ } else if (javaClass == NodeList.class) {
+ return ((XRTreeFrag) xobj).convertToNodeset();
+ }
+ // Same comment as above
+ // else if(Node.class.isAssignableFrom(javaClass))
+ else if (javaClass == Node.class) {
+ DTMIterator iter = ((XRTreeFrag) xobj).asNodeIterator();
+ int rootHandle = iter.nextNode();
+ DTM dtm = iter.getDTM(rootHandle);
+ return dtm.getNode(dtm.getFirstChild(rootHandle));
+ } else if (javaClass == java.lang.String.class) {
+ return xobj.str();
+ } else if (javaClass == Boolean.TYPE) {
+ return new Boolean(xobj.bool());
+ } else if (javaClass.isPrimitive()) {
+ return convertDoubleToNumber(xobj.num(), javaClass);
+ } else {
+ DTMIterator iter = ((XRTreeFrag) xobj).asNodeIterator();
+ int rootHandle = iter.nextNode();
+ DTM dtm = iter.getDTM(rootHandle);
+ Node child = dtm.getNode(dtm.getFirstChild(rootHandle));
+
+ if (javaClass.isAssignableFrom(child.getClass()))
+ return child;
+ else
+ return null;
+ }
+ }
+ // break; Unreachable
+
+ case XObject.CLASS_NODESET: {
+ // GLP: I don't see the reason for the isAssignableFrom call
+ // instead of an == test as is used everywhere else.
+ // Besides, if the javaClass is a subclass of NodeIterator
+ // the condition will be true and we'll create a NodeIterator
+ // which may not match the javaClass, causing a
+ // RuntimeException.
+ // if((NodeIterator.class.isAssignableFrom(javaClass)) ||
+ if ((javaClass == NodeIterator.class)
+ || (javaClass == java.lang.Object.class)) {
+ return xobj.nodeset();
+ }
+ // Same comment as above
+ // else if(NodeList.class.isAssignableFrom(javaClass))
+ else if (javaClass == NodeList.class) {
+ return xobj.nodelist();
+ }
+ // Same comment as above
+ // else if(Node.class.isAssignableFrom(javaClass))
+ else if (javaClass == Node.class) {
+ // Xalan ensures that iter() always returns an
+ // iterator positioned at the beginning.
+ DTMIterator ni = xobj.iter();
+ int handle = ni.nextNode();
+ if (handle != DTM.NULL)
+ return ni.getDTM(handle).getNode(handle); // may be
+ // null.
+ else
+ return null;
+ } else if (javaClass == java.lang.String.class) {
+ return xobj.str();
+ } else if (javaClass == Boolean.TYPE) {
+ return new Boolean(xobj.bool());
+ } else if (javaClass.isPrimitive()) {
+ return convertDoubleToNumber(xobj.num(), javaClass);
+ } else {
+ DTMIterator iter = xobj.iter();
+ int childHandle = iter.nextNode();
+ DTM dtm = iter.getDTM(childHandle);
+ Node child = dtm.getNode(childHandle);
+ if (javaClass.isAssignableFrom(child.getClass()))
+ return child;
+ else
+ return null;
+ }
+ }
+ // break; Unreachable
+
+ // No default:, fall-through on purpose
+ } // end switch
+ xsltObj = xobj.object();
+
+ } // end if if(xsltObj instanceof XObject)
+
+ // At this point, we have a raw java object, not an XObject.
+ if (null != xsltObj) {
+ if (javaClass == java.lang.String.class) {
+ return xsltObj.toString();
+ } else if (javaClass.isPrimitive()) {
+ // Assume a number conversion
+ XString xstr = new XString(xsltObj.toString());
+ double num = xstr.num();
+ return convertDoubleToNumber(num, javaClass);
+ } else if (javaClass == java.lang.Class.class) {
+ return xsltObj.getClass();
+ } else {
+ // Just pass the object directly, and hope for the best.
+ return xsltObj;
+ }
+ } else {
+ // Just pass the object directly, and hope for the best.
+ return xsltObj;
+ }
+ }
+
+ /**
+ * Do a standard conversion of a double to the specified type.
+ *
+ * @param num
+ * The number to be converted.
+ * @param javaClass
+ * The class type to be converted to.
+ * @return An object specified by javaClass, or a Double instance.
+ */
+ static Object convertDoubleToNumber(double num, Class javaClass) {
+ // In the code below, I don't check for NaN, etc., instead
+ // using the standard Java conversion, as I think we should
+ // specify. See issue-runtime-errors.
+ if ((javaClass == Double.TYPE) || (javaClass == java.lang.Double.class))
+ return new Double(num);
+ else if (javaClass == Float.TYPE)
+ return new Float(num);
+ else if (javaClass == Long.TYPE) {
+ // Use standard Java Narrowing Primitive Conversion
+ // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
+ return new Long((long) num);
+ } else if (javaClass == Integer.TYPE) {
+ // Use standard Java Narrowing Primitive Conversion
+ // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
+ return new Integer((int) num);
+ } else if (javaClass == Short.TYPE) {
+ // Use standard Java Narrowing Primitive Conversion
+ // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
+ return new Short((short) num);
+ } else if (javaClass == Character.TYPE) {
+ // Use standard Java Narrowing Primitive Conversion
+ // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
+ return new Character((char) num);
+ } else if (javaClass == Byte.TYPE) {
+ // Use standard Java Narrowing Primitive Conversion
+ // See http://java.sun.com/docs/books/jls/html/5.doc.html#175672
+ return new Byte((byte) num);
+ } else // Some other type of object
+ {
+ return new Double(num);
+ }
+ }
+
+ /**
+ * Format the message for the NoSuchMethodException containing all the
+ * information about the method we're looking for.
+ */
+ private static String errString(String callType, // "function" or
+ // "element"
+ String searchType, // "method" or "constructor"
+ Class classObj, String funcName, int searchMethod, Object[] xsltArgs) {
+ String resultString = "For extension " + callType + ", could not find "
+ + searchType + " ";
+ switch (searchMethod) {
+ case STATIC_ONLY:
+ return resultString + "static " + classObj.getName() + "."
+ + funcName + "([ExpressionContext,] "
+ + errArgs(xsltArgs, 0) + ").";
+
+ case INSTANCE_ONLY:
+ return resultString + classObj.getName() + "." + funcName
+ + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").";
+
+ case STATIC_AND_INSTANCE:
+ return resultString + classObj.getName() + "." + funcName
+ + "([ExpressionContext,] " + errArgs(xsltArgs, 0) + ").\n"
+ + "Checked both static and instance methods.";
+
+ case DYNAMIC:
+ return resultString + "static " + classObj.getName() + "."
+ + funcName + "([ExpressionContext, ]"
+ + errArgs(xsltArgs, 0) + ") nor\n" + classObj + "."
+ + funcName + "([ExpressionContext,] "
+ + errArgs(xsltArgs, 1) + ").";
+
+ default:
+ if (callType.equals("function")) // must be a constructor
+ {
+ return resultString + classObj.getName()
+ + "([ExpressionContext,] " + errArgs(xsltArgs, 0)
+ + ").";
+ } else // must be an element call
+ {
+ return resultString + classObj.getName() + "." + funcName
+ + "(org.apache.xalan.extensions.XSLProcessorContext, "
+ + "org.apache.xalan.templates.ElemExtensionCall).";
+ }
+ }
+
+ }
+
+ private static String errArgs(Object[] xsltArgs, int startingArg) {
+ StringBuffer returnArgs = new StringBuffer();
+ for (int i = startingArg; i < xsltArgs.length; i++) {
+ if (i != startingArg)
+ returnArgs.append(", ");
+ if (xsltArgs[i] instanceof XObject)
+ returnArgs.append(((XObject) xsltArgs[i]).getTypeString());
+ else
+ returnArgs.append(xsltArgs[i].getClass().getName());
+ }
+ return returnArgs.toString();
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ObjectFactory.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ObjectFactory.java
index 264c6d6..d2e6ca0 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ObjectFactory.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/ObjectFactory.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ObjectFactory.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: ObjectFactory.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -41,631 +41,617 @@
import java.io.InputStreamReader;
/**
- * This class is duplicated for each JAXP subpackage so keep it in sync.
- * It is package private and therefore is not exposed as part of the JAXP
- * API.
+ * This class is duplicated for each JAXP subpackage so keep it in sync. It is
+ * package private and therefore is not exposed as part of the JAXP API.
* <p>
- * This code is designed to implement the JAXP 1.1 spec pluggability
- * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
- * The code also runs both as part of an unbundled jar file and
- * when bundled as part of the JDK.
+ * This code is designed to implement the JAXP 1.1 spec pluggability feature and
+ * is designed to run on JDK version 1.1 and later, and to compile on JDK 1.2
+ * and onward. The code also runs both as part of an unbundled jar file and when
+ * bundled as part of the JDK.
* <p>
* This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects
* dynamically.
- *
- * @version $Id: ObjectFactory.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ *
+ * @version $Id: ObjectFactory.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
class ObjectFactory {
- //
- // Constants
- //
+ //
+ // Constants
+ //
- // name of default properties file to look for in JDK's jre/lib directory
- private static final String DEFAULT_PROPERTIES_FILENAME =
- "xalan.properties";
+ // name of default properties file to look for in JDK's jre/lib directory
+ private static final String DEFAULT_PROPERTIES_FILENAME = "xalan.properties";
- private static final String SERVICES_PATH = "META-INF/services/";
+ private static final String SERVICES_PATH = "META-INF/services/";
- /** Set to true for debugging */
- private static final boolean DEBUG = false;
+ /** Set to true for debugging */
+ private static final boolean DEBUG = false;
- /** cache the contents of the xalan.properties file.
- * Until an attempt has been made to read this file, this will
- * be null; if the file does not exist or we encounter some other error
- * during the read, this will be empty.
- */
- private static Properties fXalanProperties = null;
+ /**
+ * cache the contents of the xalan.properties file. Until an attempt has
+ * been made to read this file, this will be null; if the file does not
+ * exist or we encounter some other error during the read, this will be
+ * empty.
+ */
+ private static Properties fXalanProperties = null;
- /***
- * Cache the time stamp of the xalan.properties file so
- * that we know if it's been modified and can invalidate
- * the cache when necessary.
- */
- private static long fLastModified = -1;
+ /***************************************************************************
+ * Cache the time stamp of the xalan.properties file so that we know if it's
+ * been modified and can invalidate the cache when necessary.
+ */
+ private static long fLastModified = -1;
- //
- // Public static methods
- //
+ //
+ // Public static methods
+ //
- /**
- * Finds the implementation Class object in the specified order. The
- * specified order is the following:
- * <ol>
- * <li>query the system property using <code>System.getProperty</code>
- * <li>read <code>META-INF/services/<i>factoryId</i></code> file
- * <li>use fallback classname
- * </ol>
- *
- * @return instance of factory, never null
- *
- * @param factoryId Name of the factory to find, same as
- * a property name
- * @param fallbackClassName Implementation class name, if nothing else
- * is found. Use null to mean no fallback.
- *
- * @exception ObjectFactory.ConfigurationError
- */
- static Object createObject(String factoryId, String fallbackClassName)
- throws ConfigurationError {
- return createObject(factoryId, null, fallbackClassName);
- } // createObject(String,String):Object
+ /**
+ * Finds the implementation Class object in the specified order. The
+ * specified order is the following:
+ * <ol>
+ * <li>query the system property using <code>System.getProperty</code>
+ * <li>read <code>META-INF/services/<i>factoryId</i></code> file
+ * <li>use fallback classname
+ * </ol>
+ *
+ * @return instance of factory, never null
+ *
+ * @param factoryId
+ * Name of the factory to find, same as a property name
+ * @param fallbackClassName
+ * Implementation class name, if nothing else is found. Use null
+ * to mean no fallback.
+ *
+ * @exception ObjectFactory.ConfigurationError
+ */
+ static Object createObject(String factoryId, String fallbackClassName)
+ throws ConfigurationError {
+ return createObject(factoryId, null, fallbackClassName);
+ } // createObject(String,String):Object
- /**
- * Finds the implementation Class object in the specified order. The
- * specified order is the following:
- * <ol>
- * <li>query the system property using <code>System.getProperty</code>
- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
- * <li>read <code>META-INF/services/<i>factoryId</i></code> file
- * <li>use fallback classname
- * </ol>
- *
- * @return instance of factory, never null
- *
- * @param factoryId Name of the factory to find, same as
- * a property name
- * @param propertiesFilename The filename in the $java.home/lib directory
- * of the properties file. If none specified,
- * ${java.home}/lib/xalan.properties will be used.
- * @param fallbackClassName Implementation class name, if nothing else
- * is found. Use null to mean no fallback.
- *
- * @exception ObjectFactory.ConfigurationError
- */
- static Object createObject(String factoryId,
- String propertiesFilename,
- String fallbackClassName)
- throws ConfigurationError
- {
- Class factoryClass = lookUpFactoryClass(factoryId,
- propertiesFilename,
- fallbackClassName);
+ /**
+ * Finds the implementation Class object in the specified order. The
+ * specified order is the following:
+ * <ol>
+ * <li>query the system property using <code>System.getProperty</code>
+ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+ * <li>read <code>META-INF/services/<i>factoryId</i></code> file
+ * <li>use fallback classname
+ * </ol>
+ *
+ * @return instance of factory, never null
+ *
+ * @param factoryId
+ * Name of the factory to find, same as a property name
+ * @param propertiesFilename
+ * The filename in the $java.home/lib directory of the properties
+ * file. If none specified, ${java.home}/lib/xalan.properties
+ * will be used.
+ * @param fallbackClassName
+ * Implementation class name, if nothing else is found. Use null
+ * to mean no fallback.
+ *
+ * @exception ObjectFactory.ConfigurationError
+ */
+ static Object createObject(String factoryId, String propertiesFilename,
+ String fallbackClassName) throws ConfigurationError {
+ Class factoryClass = lookUpFactoryClass(factoryId, propertiesFilename,
+ fallbackClassName);
- if (factoryClass == null) {
- throw new ConfigurationError(
- "Provider for " + factoryId + " cannot be found", null);
- }
+ if (factoryClass == null) {
+ throw new ConfigurationError("Provider for " + factoryId
+ + " cannot be found", null);
+ }
- try{
- Object instance = factoryClass.newInstance();
- debugPrintln("created new instance of factory " + factoryId);
- return instance;
- } catch (Exception x) {
- throw new ConfigurationError(
- "Provider for factory " + factoryId
- + " could not be instantiated: " + x, x);
- }
- } // createObject(String,String,String):Object
+ try {
+ Object instance = factoryClass.newInstance();
+ debugPrintln("created new instance of factory " + factoryId);
+ return instance;
+ } catch (Exception x) {
+ throw new ConfigurationError("Provider for factory " + factoryId
+ + " could not be instantiated: " + x, x);
+ }
+ } // createObject(String,String,String):Object
- /**
- * Finds the implementation Class object in the specified order. The
- * specified order is the following:
- * <ol>
- * <li>query the system property using <code>System.getProperty</code>
- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
- * <li>read <code>META-INF/services/<i>factoryId</i></code> file
- * <li>use fallback classname
- * </ol>
- *
- * @return Class object of factory, never null
- *
- * @param factoryId Name of the factory to find, same as
- * a property name
- * @param propertiesFilename The filename in the $java.home/lib directory
- * of the properties file. If none specified,
- * ${java.home}/lib/xalan.properties will be used.
- * @param fallbackClassName Implementation class name, if nothing else
- * is found. Use null to mean no fallback.
- *
- * @exception ObjectFactory.ConfigurationError
- */
- static Class lookUpFactoryClass(String factoryId)
- throws ConfigurationError
- {
- return lookUpFactoryClass(factoryId, null, null);
- } // lookUpFactoryClass(String):Class
+ /**
+ * Finds the implementation Class object in the specified order. The
+ * specified order is the following:
+ * <ol>
+ * <li>query the system property using <code>System.getProperty</code>
+ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+ * <li>read <code>META-INF/services/<i>factoryId</i></code> file
+ * <li>use fallback classname
+ * </ol>
+ *
+ * @return Class object of factory, never null
+ *
+ * @param factoryId
+ * Name of the factory to find, same as a property name
+ * @param propertiesFilename
+ * The filename in the $java.home/lib directory of the properties
+ * file. If none specified, ${java.home}/lib/xalan.properties
+ * will be used.
+ * @param fallbackClassName
+ * Implementation class name, if nothing else is found. Use null
+ * to mean no fallback.
+ *
+ * @exception ObjectFactory.ConfigurationError
+ */
+ static Class lookUpFactoryClass(String factoryId) throws ConfigurationError {
+ return lookUpFactoryClass(factoryId, null, null);
+ } // lookUpFactoryClass(String):Class
- /**
- * Finds the implementation Class object in the specified order. The
- * specified order is the following:
- * <ol>
- * <li>query the system property using <code>System.getProperty</code>
- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
- * <li>read <code>META-INF/services/<i>factoryId</i></code> file
- * <li>use fallback classname
- * </ol>
- *
- * @return Class object that provides factory service, never null
- *
- * @param factoryId Name of the factory to find, same as
- * a property name
- * @param propertiesFilename The filename in the $java.home/lib directory
- * of the properties file. If none specified,
- * ${java.home}/lib/xalan.properties will be used.
- * @param fallbackClassName Implementation class name, if nothing else
- * is found. Use null to mean no fallback.
- *
- * @exception ObjectFactory.ConfigurationError
- */
- static Class lookUpFactoryClass(String factoryId,
- String propertiesFilename,
- String fallbackClassName)
- throws ConfigurationError
- {
- String factoryClassName = lookUpFactoryClassName(factoryId,
- propertiesFilename,
- fallbackClassName);
- ClassLoader cl = findClassLoader();
+ /**
+ * Finds the implementation Class object in the specified order. The
+ * specified order is the following:
+ * <ol>
+ * <li>query the system property using <code>System.getProperty</code>
+ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+ * <li>read <code>META-INF/services/<i>factoryId</i></code> file
+ * <li>use fallback classname
+ * </ol>
+ *
+ * @return Class object that provides factory service, never null
+ *
+ * @param factoryId
+ * Name of the factory to find, same as a property name
+ * @param propertiesFilename
+ * The filename in the $java.home/lib directory of the properties
+ * file. If none specified, ${java.home}/lib/xalan.properties
+ * will be used.
+ * @param fallbackClassName
+ * Implementation class name, if nothing else is found. Use null
+ * to mean no fallback.
+ *
+ * @exception ObjectFactory.ConfigurationError
+ */
+ static Class lookUpFactoryClass(String factoryId,
+ String propertiesFilename, String fallbackClassName)
+ throws ConfigurationError {
+ String factoryClassName = lookUpFactoryClassName(factoryId,
+ propertiesFilename, fallbackClassName);
+ ClassLoader cl = findClassLoader();
- if (factoryClassName == null) {
- factoryClassName = fallbackClassName;
- }
+ if (factoryClassName == null) {
+ factoryClassName = fallbackClassName;
+ }
- // assert(className != null);
- try{
- Class providerClass = findProviderClass(factoryClassName,
- cl,
- true);
- debugPrintln("created new instance of " + providerClass +
- " using ClassLoader: " + cl);
- return providerClass;
- } catch (ClassNotFoundException x) {
- throw new ConfigurationError(
- "Provider " + factoryClassName + " not found", x);
- } catch (Exception x) {
- throw new ConfigurationError(
- "Provider "+factoryClassName+" could not be instantiated: "+x,
- x);
- }
- } // lookUpFactoryClass(String,String,String):Class
+ // assert(className != null);
+ try {
+ Class providerClass = findProviderClass(factoryClassName, cl, true);
+ debugPrintln("created new instance of " + providerClass
+ + " using ClassLoader: " + cl);
+ return providerClass;
+ } catch (ClassNotFoundException x) {
+ throw new ConfigurationError("Provider " + factoryClassName
+ + " not found", x);
+ } catch (Exception x) {
+ throw new ConfigurationError("Provider " + factoryClassName
+ + " could not be instantiated: " + x, x);
+ }
+ } // lookUpFactoryClass(String,String,String):Class
- /**
- * Finds the name of the required implementation class in the specified
- * order. The specified order is the following:
- * <ol>
- * <li>query the system property using <code>System.getProperty</code>
- * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
- * <li>read <code>META-INF/services/<i>factoryId</i></code> file
- * <li>use fallback classname
- * </ol>
- *
- * @return name of class that provides factory service, never null
- *
- * @param factoryId Name of the factory to find, same as
- * a property name
- * @param propertiesFilename The filename in the $java.home/lib directory
- * of the properties file. If none specified,
- * ${java.home}/lib/xalan.properties will be used.
- * @param fallbackClassName Implementation class name, if nothing else
- * is found. Use null to mean no fallback.
- *
- * @exception ObjectFactory.ConfigurationError
- */
- static String lookUpFactoryClassName(String factoryId,
- String propertiesFilename,
- String fallbackClassName)
- {
- SecuritySupport ss = SecuritySupport.getInstance();
+ /**
+ * Finds the name of the required implementation class in the specified
+ * order. The specified order is the following:
+ * <ol>
+ * <li>query the system property using <code>System.getProperty</code>
+ * <li>read <code>$java.home/lib/<i>propertiesFilename</i></code> file
+ * <li>read <code>META-INF/services/<i>factoryId</i></code> file
+ * <li>use fallback classname
+ * </ol>
+ *
+ * @return name of class that provides factory service, never null
+ *
+ * @param factoryId
+ * Name of the factory to find, same as a property name
+ * @param propertiesFilename
+ * The filename in the $java.home/lib directory of the properties
+ * file. If none specified, ${java.home}/lib/xalan.properties
+ * will be used.
+ * @param fallbackClassName
+ * Implementation class name, if nothing else is found. Use null
+ * to mean no fallback.
+ *
+ * @exception ObjectFactory.ConfigurationError
+ */
+ static String lookUpFactoryClassName(String factoryId,
+ String propertiesFilename, String fallbackClassName) {
+ SecuritySupport ss = SecuritySupport.getInstance();
- // Use the system property first
- try {
- String systemProp = ss.getSystemProperty(factoryId);
- if (systemProp != null) {
- debugPrintln("found system property, value=" + systemProp);
- return systemProp;
- }
- } catch (SecurityException se) {
- // Ignore and continue w/ next location
- }
+ // Use the system property first
+ try {
+ String systemProp = ss.getSystemProperty(factoryId);
+ if (systemProp != null) {
+ debugPrintln("found system property, value=" + systemProp);
+ return systemProp;
+ }
+ } catch (SecurityException se) {
+ // Ignore and continue w/ next location
+ }
- // Try to read from propertiesFilename, or
- // $java.home/lib/xalan.properties
- String factoryClassName = null;
- // no properties file name specified; use
- // $JAVA_HOME/lib/xalan.properties:
- if (propertiesFilename == null) {
- File propertiesFile = null;
- boolean propertiesFileExists = false;
- try {
- String javah = ss.getSystemProperty("java.home");
- propertiesFilename = javah + File.separator +
- "lib" + File.separator + DEFAULT_PROPERTIES_FILENAME;
- propertiesFile = new File(propertiesFilename);
- propertiesFileExists = ss.getFileExists(propertiesFile);
- } catch (SecurityException e) {
- // try again...
- fLastModified = -1;
- fXalanProperties = null;
- }
+ // Try to read from propertiesFilename, or
+ // $java.home/lib/xalan.properties
+ String factoryClassName = null;
+ // no properties file name specified; use
+ // $JAVA_HOME/lib/xalan.properties:
+ if (propertiesFilename == null) {
+ File propertiesFile = null;
+ boolean propertiesFileExists = false;
+ try {
+ String javah = ss.getSystemProperty("java.home");
+ propertiesFilename = javah + File.separator + "lib"
+ + File.separator + DEFAULT_PROPERTIES_FILENAME;
+ propertiesFile = new File(propertiesFilename);
+ propertiesFileExists = ss.getFileExists(propertiesFile);
+ } catch (SecurityException e) {
+ // try again...
+ fLastModified = -1;
+ fXalanProperties = null;
+ }
- synchronized (ObjectFactory.class) {
- boolean loadProperties = false;
- FileInputStream fis = null;
- try {
- // file existed last time
- if(fLastModified >= 0) {
- if(propertiesFileExists &&
- (fLastModified < (fLastModified = ss.getLastModified(propertiesFile)))) {
- loadProperties = true;
- } else {
- // file has stopped existing...
- if(!propertiesFileExists) {
- fLastModified = -1;
- fXalanProperties = null;
- } // else, file wasn't modified!
- }
- } else {
- // file has started to exist:
- if(propertiesFileExists) {
- loadProperties = true;
- fLastModified = ss.getLastModified(propertiesFile);
- } // else, nothing's changed
- }
- if(loadProperties) {
- // must never have attempted to read xalan.properties
- // before (or it's outdeated)
- fXalanProperties = new Properties();
- fis = ss.getFileInputStream(propertiesFile);
- fXalanProperties.load(fis);
- }
- } catch (Exception x) {
- fXalanProperties = null;
- fLastModified = -1;
- // assert(x instanceof FileNotFoundException
- // || x instanceof SecurityException)
- // In both cases, ignore and continue w/ next location
- }
- finally {
- // try to close the input stream if one was opened.
- if (fis != null) {
- try {
- fis.close();
- }
- // Ignore the exception.
- catch (IOException exc) {}
- }
- }
- }
- if(fXalanProperties != null) {
- factoryClassName = fXalanProperties.getProperty(factoryId);
- }
- } else {
- FileInputStream fis = null;
- try {
- fis = ss.getFileInputStream(new File(propertiesFilename));
- Properties props = new Properties();
- props.load(fis);
- factoryClassName = props.getProperty(factoryId);
- } catch (Exception x) {
- // assert(x instanceof FileNotFoundException
- // || x instanceof SecurityException)
- // In both cases, ignore and continue w/ next location
- }
- finally {
- // try to close the input stream if one was opened.
- if (fis != null) {
- try {
- fis.close();
- }
- // Ignore the exception.
- catch (IOException exc) {}
- }
- }
- }
- if (factoryClassName != null) {
- debugPrintln("found in " + propertiesFilename + ", value="
- + factoryClassName);
- return factoryClassName;
- }
+ synchronized (ObjectFactory.class) {
+ boolean loadProperties = false;
+ FileInputStream fis = null;
+ try {
+ // file existed last time
+ if (fLastModified >= 0) {
+ if (propertiesFileExists
+ && (fLastModified < (fLastModified = ss
+ .getLastModified(propertiesFile)))) {
+ loadProperties = true;
+ } else {
+ // file has stopped existing...
+ if (!propertiesFileExists) {
+ fLastModified = -1;
+ fXalanProperties = null;
+ } // else, file wasn't modified!
+ }
+ } else {
+ // file has started to exist:
+ if (propertiesFileExists) {
+ loadProperties = true;
+ fLastModified = ss.getLastModified(propertiesFile);
+ } // else, nothing's changed
+ }
+ if (loadProperties) {
+ // must never have attempted to read xalan.properties
+ // before (or it's outdeated)
+ fXalanProperties = new Properties();
+ fis = ss.getFileInputStream(propertiesFile);
+ fXalanProperties.load(fis);
+ }
+ } catch (Exception x) {
+ fXalanProperties = null;
+ fLastModified = -1;
+ // assert(x instanceof FileNotFoundException
+ // || x instanceof SecurityException)
+ // In both cases, ignore and continue w/ next location
+ } finally {
+ // try to close the input stream if one was opened.
+ if (fis != null) {
+ try {
+ fis.close();
+ }
+ // Ignore the exception.
+ catch (IOException exc) {
+ }
+ }
+ }
+ }
+ if (fXalanProperties != null) {
+ factoryClassName = fXalanProperties.getProperty(factoryId);
+ }
+ } else {
+ FileInputStream fis = null;
+ try {
+ fis = ss.getFileInputStream(new File(propertiesFilename));
+ Properties props = new Properties();
+ props.load(fis);
+ factoryClassName = props.getProperty(factoryId);
+ } catch (Exception x) {
+ // assert(x instanceof FileNotFoundException
+ // || x instanceof SecurityException)
+ // In both cases, ignore and continue w/ next location
+ } finally {
+ // try to close the input stream if one was opened.
+ if (fis != null) {
+ try {
+ fis.close();
+ }
+ // Ignore the exception.
+ catch (IOException exc) {
+ }
+ }
+ }
+ }
+ if (factoryClassName != null) {
+ debugPrintln("found in " + propertiesFilename + ", value="
+ + factoryClassName);
+ return factoryClassName;
+ }
- // Try Jar Service Provider Mechanism
- return findJarServiceProviderName(factoryId);
- } // lookUpFactoryClass(String,String):String
+ // Try Jar Service Provider Mechanism
+ return findJarServiceProviderName(factoryId);
+ } // lookUpFactoryClass(String,String):String
- //
- // Private static methods
- //
+ //
+ // Private static methods
+ //
- /** Prints a message to standard error if debugging is enabled. */
- private static void debugPrintln(String msg) {
- if (DEBUG) {
- System.err.println("JAXP: " + msg);
- }
- } // debugPrintln(String)
+ /** Prints a message to standard error if debugging is enabled. */
+ private static void debugPrintln(String msg) {
+ if (DEBUG) {
+ System.err.println("JAXP: " + msg);
+ }
+ } // debugPrintln(String)
- /**
- * Figure out which ClassLoader to use. For JDK 1.2 and later use
- * the context ClassLoader.
- */
- static ClassLoader findClassLoader()
- throws ConfigurationError
- {
- SecuritySupport ss = SecuritySupport.getInstance();
+ /**
+ * Figure out which ClassLoader to use. For JDK 1.2 and later use the
+ * context ClassLoader.
+ */
+ static ClassLoader findClassLoader() throws ConfigurationError {
+ SecuritySupport ss = SecuritySupport.getInstance();
- // Figure out which ClassLoader to use for loading the provider
- // class. If there is a Context ClassLoader then use it.
- ClassLoader context = ss.getContextClassLoader();
- ClassLoader system = ss.getSystemClassLoader();
+ // Figure out which ClassLoader to use for loading the provider
+ // class. If there is a Context ClassLoader then use it.
+ ClassLoader context = ss.getContextClassLoader();
+ ClassLoader system = ss.getSystemClassLoader();
- ClassLoader chain = system;
- while (true) {
- if (context == chain) {
- // Assert: we are on JDK 1.1 or we have no Context ClassLoader
- // or any Context ClassLoader in chain of system classloader
- // (including extension ClassLoader) so extend to widest
- // ClassLoader (always look in system ClassLoader if Xalan
- // is in boot/extension/system classpath and in current
- // ClassLoader otherwise); normal classloaders delegate
- // back to system ClassLoader first so this widening doesn't
- // change the fact that context ClassLoader will be consulted
- ClassLoader current = ObjectFactory.class.getClassLoader();
+ ClassLoader chain = system;
+ while (true) {
+ if (context == chain) {
+ // Assert: we are on JDK 1.1 or we have no Context ClassLoader
+ // or any Context ClassLoader in chain of system classloader
+ // (including extension ClassLoader) so extend to widest
+ // ClassLoader (always look in system ClassLoader if Xalan
+ // is in boot/extension/system classpath and in current
+ // ClassLoader otherwise); normal classloaders delegate
+ // back to system ClassLoader first so this widening doesn't
+ // change the fact that context ClassLoader will be consulted
+ ClassLoader current = ObjectFactory.class.getClassLoader();
- chain = system;
- while (true) {
- if (current == chain) {
- // Assert: Current ClassLoader in chain of
- // boot/extension/system ClassLoaders
- return system;
- }
- if (chain == null) {
- break;
- }
- chain = ss.getParentClassLoader(chain);
- }
+ chain = system;
+ while (true) {
+ if (current == chain) {
+ // Assert: Current ClassLoader in chain of
+ // boot/extension/system ClassLoaders
+ return system;
+ }
+ if (chain == null) {
+ break;
+ }
+ chain = ss.getParentClassLoader(chain);
+ }
- // Assert: Current ClassLoader not in chain of
- // boot/extension/system ClassLoaders
- return current;
- }
+ // Assert: Current ClassLoader not in chain of
+ // boot/extension/system ClassLoaders
+ return current;
+ }
- if (chain == null) {
- // boot ClassLoader reached
- break;
- }
+ if (chain == null) {
+ // boot ClassLoader reached
+ break;
+ }
- // Check for any extension ClassLoaders in chain up to
- // boot ClassLoader
- chain = ss.getParentClassLoader(chain);
- };
+ // Check for any extension ClassLoaders in chain up to
+ // boot ClassLoader
+ chain = ss.getParentClassLoader(chain);
+ }
+ ;
- // Assert: Context ClassLoader not in chain of
- // boot/extension/system ClassLoaders
- return context;
- } // findClassLoader():ClassLoader
+ // Assert: Context ClassLoader not in chain of
+ // boot/extension/system ClassLoaders
+ return context;
+ } // findClassLoader():ClassLoader
- /**
- * Create an instance of a class using the specified ClassLoader
- */
- static Object newInstance(String className, ClassLoader cl,
- boolean doFallback)
- throws ConfigurationError
- {
- // assert(className != null);
- try{
- Class providerClass = findProviderClass(className, cl, doFallback);
- Object instance = providerClass.newInstance();
- debugPrintln("created new instance of " + providerClass +
- " using ClassLoader: " + cl);
- return instance;
- } catch (ClassNotFoundException x) {
- throw new ConfigurationError(
- "Provider " + className + " not found", x);
- } catch (Exception x) {
- throw new ConfigurationError(
- "Provider " + className + " could not be instantiated: " + x,
- x);
- }
- }
+ /**
+ * Create an instance of a class using the specified ClassLoader
+ */
+ static Object newInstance(String className, ClassLoader cl,
+ boolean doFallback) throws ConfigurationError {
+ // assert(className != null);
+ try {
+ Class providerClass = findProviderClass(className, cl, doFallback);
+ Object instance = providerClass.newInstance();
+ debugPrintln("created new instance of " + providerClass
+ + " using ClassLoader: " + cl);
+ return instance;
+ } catch (ClassNotFoundException x) {
+ throw new ConfigurationError(
+ "Provider " + className + " not found", x);
+ } catch (Exception x) {
+ throw new ConfigurationError("Provider " + className
+ + " could not be instantiated: " + x, x);
+ }
+ }
- /**
- * Find a Class using the specified ClassLoader
- */
- static Class findProviderClass(String className, ClassLoader cl,
- boolean doFallback)
- throws ClassNotFoundException, ConfigurationError
- {
- //throw security exception if the calling thread is not allowed to access the
- //class. Restrict the access to the package classes as specified in java.security policy.
- SecurityManager security = System.getSecurityManager();
- try{
- if (security != null){
- final int lastDot = className.lastIndexOf(".");
- String packageName = className;
- if (lastDot != -1) packageName = className.substring(0, lastDot);
- security.checkPackageAccess(packageName);
- }
- }catch(SecurityException e){
- throw e;
- }
-
- Class providerClass;
- if (cl == null) {
- // XXX Use the bootstrap ClassLoader. There is no way to
- // load a class using the bootstrap ClassLoader that works
- // in both JDK 1.1 and Java 2. However, this should still
- // work b/c the following should be true:
- //
- // (cl == null) iff current ClassLoader == null
- //
- // Thus Class.forName(String) will use the current
- // ClassLoader which will be the bootstrap ClassLoader.
- providerClass = Class.forName(className);
- } else {
- try {
- providerClass = cl.loadClass(className);
- } catch (ClassNotFoundException x) {
- if (doFallback) {
- // Fall back to current classloader
- ClassLoader current = ObjectFactory.class.getClassLoader();
- if (current == null) {
- providerClass = Class.forName(className);
- } else if (cl != current) {
- cl = current;
- providerClass = cl.loadClass(className);
- } else {
- throw x;
- }
- } else {
- throw x;
- }
- }
- }
+ /**
+ * Find a Class using the specified ClassLoader
+ */
+ static Class findProviderClass(String className, ClassLoader cl,
+ boolean doFallback) throws ClassNotFoundException,
+ ConfigurationError {
+ // throw security exception if the calling thread is not allowed to
+ // access the
+ // class. Restrict the access to the package classes as specified in
+ // java.security policy.
+ SecurityManager security = System.getSecurityManager();
+ try {
+ if (security != null) {
+ final int lastDot = className.lastIndexOf(".");
+ String packageName = className;
+ if (lastDot != -1)
+ packageName = className.substring(0, lastDot);
+ security.checkPackageAccess(packageName);
+ }
+ } catch (SecurityException e) {
+ throw e;
+ }
- return providerClass;
- }
+ Class providerClass;
+ if (cl == null) {
+ // XXX Use the bootstrap ClassLoader. There is no way to
+ // load a class using the bootstrap ClassLoader that works
+ // in both JDK 1.1 and Java 2. However, this should still
+ // work b/c the following should be true:
+ //
+ // (cl == null) iff current ClassLoader == null
+ //
+ // Thus Class.forName(String) will use the current
+ // ClassLoader which will be the bootstrap ClassLoader.
+ providerClass = Class.forName(className);
+ } else {
+ try {
+ providerClass = cl.loadClass(className);
+ } catch (ClassNotFoundException x) {
+ if (doFallback) {
+ // Fall back to current classloader
+ ClassLoader current = ObjectFactory.class.getClassLoader();
+ if (current == null) {
+ providerClass = Class.forName(className);
+ } else if (cl != current) {
+ cl = current;
+ providerClass = cl.loadClass(className);
+ } else {
+ throw x;
+ }
+ } else {
+ throw x;
+ }
+ }
+ }
- /**
- * Find the name of service provider using Jar Service Provider Mechanism
- *
- * @return instance of provider class if found or null
- */
- private static String findJarServiceProviderName(String factoryId)
- {
- SecuritySupport ss = SecuritySupport.getInstance();
- String serviceId = SERVICES_PATH + factoryId;
- InputStream is = null;
+ return providerClass;
+ }
- // First try the Context ClassLoader
- ClassLoader cl = findClassLoader();
+ /**
+ * Find the name of service provider using Jar Service Provider Mechanism
+ *
+ * @return instance of provider class if found or null
+ */
+ private static String findJarServiceProviderName(String factoryId) {
+ SecuritySupport ss = SecuritySupport.getInstance();
+ String serviceId = SERVICES_PATH + factoryId;
+ InputStream is = null;
- is = ss.getResourceAsStream(cl, serviceId);
+ // First try the Context ClassLoader
+ ClassLoader cl = findClassLoader();
- // If no provider found then try the current ClassLoader
- if (is == null) {
- ClassLoader current = ObjectFactory.class.getClassLoader();
- if (cl != current) {
- cl = current;
- is = ss.getResourceAsStream(cl, serviceId);
- }
- }
+ is = ss.getResourceAsStream(cl, serviceId);
- if (is == null) {
- // No provider found
- return null;
- }
+ // If no provider found then try the current ClassLoader
+ if (is == null) {
+ ClassLoader current = ObjectFactory.class.getClassLoader();
+ if (cl != current) {
+ cl = current;
+ is = ss.getResourceAsStream(cl, serviceId);
+ }
+ }
- debugPrintln("found jar resource=" + serviceId +
- " using ClassLoader: " + cl);
+ if (is == null) {
+ // No provider found
+ return null;
+ }
- // Read the service provider name in UTF-8 as specified in
- // the jar spec. Unfortunately this fails in Microsoft
- // VJ++, which does not implement the UTF-8
- // encoding. Theoretically, we should simply let it fail in
- // that case, since the JVM is obviously broken if it
- // doesn't support such a basic standard. But since there
- // are still some users attempting to use VJ++ for
- // development, we have dropped in a fallback which makes a
- // second attempt using the platform's default encoding. In
- // VJ++ this is apparently ASCII, which is a subset of
- // UTF-8... and since the strings we'll be reading here are
- // also primarily limited to the 7-bit ASCII range (at
- // least, in English versions), this should work well
- // enough to keep us on the air until we're ready to
- // officially decommit from VJ++. [Edited comment from
- // jkesselm]
- BufferedReader rd;
- try {
- rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
- } catch (java.io.UnsupportedEncodingException e) {
- rd = new BufferedReader(new InputStreamReader(is));
- }
-
- String factoryClassName = null;
- try {
- // XXX Does not handle all possible input as specified by the
- // Jar Service Provider specification
- factoryClassName = rd.readLine();
- } catch (IOException x) {
- // No provider found
- return null;
- }
- finally {
- try {
- // try to close the reader.
- rd.close();
- }
- // Ignore the exception.
- catch (IOException exc) {}
- }
+ debugPrintln("found jar resource=" + serviceId + " using ClassLoader: "
+ + cl);
- if (factoryClassName != null &&
- ! "".equals(factoryClassName)) {
- debugPrintln("found in resource, value="
- + factoryClassName);
+ // Read the service provider name in UTF-8 as specified in
+ // the jar spec. Unfortunately this fails in Microsoft
+ // VJ++, which does not implement the UTF-8
+ // encoding. Theoretically, we should simply let it fail in
+ // that case, since the JVM is obviously broken if it
+ // doesn't support such a basic standard. But since there
+ // are still some users attempting to use VJ++ for
+ // development, we have dropped in a fallback which makes a
+ // second attempt using the platform's default encoding. In
+ // VJ++ this is apparently ASCII, which is a subset of
+ // UTF-8... and since the strings we'll be reading here are
+ // also primarily limited to the 7-bit ASCII range (at
+ // least, in English versions), this should work well
+ // enough to keep us on the air until we're ready to
+ // officially decommit from VJ++. [Edited comment from
+ // jkesselm]
+ BufferedReader rd;
+ try {
+ rd = new BufferedReader(new InputStreamReader(is, "UTF-8"));
+ } catch (java.io.UnsupportedEncodingException e) {
+ rd = new BufferedReader(new InputStreamReader(is));
+ }
- // Note: here we do not want to fall back to the current
- // ClassLoader because we want to avoid the case where the
- // resource file was found using one ClassLoader and the
- // provider class was instantiated using a different one.
- return factoryClassName;
- }
+ String factoryClassName = null;
+ try {
+ // XXX Does not handle all possible input as specified by the
+ // Jar Service Provider specification
+ factoryClassName = rd.readLine();
+ } catch (IOException x) {
+ // No provider found
+ return null;
+ } finally {
+ try {
+ // try to close the reader.
+ rd.close();
+ }
+ // Ignore the exception.
+ catch (IOException exc) {
+ }
+ }
- // No provider found
- return null;
- }
+ if (factoryClassName != null && !"".equals(factoryClassName)) {
+ debugPrintln("found in resource, value=" + factoryClassName);
- //
- // Classes
- //
+ // Note: here we do not want to fall back to the current
+ // ClassLoader because we want to avoid the case where the
+ // resource file was found using one ClassLoader and the
+ // provider class was instantiated using a different one.
+ return factoryClassName;
+ }
- /**
- * A configuration error.
- */
- static class ConfigurationError
- extends Error {
- static final long serialVersionUID = 8564305128443551853L;
- //
- // Data
- //
+ // No provider found
+ return null;
+ }
- /** Exception. */
- private Exception exception;
+ //
+ // Classes
+ //
- //
- // Constructors
- //
+ /**
+ * A configuration error.
+ */
+ static class ConfigurationError extends Error {
+ static final long serialVersionUID = 8564305128443551853L;
+ //
+ // Data
+ //
- /**
- * Construct a new instance with the specified detail string and
- * exception.
- */
- ConfigurationError(String msg, Exception x) {
- super(msg);
- this.exception = x;
- } // <init>(String,Exception)
+ /** Exception. */
+ private Exception exception;
- //
- // Public methods
- //
+ //
+ // Constructors
+ //
- /** Returns the exception associated to this error. */
- Exception getException() {
- return exception;
- } // getException():Exception
+ /**
+ * Construct a new instance with the specified detail string and
+ * exception.
+ */
+ ConfigurationError(String msg, Exception x) {
+ super(msg);
+ this.exception = x;
+ } // <init>(String,Exception)
- } // class ConfigurationError
+ //
+ // Public methods
+ //
+
+ /** Returns the exception associated to this error. */
+ Exception getException() {
+ return exception;
+ } // getException():Exception
+
+ } // class ConfigurationError
} // class ObjectFactory
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport.java
index 0ec7b41..ded772f 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: SecuritySupport.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: SecuritySupport.java,v 1.3 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -35,98 +35,95 @@
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
+
/**
* This class is duplicated for each Xalan-Java subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the Xalan-Java
* API.
- *
+ *
* Base class with security related methods that work on JDK 1.1.
*/
class SecuritySupport {
- /*
- * Make this of type Object so that the verifier won't try to
- * prove its type, thus possibly trying to load the SecuritySupport12
- * class.
- */
- private static final Object securitySupport;
+ /*
+ * Make this of type Object so that the verifier won't try to prove its
+ * type, thus possibly trying to load the SecuritySupport12 class.
+ */
+ private static final Object securitySupport;
- static {
- SecuritySupport ss = null;
- try {
- Class c = Class.forName("java.security.AccessController");
- // if that worked, we're on 1.2.
- /*
- // don't reference the class explicitly so it doesn't
- // get dragged in accidentally.
- c = Class.forName("javax.mail.SecuritySupport12");
- Constructor cons = c.getConstructor(new Class[] { });
- ss = (SecuritySupport)cons.newInstance(new Object[] { });
- */
- /*
- * Unfortunately, we can't load the class using reflection
- * because the class is package private. And the class has
- * to be package private so the APIs aren't exposed to other
- * code that could use them to circumvent security. Thus,
- * we accept the risk that the direct reference might fail
- * on some JDK 1.1 JVMs, even though we would never execute
- * this code in such a case. Sigh...
- */
- ss = new SecuritySupport12();
- } catch (Exception ex) {
- // ignore it
- } finally {
- if (ss == null)
- ss = new SecuritySupport();
- securitySupport = ss;
+ static {
+ SecuritySupport ss = null;
+ try {
+ Class c = Class.forName("java.security.AccessController");
+ // if that worked, we're on 1.2.
+ /*
+ * // don't reference the class explicitly so it doesn't // get
+ * dragged in accidentally. c =
+ * Class.forName("javax.mail.SecuritySupport12"); Constructor cons =
+ * c.getConstructor(new Class[] { }); ss =
+ * (SecuritySupport)cons.newInstance(new Object[] { });
+ */
+ /*
+ * Unfortunately, we can't load the class using reflection because
+ * the class is package private. And the class has to be package
+ * private so the APIs aren't exposed to other code that could use
+ * them to circumvent security. Thus, we accept the risk that the
+ * direct reference might fail on some JDK 1.1 JVMs, even though we
+ * would never execute this code in such a case. Sigh...
+ */
+ ss = new SecuritySupport12();
+ } catch (Exception ex) {
+ // ignore it
+ } finally {
+ if (ss == null)
+ ss = new SecuritySupport();
+ securitySupport = ss;
+ }
}
- }
- /**
- * Return an appropriate instance of this class, depending on whether
- * we're on a JDK 1.1 or J2SE 1.2 (or later) system.
- */
- static SecuritySupport getInstance() {
- return (SecuritySupport)securitySupport;
- }
+ /**
+ * Return an appropriate instance of this class, depending on whether we're
+ * on a JDK 1.1 or J2SE 1.2 (or later) system.
+ */
+ static SecuritySupport getInstance() {
+ return (SecuritySupport) securitySupport;
+ }
- ClassLoader getContextClassLoader() {
- return null;
- }
+ ClassLoader getContextClassLoader() {
+ return null;
+ }
- ClassLoader getSystemClassLoader() {
- return null;
- }
+ ClassLoader getSystemClassLoader() {
+ return null;
+ }
- ClassLoader getParentClassLoader(ClassLoader cl) {
- return null;
- }
+ ClassLoader getParentClassLoader(ClassLoader cl) {
+ return null;
+ }
- String getSystemProperty(String propName) {
- return System.getProperty(propName);
- }
+ String getSystemProperty(String propName) {
+ return System.getProperty(propName);
+ }
- FileInputStream getFileInputStream(File file)
- throws FileNotFoundException
- {
- return new FileInputStream(file);
- }
+ FileInputStream getFileInputStream(File file) throws FileNotFoundException {
+ return new FileInputStream(file);
+ }
- InputStream getResourceAsStream(ClassLoader cl, String name) {
- InputStream ris;
- if (cl == null) {
- ris = ClassLoader.getSystemResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
-
- boolean getFileExists(File f) {
- return f.exists();
- }
-
- long getLastModified(File f) {
- return f.lastModified();
- }
+ InputStream getResourceAsStream(ClassLoader cl, String name) {
+ InputStream ris;
+ if (cl == null) {
+ ris = ClassLoader.getSystemResourceAsStream(name);
+ } else {
+ ris = cl.getResourceAsStream(name);
+ }
+ return ris;
+ }
+
+ boolean getFileExists(File f) {
+ return f.exists();
+ }
+
+ long getLastModified(File f) {
+ return f.lastModified();
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport12.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport12.java
index 404e0b9..2703f20 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport12.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/SecuritySupport12.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: SecuritySupport12.java,v 1.2 2008/03/27 22:45:10 dacarver Exp $
+ * $Id: SecuritySupport12.java,v 1.3 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -41,115 +41,119 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
-
/**
* This class is duplicated for each Xalan-Java subpackage so keep it in sync.
* It is package private and therefore is not exposed as part of the Xalan-Java
* API.
- *
+ *
* Security related methods that only work on J2SE 1.2 and newer.
*/
class SecuritySupport12 extends SecuritySupport {
- ClassLoader getContextClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = Thread.currentThread().getContextClassLoader();
- } catch (SecurityException ex) { }
- return cl;
- }
- });
- }
+ @Override
+ ClassLoader getContextClassLoader() {
+ return (ClassLoader) AccessController
+ .doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = Thread.currentThread().getContextClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
- ClassLoader getSystemClassLoader() {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader cl = null;
- try {
- cl = ClassLoader.getSystemClassLoader();
- } catch (SecurityException ex) {}
- return cl;
- }
- });
- }
+ @Override
+ ClassLoader getSystemClassLoader() {
+ return (ClassLoader) AccessController
+ .doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader cl = null;
+ try {
+ cl = ClassLoader.getSystemClassLoader();
+ } catch (SecurityException ex) {
+ }
+ return cl;
+ }
+ });
+ }
- ClassLoader getParentClassLoader(final ClassLoader cl) {
- return (ClassLoader)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- ClassLoader parent = null;
- try {
- parent = cl.getParent();
- } catch (SecurityException ex) {}
+ @Override
+ ClassLoader getParentClassLoader(final ClassLoader cl) {
+ return (ClassLoader) AccessController
+ .doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ ClassLoader parent = null;
+ try {
+ parent = cl.getParent();
+ } catch (SecurityException ex) {
+ }
- // eliminate loops in case of the boot
- // ClassLoader returning itself as a parent
- return (parent == cl) ? null : parent;
- }
- });
- }
+ // eliminate loops in case of the boot
+ // ClassLoader returning itself as a parent
+ return (parent == cl) ? null : parent;
+ }
+ });
+ }
- String getSystemProperty(final String propName) {
- return (String)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return System.getProperty(propName);
- }
- });
- }
+ @Override
+ String getSystemProperty(final String propName) {
+ return (String) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return System.getProperty(propName);
+ }
+ });
+ }
- FileInputStream getFileInputStream(final File file)
- throws FileNotFoundException
- {
- try {
- return (FileInputStream)
- AccessController.doPrivileged(new PrivilegedExceptionAction() {
- public Object run() throws FileNotFoundException {
- return new FileInputStream(file);
- }
- });
- } catch (PrivilegedActionException e) {
- throw (FileNotFoundException)e.getException();
- }
- }
+ @Override
+ FileInputStream getFileInputStream(final File file)
+ throws FileNotFoundException {
+ try {
+ return (FileInputStream) AccessController
+ .doPrivileged(new PrivilegedExceptionAction() {
+ public Object run() throws FileNotFoundException {
+ return new FileInputStream(file);
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw (FileNotFoundException) e.getException();
+ }
+ }
- InputStream getResourceAsStream(final ClassLoader cl,
- final String name)
- {
- return (InputStream)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- InputStream ris;
- if (cl == null) {
- ris = ClassLoader.getSystemResourceAsStream(name);
- } else {
- ris = cl.getResourceAsStream(name);
- }
- return ris;
- }
- });
- }
-
- boolean getFileExists(final File f) {
- return ((Boolean)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return new Boolean(f.exists());
- }
- })).booleanValue();
- }
-
- long getLastModified(final File f) {
- return ((Long)
- AccessController.doPrivileged(new PrivilegedAction() {
- public Object run() {
- return new Long(f.lastModified());
- }
- })).longValue();
- }
-
+ @Override
+ InputStream getResourceAsStream(final ClassLoader cl, final String name) {
+ return (InputStream) AccessController
+ .doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ InputStream ris;
+ if (cl == null) {
+ ris = ClassLoader.getSystemResourceAsStream(name);
+ } else {
+ ris = cl.getResourceAsStream(name);
+ }
+ return ris;
+ }
+ });
+ }
+
+ @Override
+ boolean getFileExists(final File f) {
+ return ((Boolean) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return new Boolean(f.exists());
+ }
+ })).booleanValue();
+ }
+
+ @Override
+ long getLastModified(final File f) {
+ return ((Long) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return new Long(f.lastModified());
+ }
+ })).longValue();
+ }
+
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionImpl.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionImpl.java
index 6a782cb..e1af3fb 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionImpl.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionImpl.java
@@ -36,57 +36,49 @@
import javax.xml.xpath.XPathFunctionException;
/**
- * A sample implementation of XPathFunction, with support for
- * EXSLT extension functions and Java extension functions.
+ * A sample implementation of XPathFunction, with support for EXSLT extension
+ * functions and Java extension functions.
*/
-public class XPathFunctionImpl implements XPathFunction
-{
- private ExtensionHandler m_handler;
- private String m_funcName;
-
- /**
- * Construct an instance of XPathFunctionImpl from the
- * ExtensionHandler and function name.
- */
- public XPathFunctionImpl(ExtensionHandler handler, String funcName)
- {
- m_handler = handler;
- m_funcName = funcName;
- }
-
- /**
- * @see javax.xml.xpath.XPathFunction#evaluate(java.util.List)
- */
- public Object evaluate(List args)
- throws XPathFunctionException
- {
- Vector argsVec = listToVector(args);
-
- try {
- // The method key and ExpressionContext are set to null.
- return m_handler.callFunction(m_funcName, argsVec, null, null);
- }
- catch (TransformerException e)
- {
- throw new XPathFunctionException(e);
- }
- }
-
- /**
- * Convert a java.util.List to a java.util.Vector.
- * No conversion is done if the List is already a Vector.
- */
- private static Vector listToVector(List args)
- {
- if (args == null)
- return null;
- else if (args instanceof Vector)
- return (Vector)args;
- else
- {
- Vector result = new Vector();
- result.addAll(args);
- return result;
- }
- }
+public class XPathFunctionImpl implements XPathFunction {
+ private ExtensionHandler m_handler;
+ private String m_funcName;
+
+ /**
+ * Construct an instance of XPathFunctionImpl from the ExtensionHandler and
+ * function name.
+ */
+ public XPathFunctionImpl(ExtensionHandler handler, String funcName) {
+ m_handler = handler;
+ m_funcName = funcName;
+ }
+
+ /**
+ * @see javax.xml.xpath.XPathFunction#evaluate(java.util.List)
+ */
+ public Object evaluate(List args) throws XPathFunctionException {
+ Vector argsVec = listToVector(args);
+
+ try {
+ // The method key and ExpressionContext are set to null.
+ return m_handler.callFunction(m_funcName, argsVec, null, null);
+ } catch (TransformerException e) {
+ throw new XPathFunctionException(e);
+ }
+ }
+
+ /**
+ * Convert a java.util.List to a java.util.Vector. No conversion is done if
+ * the List is already a Vector.
+ */
+ private static Vector listToVector(List args) {
+ if (args == null)
+ return null;
+ else if (args instanceof Vector)
+ return (Vector) args;
+ else {
+ Vector result = new Vector();
+ result.addAll(args);
+ return result;
+ }
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionResolverImpl.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionResolverImpl.java
index 9587d11..98bb6e4 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionResolverImpl.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XPathFunctionResolverImpl.java
@@ -35,94 +35,82 @@
import org.eclipse.wst.xsl.core.compiler.xslt10.res.XSLTErrorResources;
/**
- * A sample implementation of XPathFunctionResolver, with support for
- * EXSLT extension functions and Java extension functions.
+ * A sample implementation of XPathFunctionResolver, with support for EXSLT
+ * extension functions and Java extension functions.
*/
-public class XPathFunctionResolverImpl implements XPathFunctionResolver
-{
- /**
- * Resolve an extension function from the qualified name and arity.
- */
- public XPathFunction resolveFunction(QName qname, int arity)
- {
- if (qname == null)
- throw new NullPointerException(
- Messages.createMessage(
- XSLTErrorResources.ER_XPATH_RESOLVER_NULL_QNAME, null));
-
- if (arity < 0)
- throw new IllegalArgumentException(
- Messages.createMessage(
- XSLTErrorResources.ER_XPATH_RESOLVER_NEGATIVE_ARITY, null));
-
- String uri = qname.getNamespaceURI();
- if (uri == null || uri.length() == 0)
- return null;
-
- String className = null;
- String methodName = null;
- if (uri.startsWith("http://exslt.org"))
- {
- className = getEXSLTClassName(uri);
- methodName = qname.getLocalPart();
- }
- else if (!uri.equals(ExtensionNamespaceContext.JAVA_EXT_URI))
- {
- int lastSlash = className.lastIndexOf("/");
- if (-1 != lastSlash)
- className = className.substring(lastSlash + 1);
- }
-
- String localPart = qname.getLocalPart();
- int lastDotIndex = localPart.lastIndexOf('.');
- if (lastDotIndex > 0)
- {
- if (className != null)
- className = className + "." + localPart.substring(0, lastDotIndex);
- else
- className = localPart.substring(0, lastDotIndex);
-
- methodName = localPart.substring(lastDotIndex + 1);
- }
- else
- methodName = localPart;
-
- if(null == className || className.trim().length() == 0
- || null == methodName || methodName.trim().length() == 0)
- return null;
-
- ExtensionHandler handler = null;
- try
- {
- ExtensionHandler.getClassForName(className);
- handler = new ExtensionHandlerJavaClass(uri, "javaclass", className);
- }
- catch (ClassNotFoundException e)
- {
- return null;
- }
- return new XPathFunctionImpl(handler, methodName);
- }
-
- /**
- * Return the implementation class name of an EXSLT extension from
- * a given namespace uri. The uri must starts with "http://exslt.org".
- */
- private String getEXSLTClassName(String uri)
- {
- if (uri.equals(ExtensionNamespaceContext.EXSLT_MATH_URI))
- return "org.apache.xalan.lib.ExsltMath";
- else if (uri.equals(ExtensionNamespaceContext.EXSLT_SET_URI))
- return "org.apache.xalan.lib.ExsltSets";
- else if (uri.equals(ExtensionNamespaceContext.EXSLT_STRING_URI))
- return "org.apache.xalan.lib.ExsltStrings";
- else if (uri.equals(ExtensionNamespaceContext.EXSLT_DATETIME_URI))
- return "org.apache.xalan.lib.ExsltDatetime";
- else if (uri.equals(ExtensionNamespaceContext.EXSLT_DYNAMIC_URI))
- return "org.apache.xalan.lib.ExsltDynamic";
- else if (uri.equals(ExtensionNamespaceContext.EXSLT_URI))
- return "org.apache.xalan.lib.ExsltCommon";
- else
- return null;
- }
+public class XPathFunctionResolverImpl implements XPathFunctionResolver {
+ /**
+ * Resolve an extension function from the qualified name and arity.
+ */
+ public XPathFunction resolveFunction(QName qname, int arity) {
+ if (qname == null)
+ throw new NullPointerException(Messages.createMessage(
+ XSLTErrorResources.ER_XPATH_RESOLVER_NULL_QNAME, null));
+
+ if (arity < 0)
+ throw new IllegalArgumentException(Messages.createMessage(
+ XSLTErrorResources.ER_XPATH_RESOLVER_NEGATIVE_ARITY, null));
+
+ String uri = qname.getNamespaceURI();
+ if (uri == null || uri.length() == 0)
+ return null;
+
+ String className = null;
+ String methodName = null;
+ if (uri.startsWith("http://exslt.org")) {
+ className = getEXSLTClassName(uri);
+ methodName = qname.getLocalPart();
+ } else if (!uri.equals(ExtensionNamespaceContext.JAVA_EXT_URI)) {
+ int lastSlash = className.lastIndexOf("/");
+ if (-1 != lastSlash)
+ className = className.substring(lastSlash + 1);
+ }
+
+ String localPart = qname.getLocalPart();
+ int lastDotIndex = localPart.lastIndexOf('.');
+ if (lastDotIndex > 0) {
+ if (className != null)
+ className = className + "."
+ + localPart.substring(0, lastDotIndex);
+ else
+ className = localPart.substring(0, lastDotIndex);
+
+ methodName = localPart.substring(lastDotIndex + 1);
+ } else
+ methodName = localPart;
+
+ if (null == className || className.trim().length() == 0
+ || null == methodName || methodName.trim().length() == 0)
+ return null;
+
+ ExtensionHandler handler = null;
+ try {
+ ExtensionHandler.getClassForName(className);
+ handler = new ExtensionHandlerJavaClass(uri, "javaclass", className);
+ } catch (ClassNotFoundException e) {
+ return null;
+ }
+ return new XPathFunctionImpl(handler, methodName);
+ }
+
+ /**
+ * Return the implementation class name of an EXSLT extension from a given
+ * namespace uri. The uri must starts with "http://exslt.org".
+ */
+ private String getEXSLTClassName(String uri) {
+ if (uri.equals(ExtensionNamespaceContext.EXSLT_MATH_URI))
+ return "org.apache.xalan.lib.ExsltMath";
+ else if (uri.equals(ExtensionNamespaceContext.EXSLT_SET_URI))
+ return "org.apache.xalan.lib.ExsltSets";
+ else if (uri.equals(ExtensionNamespaceContext.EXSLT_STRING_URI))
+ return "org.apache.xalan.lib.ExsltStrings";
+ else if (uri.equals(ExtensionNamespaceContext.EXSLT_DATETIME_URI))
+ return "org.apache.xalan.lib.ExsltDatetime";
+ else if (uri.equals(ExtensionNamespaceContext.EXSLT_DYNAMIC_URI))
+ return "org.apache.xalan.lib.ExsltDynamic";
+ else if (uri.equals(ExtensionNamespaceContext.EXSLT_URI))
+ return "org.apache.xalan.lib.ExsltCommon";
+ else
+ return null;
+ }
}
\ No newline at end of file
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XSLProcessorContext.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XSLProcessorContext.java
index c97d008..5c8b1da 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XSLProcessorContext.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/extensions/XSLProcessorContext.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: XSLProcessorContext.java,v 1.1 2008/03/27 01:08:58 dacarver Exp $
+ * $Id: XSLProcessorContext.java,v 1.2 2008/03/28 02:38:18 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.extensions;
@@ -57,271 +57,243 @@
/**
* Provides transformer context to be passed to an extension element.
- *
+ *
* @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
* @xsl.usage general
*/
-public class XSLProcessorContext
-{
+public class XSLProcessorContext {
- /**
- * Create a processor context to be passed to an extension.
- * (Notice it is a package-only constructor).
- *
- * @param transformer non-null transformer instance
- * @param stylesheetTree The owning stylesheet
- */
- public XSLProcessorContext(TransformerImpl transformer,
- Stylesheet stylesheetTree)
- {
+ /**
+ * Create a processor context to be passed to an extension. (Notice it is a
+ * package-only constructor).
+ *
+ * @param transformer
+ * non-null transformer instance
+ * @param stylesheetTree
+ * The owning stylesheet
+ */
+ public XSLProcessorContext(TransformerImpl transformer,
+ Stylesheet stylesheetTree) {
- this.transformer = transformer;
- this.stylesheetTree = stylesheetTree;
- // %TBD%
- org.apache.xpath.XPathContext xctxt = transformer.getXPathContext();
- this.mode = transformer.getMode();
- this.sourceNode = xctxt.getCurrentNode();
- this.sourceTree = xctxt.getDTM(this.sourceNode);
- }
+ this.transformer = transformer;
+ this.stylesheetTree = stylesheetTree;
+ // %TBD%
+ org.apache.xpath.XPathContext xctxt = transformer.getXPathContext();
+ this.mode = transformer.getMode();
+ this.sourceNode = xctxt.getCurrentNode();
+ this.sourceTree = xctxt.getDTM(this.sourceNode);
+ }
- /** An instance of a transformer */
- private TransformerImpl transformer;
+ /** An instance of a transformer */
+ private TransformerImpl transformer;
- /**
- * Get the transformer.
- *
- * @return the transformer instance for this context
- */
- public TransformerImpl getTransformer()
- {
- return transformer;
- }
+ /**
+ * Get the transformer.
+ *
+ * @return the transformer instance for this context
+ */
+ public TransformerImpl getTransformer() {
+ return transformer;
+ }
- /** The owning stylesheet for this context */
- private Stylesheet stylesheetTree;
+ /** The owning stylesheet for this context */
+ private Stylesheet stylesheetTree;
- /**
- * Get the Stylesheet being executed.
- *
- * @return the Stylesheet being executed.
- */
- public Stylesheet getStylesheet()
- {
- return stylesheetTree;
- }
+ /**
+ * Get the Stylesheet being executed.
+ *
+ * @return the Stylesheet being executed.
+ */
+ public Stylesheet getStylesheet() {
+ return stylesheetTree;
+ }
- /** The root of the source tree being executed. */
- private org.apache.xml.dtm.DTM sourceTree;
+ /** The root of the source tree being executed. */
+ private org.apache.xml.dtm.DTM sourceTree;
- /**
- * Get the root of the source tree being executed.
- *
- * @return the root of the source tree being executed.
- */
- public org.w3c.dom.Node getSourceTree()
- {
- return sourceTree.getNode(sourceTree.getDocumentRoot(sourceNode));
- }
+ /**
+ * Get the root of the source tree being executed.
+ *
+ * @return the root of the source tree being executed.
+ */
+ public org.w3c.dom.Node getSourceTree() {
+ return sourceTree.getNode(sourceTree.getDocumentRoot(sourceNode));
+ }
- /** the current context node. */
- private int sourceNode;
+ /** the current context node. */
+ private int sourceNode;
- /**
- * Get the current context node.
- *
- * @return the current context node.
- */
- public org.w3c.dom.Node getContextNode()
- {
- return sourceTree.getNode(sourceNode);
- }
+ /**
+ * Get the current context node.
+ *
+ * @return the current context node.
+ */
+ public org.w3c.dom.Node getContextNode() {
+ return sourceTree.getNode(sourceNode);
+ }
- /** the current mode being executed. */
- private QName mode;
+ /** the current mode being executed. */
+ private QName mode;
- /**
- * Get the current mode being executed.
- *
- * @return the current mode being executed.
- */
- public QName getMode()
- {
- return mode;
- }
+ /**
+ * Get the current mode being executed.
+ *
+ * @return the current mode being executed.
+ */
+ public QName getMode() {
+ return mode;
+ }
- /**
- * Output an object to the result tree by doing the right conversions.
- * This is public for access by extensions.
- *
- *
- * @param stylesheetTree The owning stylesheet
- * @param obj the Java object to output. If its of an X<something> type
- * then that conversion is done first and then sent out.
- *
- * @throws TransformerException
- * @throws java.io.FileNotFoundException
- * @throws java.io.IOException
- * @throws java.net.MalformedURLException
- */
- public void outputToResultTree(Stylesheet stylesheetTree, Object obj)
- throws TransformerException, java.net.MalformedURLException,
- java.io.FileNotFoundException, java.io.IOException
- {
+ /**
+ * Output an object to the result tree by doing the right conversions. This
+ * is public for access by extensions.
+ *
+ *
+ * @param stylesheetTree
+ * The owning stylesheet
+ * @param obj
+ * the Java object to output. If its of an X<something> type
+ * then that conversion is done first and then sent out.
+ *
+ * @throws TransformerException
+ * @throws java.io.FileNotFoundException
+ * @throws java.io.IOException
+ * @throws java.net.MalformedURLException
+ */
+ public void outputToResultTree(Stylesheet stylesheetTree, Object obj)
+ throws TransformerException, java.net.MalformedURLException,
+ java.io.FileNotFoundException, java.io.IOException {
- try
- {
- SerializationHandler rtreeHandler = transformer.getResultTreeHandler();
- XPathContext xctxt = transformer.getXPathContext();
- XObject value;
+ try {
+ SerializationHandler rtreeHandler = transformer
+ .getResultTreeHandler();
+ XPathContext xctxt = transformer.getXPathContext();
+ XObject value;
- // Make the return object into an XObject because it
- // will be easier below. One of the reasons to do this
- // is to keep all the conversion functionality in the
- // XObject classes.
- if (obj instanceof XObject)
- {
- value = (XObject) obj;
- }
- else if (obj instanceof String)
- {
- value = new XString((String) obj);
- }
- else if (obj instanceof Boolean)
- {
- value = new XBoolean(((Boolean) obj).booleanValue());
- }
- else if (obj instanceof Double)
- {
- value = new XNumber(((Double) obj).doubleValue());
- }
- else if (obj instanceof DocumentFragment)
- {
- int handle = xctxt.getDTMHandleFromNode((DocumentFragment)obj);
-
- value = new XRTreeFrag(handle, xctxt);
- }
- else if (obj instanceof DTM)
- {
- DTM dtm = (DTM)obj;
- DTMIterator iterator = new DescendantIterator();
- // %%ISSUE%% getDocument may not be valid for DTMs shared by multiple
- // document trees, eg RTFs. But in that case, we shouldn't be trying
- // to iterate over the whole DTM; we should be iterating over
- // dtm.getDocumentRoot(rootNodeHandle), and folks should have told us
- // this by passing a more appropriate type.
- iterator.setRoot(dtm.getDocument(), xctxt);
- value = new XNodeSet(iterator);
- }
- else if (obj instanceof DTMAxisIterator)
- {
- DTMAxisIterator iter = (DTMAxisIterator)obj;
- DTMIterator iterator = new OneStepIterator(iter, -1);
- value = new XNodeSet(iterator);
- }
- else if (obj instanceof DTMIterator)
- {
- value = new XNodeSet((DTMIterator) obj);
- }
- else if (obj instanceof NodeIterator)
- {
- value = new XNodeSet(new org.apache.xpath.NodeSetDTM(((NodeIterator)obj), xctxt));
- }
- else if (obj instanceof org.w3c.dom.Node)
- {
- value =
- new XNodeSet(xctxt.getDTMHandleFromNode((org.w3c.dom.Node) obj),
- xctxt.getDTMManager());
- }
- else
- {
- value = new XString(obj.toString());
- }
+ // Make the return object into an XObject because it
+ // will be easier below. One of the reasons to do this
+ // is to keep all the conversion functionality in the
+ // XObject classes.
+ if (obj instanceof XObject) {
+ value = (XObject) obj;
+ } else if (obj instanceof String) {
+ value = new XString((String) obj);
+ } else if (obj instanceof Boolean) {
+ value = new XBoolean(((Boolean) obj).booleanValue());
+ } else if (obj instanceof Double) {
+ value = new XNumber(((Double) obj).doubleValue());
+ } else if (obj instanceof DocumentFragment) {
+ int handle = xctxt.getDTMHandleFromNode((DocumentFragment) obj);
- int type = value.getType();
- String s;
+ value = new XRTreeFrag(handle, xctxt);
+ } else if (obj instanceof DTM) {
+ DTM dtm = (DTM) obj;
+ DTMIterator iterator = new DescendantIterator();
+ // %%ISSUE%% getDocument may not be valid for DTMs shared by
+ // multiple
+ // document trees, eg RTFs. But in that case, we shouldn't be
+ // trying
+ // to iterate over the whole DTM; we should be iterating over
+ // dtm.getDocumentRoot(rootNodeHandle), and folks should have
+ // told us
+ // this by passing a more appropriate type.
+ iterator.setRoot(dtm.getDocument(), xctxt);
+ value = new XNodeSet(iterator);
+ } else if (obj instanceof DTMAxisIterator) {
+ DTMAxisIterator iter = (DTMAxisIterator) obj;
+ DTMIterator iterator = new OneStepIterator(iter, -1);
+ value = new XNodeSet(iterator);
+ } else if (obj instanceof DTMIterator) {
+ value = new XNodeSet((DTMIterator) obj);
+ } else if (obj instanceof NodeIterator) {
+ value = new XNodeSet(new org.apache.xpath.NodeSetDTM(
+ ((NodeIterator) obj), xctxt));
+ } else if (obj instanceof org.w3c.dom.Node) {
+ value = new XNodeSet(xctxt
+ .getDTMHandleFromNode((org.w3c.dom.Node) obj), xctxt
+ .getDTMManager());
+ } else {
+ value = new XString(obj.toString());
+ }
- switch (type)
- {
- case XObject.CLASS_BOOLEAN :
- case XObject.CLASS_NUMBER :
- case XObject.CLASS_STRING :
- s = value.str();
+ int type = value.getType();
+ String s;
- rtreeHandler.characters(s.toCharArray(), 0, s.length());
- break;
+ switch (type) {
+ case XObject.CLASS_BOOLEAN:
+ case XObject.CLASS_NUMBER:
+ case XObject.CLASS_STRING:
+ s = value.str();
- case XObject.CLASS_NODESET : // System.out.println(value);
- DTMIterator nl = value.iter();
-
- int pos;
+ rtreeHandler.characters(s.toCharArray(), 0, s.length());
+ break;
- while (DTM.NULL != (pos = nl.nextNode()))
- {
- DTM dtm = nl.getDTM(pos);
- int top = pos;
+ case XObject.CLASS_NODESET: // System.out.println(value);
+ DTMIterator nl = value.iter();
- while (DTM.NULL != pos)
- {
- rtreeHandler.flushPending();
- ClonerToResultTree.cloneToResultTree(pos, dtm.getNodeType(pos),
- dtm, rtreeHandler, true);
+ int pos;
- int nextNode = dtm.getFirstChild(pos);
+ while (DTM.NULL != (pos = nl.nextNode())) {
+ DTM dtm = nl.getDTM(pos);
+ int top = pos;
- while (DTM.NULL == nextNode)
- {
- if (DTM.ELEMENT_NODE == dtm.getNodeType(pos))
- {
- rtreeHandler.endElement("", "", dtm.getNodeName(pos));
- }
+ while (DTM.NULL != pos) {
+ rtreeHandler.flushPending();
+ ClonerToResultTree.cloneToResultTree(pos, dtm
+ .getNodeType(pos), dtm, rtreeHandler, true);
- if (top == pos)
- break;
+ int nextNode = dtm.getFirstChild(pos);
- nextNode = dtm.getNextSibling(pos);
+ while (DTM.NULL == nextNode) {
+ if (DTM.ELEMENT_NODE == dtm.getNodeType(pos)) {
+ rtreeHandler.endElement("", "", dtm
+ .getNodeName(pos));
+ }
- if (DTM.NULL == nextNode)
- {
- pos = dtm.getParent(pos);
+ if (top == pos)
+ break;
- if (top == pos)
- {
- if (DTM.ELEMENT_NODE == dtm.getNodeType(pos))
- {
- rtreeHandler.endElement("", "", dtm.getNodeName(pos));
- }
+ nextNode = dtm.getNextSibling(pos);
- nextNode = DTM.NULL;
+ if (DTM.NULL == nextNode) {
+ pos = dtm.getParent(pos);
- break;
- }
- }
- }
+ if (top == pos) {
+ if (DTM.ELEMENT_NODE == dtm
+ .getNodeType(pos)) {
+ rtreeHandler.endElement("", "", dtm
+ .getNodeName(pos));
+ }
- pos = nextNode;
- }
- }
- break;
- case XObject.CLASS_RTREEFRAG :
- SerializerUtils.outputResultTreeFragment(
- rtreeHandler, value, transformer.getXPathContext());
-// rtreeHandler.outputResultTreeFragment(value,
-// transformer.getXPathContext());
- break;
- }
- }
- catch(org.xml.sax.SAXException se)
- {
- throw new TransformerException(se);
- }
- }
+ nextNode = DTM.NULL;
- /**
- * I need a "Node transformNode (Node)" method somewhere that the
- * user can call to process the transformation of a node but not
- * serialize out automatically. ????????????????
- *
- * Does ElemTemplateElement.executeChildTemplates() cut it? It sends
- * results out to the stream directly, so that could be a problem.
- */
+ break;
+ }
+ }
+ }
+
+ pos = nextNode;
+ }
+ }
+ break;
+ case XObject.CLASS_RTREEFRAG:
+ SerializerUtils.outputResultTreeFragment(rtreeHandler, value,
+ transformer.getXPathContext());
+ // rtreeHandler.outputResultTreeFragment(value,
+ // transformer.getXPathContext());
+ break;
+ }
+ } catch (org.xml.sax.SAXException se) {
+ throw new TransformerException(se);
+ }
+ }
+
+ /**
+ * I need a "Node transformNode (Node)" method somewhere that the user can
+ * call to process the transformation of a node but not serialize out
+ * automatically. ????????????????
+ *
+ * Does ElemTemplateElement.executeChildTemplates() cut it? It sends results
+ * out to the stream directly, so that could be a problem.
+ */
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorAttributeSet.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorAttributeSet.java
index 06a35fd..74cccf4 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorAttributeSet.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorAttributeSet.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorAttributeSet.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorAttributeSet.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -39,77 +39,85 @@
/**
* This class processes parse events for an xsl:attribute-set.
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in XSLT Specification</a>
+ * @see <a href="http://www.w3.org/TR/xslt#attribute-sets">attribute-sets in
+ * XSLT Specification</a>
*/
-public class ProcessorAttributeSet extends XSLTElementProcessor
-{
- public static final long serialVersionUID = -6473739251316787552L;
+public class ProcessorAttributeSet extends XSLTElementProcessor {
+ public static final long serialVersionUID = -6473739251316787552L;
- /**
- * Receive notification of the start of an xsl:attribute-set element.
- *
- * @param handler The calling StylesheetHandler/TemplatesBuilder.
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param rawName The raw XML 1.0 name (with prefix), or the
- * empty string if raw names are not available.
- * @param attributes The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- *
- * @see org.apache.xalan.processor.StylesheetHandler#startElement
- * @see org.xml.sax.ContentHandler#startElement
- * @see org.xml.sax.ContentHandler#endElement
- * @see org.xml.sax.Attributes
- */
- public void startElement(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Receive notification of the start of an xsl:attribute-set element.
+ *
+ * @param handler
+ * The calling StylesheetHandler/TemplatesBuilder.
+ * @param uri
+ * The Namespace URI, or the empty string if the element has no
+ * Namespace URI or if Namespace processing is not being
+ * performed.
+ * @param localName
+ * The local name (without prefix), or the empty string if
+ * Namespace processing is not being performed.
+ * @param rawName
+ * The raw XML 1.0 name (with prefix), or the empty string if raw
+ * names are not available.
+ * @param attributes
+ * The attributes attached to the element. If there are no
+ * attributes, it shall be an empty Attributes object.
+ *
+ * @see org.apache.xalan.processor.StylesheetHandler#startElement
+ * @see org.xml.sax.ContentHandler#startElement
+ * @see org.xml.sax.ContentHandler#endElement
+ * @see org.xml.sax.Attributes
+ */
+ @Override
+ public void startElement(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws org.xml.sax.SAXException {
- ElemAttributeSet eat = new ElemAttributeSet();
+ ElemAttributeSet eat = new ElemAttributeSet();
- eat.setLocaterInfo(handler.getLocator());
- try
- {
- eat.setPrefixes(handler.getNamespaceSupport());
- }
- catch(TransformerException te)
- {
- throw new org.xml.sax.SAXException(te);
- }
+ eat.setLocaterInfo(handler.getLocator());
+ try {
+ eat.setPrefixes(handler.getNamespaceSupport());
+ } catch (TransformerException te) {
+ throw new org.xml.sax.SAXException(te);
+ }
- eat.setDOMBackPointer(handler.getOriginatingNode());
- setPropertiesFromAttributes(handler, rawName, attributes, eat);
- handler.getStylesheet().setAttributeSet(eat);
+ eat.setDOMBackPointer(handler.getOriginatingNode());
+ setPropertiesFromAttributes(handler, rawName, attributes, eat);
+ handler.getStylesheet().setAttributeSet(eat);
- // handler.pushElemTemplateElement(eat);
- ElemTemplateElement parent = handler.getElemTemplateElement();
+ // handler.pushElemTemplateElement(eat);
+ ElemTemplateElement parent = handler.getElemTemplateElement();
- parent.appendChild(eat);
- handler.pushElemTemplateElement(eat);
- }
+ parent.appendChild(eat);
+ handler.pushElemTemplateElement(eat);
+ }
- /**
- * Receive notification of the end of an element.
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param uri The Namespace URI, or an empty string.
- * @param localName The local name (without prefix), or empty string if not namespace processing.
- * @param rawName The qualified name (with prefix).
- */
- public void endElement(
- StylesheetHandler handler, String uri, String localName, String rawName)
- throws org.xml.sax.SAXException
- {
- handler.popElemTemplateElement();
- }
+ /**
+ * Receive notification of the end of an element.
+ *
+ * @param name
+ * The element type name.
+ * @param attributes
+ * The specified or defaulted attributes.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param uri
+ * The Namespace URI, or an empty string.
+ * @param localName
+ * The local name (without prefix), or empty string if not
+ * namespace processing.
+ * @param rawName
+ * The qualified name (with prefix).
+ */
+ @Override
+ public void endElement(StylesheetHandler handler, String uri,
+ String localName, String rawName) throws org.xml.sax.SAXException {
+ handler.popElemTemplateElement();
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorCharacters.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorCharacters.java
index 7bf90b3..f54968d 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorCharacters.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorCharacters.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorCharacters.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorCharacters.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -41,149 +41,151 @@
/**
* This class processes character events for a XSLT template element.
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#section-Creating-the-Result-Tree">section-Creating-the-Result-Tree in XSLT Specification</a>
+ * @see <a
+ * href="http://www.w3.org/TR/xslt#section-Creating-the-Result-Tree">section-Creating-the-Result-Tree
+ * in XSLT Specification</a>
*/
-public class ProcessorCharacters extends XSLTElementProcessor
-{
- static final long serialVersionUID = 8632900007814162650L;
+public class ProcessorCharacters extends XSLTElementProcessor {
+ static final long serialVersionUID = 8632900007814162650L;
- /**
- * Receive notification of the start of the non-text event. This
- * is sent to the current processor when any non-text event occurs.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- */
- public void startNonText(StylesheetHandler handler) throws org.xml.sax.SAXException
- {
- if (this == handler.getCurrentProcessor())
- {
- handler.popProcessor();
- }
+ /**
+ * Receive notification of the start of the non-text event. This is sent to
+ * the current processor when any non-text event occurs.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ */
+ @Override
+ public void startNonText(StylesheetHandler handler)
+ throws org.xml.sax.SAXException {
+ if (this == handler.getCurrentProcessor()) {
+ handler.popProcessor();
+ }
- int nChars = m_accumulator.length();
+ int nChars = m_accumulator.length();
- if ((nChars > 0)
- && ((null != m_xslTextElement)
- ||!XMLCharacterRecognizer.isWhiteSpace(m_accumulator))
- || handler.isSpacePreserve())
- {
- ElemTextLiteral elem = new ElemTextLiteral();
+ if ((nChars > 0)
+ && ((null != m_xslTextElement) || !XMLCharacterRecognizer
+ .isWhiteSpace(m_accumulator))
+ || handler.isSpacePreserve()) {
+ ElemTextLiteral elem = new ElemTextLiteral();
- elem.setDOMBackPointer(m_firstBackPointer);
- elem.setLocaterInfo(handler.getLocator());
- try
- {
- elem.setPrefixes(handler.getNamespaceSupport());
- }
- catch(TransformerException te)
- {
- throw new org.xml.sax.SAXException(te);
- }
+ elem.setDOMBackPointer(m_firstBackPointer);
+ elem.setLocaterInfo(handler.getLocator());
+ try {
+ elem.setPrefixes(handler.getNamespaceSupport());
+ } catch (TransformerException te) {
+ throw new org.xml.sax.SAXException(te);
+ }
- boolean doe = (null != m_xslTextElement)
- ? m_xslTextElement.getDisableOutputEscaping() : false;
+ boolean doe = (null != m_xslTextElement) ? m_xslTextElement
+ .getDisableOutputEscaping() : false;
- elem.setDisableOutputEscaping(doe);
- elem.setPreserveSpace(true);
+ elem.setDisableOutputEscaping(doe);
+ elem.setPreserveSpace(true);
- char[] chars = new char[nChars];
+ char[] chars = new char[nChars];
- m_accumulator.getChars(0, nChars, chars, 0);
- elem.setChars(chars);
+ m_accumulator.getChars(0, nChars, chars, 0);
+ elem.setChars(chars);
- ElemTemplateElement parent = handler.getElemTemplateElement();
+ ElemTemplateElement parent = handler.getElemTemplateElement();
- parent.appendChild(elem);
- }
+ parent.appendChild(elem);
+ }
- m_accumulator.setLength(0);
- m_firstBackPointer = null;
- }
-
- protected Node m_firstBackPointer = null;
+ m_accumulator.setLength(0);
+ m_firstBackPointer = null;
+ }
- /**
- * Receive notification of character data inside an element.
- *
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param ch The characters.
- * @param start The start position in the character array.
- * @param length The number of characters to use from the
- * character array.
- * @throws org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- * @see org.xml.sax.ContentHandler#characters
- */
- public void characters(
- StylesheetHandler handler, char ch[], int start, int length)
- throws org.xml.sax.SAXException
- {
+ protected Node m_firstBackPointer = null;
- m_accumulator.append(ch, start, length);
-
- if(null == m_firstBackPointer)
- m_firstBackPointer = handler.getOriginatingNode();
+ /**
+ * Receive notification of character data inside an element.
+ *
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param ch
+ * The characters.
+ * @param start
+ * The start position in the character array.
+ * @param length
+ * The number of characters to use from the character array.
+ * @throws org.xml.sax.SAXException
+ * Any SAX exception, possibly wrapping another exception.
+ * @see org.xml.sax.ContentHandler#characters
+ */
+ @Override
+ public void characters(StylesheetHandler handler, char ch[], int start,
+ int length) throws org.xml.sax.SAXException {
- // Catch all events until a non-character event.
- if (this != handler.getCurrentProcessor())
- handler.pushProcessor(this);
- }
+ m_accumulator.append(ch, start, length);
- /**
- * Receive notification of the end of an element.
- *
- * @param handler The calling StylesheetHandler/TemplatesBuilder.
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param rawName The raw XML 1.0 name (with prefix), or the
- * empty string if raw names are not available.
- * @see org.apache.xalan.processor.StylesheetHandler#startElement
- * @see org.apache.xalan.processor.StylesheetHandler#endElement
- * @see org.xml.sax.ContentHandler#startElement
- * @see org.xml.sax.ContentHandler#endElement
- * @see org.xml.sax.Attributes
- */
- public void endElement(
- StylesheetHandler handler, String uri, String localName, String rawName)
- throws org.xml.sax.SAXException
- {
+ if (null == m_firstBackPointer)
+ m_firstBackPointer = handler.getOriginatingNode();
- // Since this has been installed as the current processor, we
- // may get and end element event, in which case, we pop and clear
- // and then call the real element processor.
- startNonText(handler);
- handler.getCurrentProcessor().endElement(handler, uri, localName,
- rawName);
- handler.popProcessor();
- }
+ // Catch all events until a non-character event.
+ if (this != handler.getCurrentProcessor())
+ handler.pushProcessor(this);
+ }
- /**
- * Accumulate characters, until a non-whitespace event has
- * occured.
- */
- private StringBuffer m_accumulator = new StringBuffer();
+ /**
+ * Receive notification of the end of an element.
+ *
+ * @param handler
+ * The calling StylesheetHandler/TemplatesBuilder.
+ * @param uri
+ * The Namespace URI, or the empty string if the element has no
+ * Namespace URI or if Namespace processing is not being
+ * performed.
+ * @param localName
+ * The local name (without prefix), or the empty string if
+ * Namespace processing is not being performed.
+ * @param rawName
+ * The raw XML 1.0 name (with prefix), or the empty string if raw
+ * names are not available.
+ * @see org.apache.xalan.processor.StylesheetHandler#startElement
+ * @see org.apache.xalan.processor.StylesheetHandler#endElement
+ * @see org.xml.sax.ContentHandler#startElement
+ * @see org.xml.sax.ContentHandler#endElement
+ * @see org.xml.sax.Attributes
+ */
+ @Override
+ public void endElement(StylesheetHandler handler, String uri,
+ String localName, String rawName) throws org.xml.sax.SAXException {
- /**
- * The xsl:text processor will call this to set a
- * preserve space state.
- */
- private ElemText m_xslTextElement;
+ // Since this has been installed as the current processor, we
+ // may get and end element event, in which case, we pop and clear
+ // and then call the real element processor.
+ startNonText(handler);
+ handler.getCurrentProcessor().endElement(handler, uri, localName,
+ rawName);
+ handler.popProcessor();
+ }
- /**
- * Set the current setXslTextElement. The xsl:text
- * processor will call this to set a preserve space state.
- *
- * @param xslTextElement The current xslTextElement that
- * is preserving state, or null.
- */
- protected void setXslTextElement(ElemText xslTextElement)
- {
- m_xslTextElement = xslTextElement;
- }
+ /**
+ * Accumulate characters, until a non-whitespace event has occured.
+ */
+ private StringBuffer m_accumulator = new StringBuffer();
+
+ /**
+ * The xsl:text processor will call this to set a preserve space state.
+ */
+ private ElemText m_xslTextElement;
+
+ /**
+ * Set the current setXslTextElement. The xsl:text processor will call this
+ * to set a preserve space state.
+ *
+ * @param xslTextElement
+ * The current xslTextElement that is preserving state, or null.
+ */
+ protected void setXslTextElement(ElemText xslTextElement) {
+ m_xslTextElement = xslTextElement;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorDecimalFormat.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorDecimalFormat.java
index f09a34d..c6079e1 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorDecimalFormat.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorDecimalFormat.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorDecimalFormat.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorDecimalFormat.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -34,52 +34,56 @@
import org.xml.sax.Attributes;
/**
- * Process xsl:decimal-format by creating a DecimalFormatProperties
- * object and passing it to the stylesheet.
+ * Process xsl:decimal-format by creating a DecimalFormatProperties object and
+ * passing it to the stylesheet.
*
* @see org.apache.xalan.templates.Stylesheet#setDecimalFormat
* @see org.apache.xalan.templates.DecimalFormatProperties
- * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT Specification</a>
+ * @see <a href="http://www.w3.org/TR/xslt#format-number">format-number in XSLT
+ * Specification</a>
* @xsl.usage internal
*/
-class ProcessorDecimalFormat extends XSLTElementProcessor
-{
- static final long serialVersionUID = -5052904382662921627L;
+class ProcessorDecimalFormat extends XSLTElementProcessor {
+ static final long serialVersionUID = -5052904382662921627L;
- /**
- * Receive notification of the start of an element.
- *
- * @param handler The calling StylesheetHandler/TemplatesBuilder.
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param rawName The raw XML 1.0 name (with prefix), or the
- * empty string if raw names are not available.
- * @param attributes The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- * @see org.apache.xalan.processor.StylesheetHandler#startElement
- * @see org.apache.xalan.processor.StylesheetHandler#endElement
- * @see org.xml.sax.ContentHandler#startElement
- * @see org.xml.sax.ContentHandler#endElement
- * @see org.xml.sax.Attributes
- */
- public void startElement(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Receive notification of the start of an element.
+ *
+ * @param handler
+ * The calling StylesheetHandler/TemplatesBuilder.
+ * @param uri
+ * The Namespace URI, or the empty string if the element has no
+ * Namespace URI or if Namespace processing is not being
+ * performed.
+ * @param localName
+ * The local name (without prefix), or the empty string if
+ * Namespace processing is not being performed.
+ * @param rawName
+ * The raw XML 1.0 name (with prefix), or the empty string if raw
+ * names are not available.
+ * @param attributes
+ * The attributes attached to the element. If there are no
+ * attributes, it shall be an empty Attributes object.
+ * @see org.apache.xalan.processor.StylesheetHandler#startElement
+ * @see org.apache.xalan.processor.StylesheetHandler#endElement
+ * @see org.xml.sax.ContentHandler#startElement
+ * @see org.xml.sax.ContentHandler#endElement
+ * @see org.xml.sax.Attributes
+ */
+ @Override
+ public void startElement(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws org.xml.sax.SAXException {
- DecimalFormatProperties dfp = new DecimalFormatProperties(handler.nextUid());
-
- dfp.setDOMBackPointer(handler.getOriginatingNode());
- dfp.setLocaterInfo(handler.getLocator());
-
- setPropertiesFromAttributes(handler, rawName, attributes, dfp);
- handler.getStylesheet().setDecimalFormat(dfp);
-
- handler.getStylesheet().appendChild(dfp);
- }
+ DecimalFormatProperties dfp = new DecimalFormatProperties(handler
+ .nextUid());
+
+ dfp.setDOMBackPointer(handler.getOriginatingNode());
+ dfp.setLocaterInfo(handler.getLocator());
+
+ setPropertiesFromAttributes(handler, rawName, attributes, dfp);
+ handler.getStylesheet().setDecimalFormat(dfp);
+
+ handler.getStylesheet().appendChild(dfp);
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFuncResult.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFuncResult.java
index b31b376..5958ea0 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFuncResult.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFuncResult.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorExsltFuncResult.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorExsltFuncResult.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -41,40 +41,38 @@
/**
* This class processes parse events for an exslt func:result element.
+ *
* @xsl.usage internal
*/
-public class ProcessorExsltFuncResult extends ProcessorTemplateElem
-{
- static final long serialVersionUID = 6451230911473482423L;
-
- /**
- * Verify that the func:result element does not appear within a variable,
- * parameter, or another func:result, and that it belongs to a func:function
- * element.
- */
- public void startElement(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws SAXException
- {
- String msg = "";
+public class ProcessorExsltFuncResult extends ProcessorTemplateElem {
+ static final long serialVersionUID = 6451230911473482423L;
- super.startElement(handler, uri, localName, rawName, attributes);
- ElemTemplateElement ancestor = handler.getElemTemplateElement().getParentElem();
- while (ancestor != null && !(ancestor instanceof ElemExsltFunction))
- {
- if (ancestor instanceof ElemVariable
- || ancestor instanceof ElemParam
- || ancestor instanceof ElemExsltFuncResult)
- {
- msg = "func:result cannot appear within a variable, parameter, or another func:result.";
- handler.error(msg, new SAXException(msg));
- }
- ancestor = ancestor.getParentElem();
- }
- if (ancestor == null)
- {
- msg = "func:result must appear in a func:function element";
- handler.error(msg, new SAXException(msg));
- }
- }
+ /**
+ * Verify that the func:result element does not appear within a variable,
+ * parameter, or another func:result, and that it belongs to a func:function
+ * element.
+ */
+ @Override
+ public void startElement(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws SAXException {
+ String msg = "";
+
+ super.startElement(handler, uri, localName, rawName, attributes);
+ ElemTemplateElement ancestor = handler.getElemTemplateElement()
+ .getParentElem();
+ while (ancestor != null && !(ancestor instanceof ElemExsltFunction)) {
+ if (ancestor instanceof ElemVariable
+ || ancestor instanceof ElemParam
+ || ancestor instanceof ElemExsltFuncResult) {
+ msg = "func:result cannot appear within a variable, parameter, or another func:result.";
+ handler.error(msg, new SAXException(msg));
+ }
+ ancestor = ancestor.getParentElem();
+ }
+ if (ancestor == null) {
+ msg = "func:result must appear in a func:function element";
+ handler.error(msg, new SAXException(msg));
+ }
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFunction.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFunction.java
index 74056f6..5dd71f5 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFunction.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorExsltFunction.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorExsltFunction.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorExsltFunction.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -59,145 +59,132 @@
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
-
/**
* This class processes parse events for an exslt func:function element.
+ *
* @xsl.usage internal
*/
-public class ProcessorExsltFunction extends ProcessorTemplateElem
-{
- static final long serialVersionUID = 2411427965578315332L;
- /**
- * Start an ElemExsltFunction. Verify that it is top level and that it has a name attribute with a
- * namespace.
- */
- public void startElement(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws SAXException
- {
- //System.out.println("ProcessorFunction.startElement()");
- String msg = "";
- if (!(handler.getElemTemplateElement() instanceof Stylesheet))
- {
- msg = "func:function element must be top level.";
- handler.error(msg, new SAXException(msg));
- }
- super.startElement(handler, uri, localName, rawName, attributes);
-
- String val = attributes.getValue("name");
- int indexOfColon = val.indexOf(":");
- if (indexOfColon > 0)
- {
- String prefix = val.substring(0, indexOfColon);
- String localVal = val.substring(indexOfColon + 1);
- String ns = handler.getNamespaceSupport().getURI(prefix);
- //if (ns.length() > 0)
- // System.out.println("fullfuncname " + ns + localVal);
- }
- else
- {
- msg = "func:function name must have namespace";
- handler.error(msg, new SAXException(msg));
- }
- }
-
- /**
- * Must include; super doesn't suffice!
- */
- protected void appendAndPush(
- StylesheetHandler handler, ElemTemplateElement elem)
- throws SAXException
- {
- //System.out.println("ProcessorFunction appendAndPush()" + elem);
- super.appendAndPush(handler, elem);
- //System.out.println("originating node " + handler.getOriginatingNode());
- elem.setDOMBackPointer(handler.getOriginatingNode());
- handler.getStylesheet().setTemplate((ElemTemplate) elem);
- }
-
- /**
- * End an ElemExsltFunction, and verify its validity.
- */
- public void endElement(
- StylesheetHandler handler, String uri, String localName, String rawName)
- throws SAXException
- {
- ElemTemplateElement function = handler.getElemTemplateElement();
- SourceLocator locator = handler.getLocator();
- validate(function, handler); // may throw exception
- super.endElement(handler, uri, localName, rawName);
- }
-
- /**
- * Non-recursive traversal of FunctionElement tree based on TreeWalker to verify that
- * there are no literal result elements except within a func:result element and that
- * the func:result element does not contain any following siblings except xsl:fallback.
- */
- public void validate(ElemTemplateElement elem, StylesheetHandler handler)
- throws SAXException
- {
- String msg = "";
- while (elem != null)
- {
- //System.out.println("elem " + elem);
- if (elem instanceof ElemExsltFuncResult
- && elem.getNextSiblingElem() != null
- && !(elem.getNextSiblingElem() instanceof ElemFallback))
- {
- msg = "func:result has an illegal following sibling (only xsl:fallback allowed)";
- handler.error(msg, new SAXException(msg));
- }
-
- if((elem instanceof ElemApplyImport
- || elem instanceof ElemApplyTemplates
- || elem instanceof ElemAttribute
- || elem instanceof ElemCallTemplate
- || elem instanceof ElemComment
- || elem instanceof ElemCopy
- || elem instanceof ElemCopyOf
- || elem instanceof ElemElement
- || elem instanceof ElemLiteralResult
- || elem instanceof ElemNumber
- || elem instanceof ElemPI
- || elem instanceof ElemText
- || elem instanceof ElemTextLiteral
- || elem instanceof ElemValueOf)
- && !(ancestorIsOk(elem)))
- {
- msg ="misplaced literal result in a func:function container.";
- handler.error(msg, new SAXException(msg));
- }
- ElemTemplateElement nextElem = elem.getFirstChildElem();
- while (nextElem == null)
- {
- nextElem = elem.getNextSiblingElem();
- if (nextElem == null)
- elem = elem.getParentElem();
- if (elem == null || elem instanceof ElemExsltFunction)
- return; // ok
- }
- elem = nextElem;
- }
- }
-
- /**
- * Verify that a literal result belongs to a result element, a variable,
- * or a parameter.
- */
-
- protected boolean ancestorIsOk(ElemTemplateElement child)
- {
- while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction))
- {
- ElemTemplateElement parent = child.getParentElem();
- if (parent instanceof ElemExsltFuncResult
- || parent instanceof ElemVariable
- || parent instanceof ElemParam
- || parent instanceof ElemMessage)
- return true;
- child = parent;
- }
- return false;
- }
-
+public class ProcessorExsltFunction extends ProcessorTemplateElem {
+ static final long serialVersionUID = 2411427965578315332L;
+
+ /**
+ * Start an ElemExsltFunction. Verify that it is top level and that it has a
+ * name attribute with a namespace.
+ */
+ @Override
+ public void startElement(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws SAXException {
+ // System.out.println("ProcessorFunction.startElement()");
+ String msg = "";
+ if (!(handler.getElemTemplateElement() instanceof Stylesheet)) {
+ msg = "func:function element must be top level.";
+ handler.error(msg, new SAXException(msg));
+ }
+ super.startElement(handler, uri, localName, rawName, attributes);
+
+ String val = attributes.getValue("name");
+ int indexOfColon = val.indexOf(":");
+ if (indexOfColon > 0) {
+ String prefix = val.substring(0, indexOfColon);
+ String localVal = val.substring(indexOfColon + 1);
+ String ns = handler.getNamespaceSupport().getURI(prefix);
+ // if (ns.length() > 0)
+ // System.out.println("fullfuncname " + ns + localVal);
+ } else {
+ msg = "func:function name must have namespace";
+ handler.error(msg, new SAXException(msg));
+ }
+ }
+
+ /**
+ * Must include; super doesn't suffice!
+ */
+ @Override
+ protected void appendAndPush(StylesheetHandler handler,
+ ElemTemplateElement elem) throws SAXException {
+ // System.out.println("ProcessorFunction appendAndPush()" + elem);
+ super.appendAndPush(handler, elem);
+ // System.out.println("originating node " +
+ // handler.getOriginatingNode());
+ elem.setDOMBackPointer(handler.getOriginatingNode());
+ handler.getStylesheet().setTemplate((ElemTemplate) elem);
+ }
+
+ /**
+ * End an ElemExsltFunction, and verify its validity.
+ */
+ @Override
+ public void endElement(StylesheetHandler handler, String uri,
+ String localName, String rawName) throws SAXException {
+ ElemTemplateElement function = handler.getElemTemplateElement();
+ SourceLocator locator = handler.getLocator();
+ validate(function, handler); // may throw exception
+ super.endElement(handler, uri, localName, rawName);
+ }
+
+ /**
+ * Non-recursive traversal of FunctionElement tree based on TreeWalker to
+ * verify that there are no literal result elements except within a
+ * func:result element and that the func:result element does not contain any
+ * following siblings except xsl:fallback.
+ */
+ public void validate(ElemTemplateElement elem, StylesheetHandler handler)
+ throws SAXException {
+ String msg = "";
+ while (elem != null) {
+ // System.out.println("elem " + elem);
+ if (elem instanceof ElemExsltFuncResult
+ && elem.getNextSiblingElem() != null
+ && !(elem.getNextSiblingElem() instanceof ElemFallback)) {
+ msg = "func:result has an illegal following sibling (only xsl:fallback allowed)";
+ handler.error(msg, new SAXException(msg));
+ }
+
+ if ((elem instanceof ElemApplyImport
+ || elem instanceof ElemApplyTemplates
+ || elem instanceof ElemAttribute
+ || elem instanceof ElemCallTemplate
+ || elem instanceof ElemComment || elem instanceof ElemCopy
+ || elem instanceof ElemCopyOf
+ || elem instanceof ElemElement
+ || elem instanceof ElemLiteralResult
+ || elem instanceof ElemNumber || elem instanceof ElemPI
+ || elem instanceof ElemText
+ || elem instanceof ElemTextLiteral || elem instanceof ElemValueOf)
+ && !(ancestorIsOk(elem))) {
+ msg = "misplaced literal result in a func:function container.";
+ handler.error(msg, new SAXException(msg));
+ }
+ ElemTemplateElement nextElem = elem.getFirstChildElem();
+ while (nextElem == null) {
+ nextElem = elem.getNextSiblingElem();
+ if (nextElem == null)
+ elem = elem.getParentElem();
+ if (elem == null || elem instanceof ElemExsltFunction)
+ return; // ok
+ }
+ elem = nextElem;
+ }
+ }
+
+ /**
+ * Verify that a literal result belongs to a result element, a variable, or
+ * a parameter.
+ */
+
+ protected boolean ancestorIsOk(ElemTemplateElement child) {
+ while (child.getParentElem() != null
+ && !(child.getParentElem() instanceof ElemExsltFunction)) {
+ ElemTemplateElement parent = child.getParentElem();
+ if (parent instanceof ElemExsltFuncResult
+ || parent instanceof ElemVariable
+ || parent instanceof ElemParam
+ || parent instanceof ElemMessage)
+ return true;
+ child = parent;
+ }
+ return false;
+ }
+
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalParamDecl.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalParamDecl.java
index 3c7f4fd..b2eb6f3 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalParamDecl.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalParamDecl.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorGlobalParamDecl.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorGlobalParamDecl.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -35,53 +35,63 @@
/**
* This class processes parse events for an xsl:param element.
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
+ * @see <a
+ * href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables
+ * in XSLT Specification</a>
*/
-class ProcessorGlobalParamDecl extends ProcessorTemplateElem
-{
- static final long serialVersionUID = 1900450872353587350L;
+class ProcessorGlobalParamDecl extends ProcessorTemplateElem {
+ static final long serialVersionUID = 1900450872353587350L;
- /**
- * Append the current template element to the current
- * template element, and then push it onto the current template
- * element stack.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param elem The non-null reference to the ElemParam element.
- *
- * @throws org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- protected void appendAndPush(
- StylesheetHandler handler, ElemTemplateElement elem)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Append the current template element to the current template element, and
+ * then push it onto the current template element stack.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param elem
+ * The non-null reference to the ElemParam element.
+ *
+ * @throws org.xml.sax.SAXException
+ * Any SAX exception, possibly wrapping another exception.
+ */
+ @Override
+ protected void appendAndPush(StylesheetHandler handler,
+ ElemTemplateElement elem) throws org.xml.sax.SAXException {
- // Just push, but don't append.
- handler.pushElemTemplateElement(elem);
- }
+ // Just push, but don't append.
+ handler.pushElemTemplateElement(elem);
+ }
- /**
- * Receive notification of the end of an element.
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param uri The Namespace URI, or an empty string.
- * @param localName The local name (without prefix), or empty string if not namespace processing.
- * @param rawName The qualified name (with prefix).
- */
- public void endElement(
- StylesheetHandler handler, String uri, String localName, String rawName)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Receive notification of the end of an element.
+ *
+ * @param name
+ * The element type name.
+ * @param attributes
+ * The specified or defaulted attributes.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param uri
+ * The Namespace URI, or an empty string.
+ * @param localName
+ * The local name (without prefix), or empty string if not
+ * namespace processing.
+ * @param rawName
+ * The qualified name (with prefix).
+ */
+ @Override
+ public void endElement(StylesheetHandler handler, String uri,
+ String localName, String rawName) throws org.xml.sax.SAXException {
- ElemParam v = (ElemParam) handler.getElemTemplateElement();
+ ElemParam v = (ElemParam) handler.getElemTemplateElement();
- handler.getStylesheet().appendChild(v);
- handler.getStylesheet().setParam(v);
- super.endElement(handler, uri, localName, rawName);
- }
+ handler.getStylesheet().appendChild(v);
+ handler.getStylesheet().setParam(v);
+ super.endElement(handler, uri, localName, rawName);
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalVariableDecl.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalVariableDecl.java
index 81ec9c5..de061d1 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalVariableDecl.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorGlobalVariableDecl.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorGlobalVariableDecl.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorGlobalVariableDecl.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -35,53 +35,63 @@
/**
* This class processes parse events for an xsl:variable element.
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables in XSLT Specification</a>
+ * @see <a
+ * href="http://www.w3.org/TR/xslt#top-level-variables">top-level-variables
+ * in XSLT Specification</a>
*/
-class ProcessorGlobalVariableDecl extends ProcessorTemplateElem
-{
- static final long serialVersionUID = -5954332402269819582L;
+class ProcessorGlobalVariableDecl extends ProcessorTemplateElem {
+ static final long serialVersionUID = -5954332402269819582L;
- /**
- * Append the current template element to the current
- * template element, and then push it onto the current template
- * element stack.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param elem The non-null reference to the ElemVariable element.
- *
- * @throws org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- protected void appendAndPush(
- StylesheetHandler handler, ElemTemplateElement elem)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Append the current template element to the current template element, and
+ * then push it onto the current template element stack.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param elem
+ * The non-null reference to the ElemVariable element.
+ *
+ * @throws org.xml.sax.SAXException
+ * Any SAX exception, possibly wrapping another exception.
+ */
+ @Override
+ protected void appendAndPush(StylesheetHandler handler,
+ ElemTemplateElement elem) throws org.xml.sax.SAXException {
- // Just push, but don't append.
- handler.pushElemTemplateElement(elem);
- }
+ // Just push, but don't append.
+ handler.pushElemTemplateElement(elem);
+ }
- /**
- * Receive notification of the end of an element.
- *
- * @param name The element type name.
- * @param attributes The specified or defaulted attributes.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param uri The Namespace URI, or an empty string.
- * @param localName The local name (without prefix), or empty string if not namespace processing.
- * @param rawName The qualified name (with prefix).
- */
- public void endElement(
- StylesheetHandler handler, String uri, String localName, String rawName)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Receive notification of the end of an element.
+ *
+ * @param name
+ * The element type name.
+ * @param attributes
+ * The specified or defaulted attributes.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param uri
+ * The Namespace URI, or an empty string.
+ * @param localName
+ * The local name (without prefix), or empty string if not
+ * namespace processing.
+ * @param rawName
+ * The qualified name (with prefix).
+ */
+ @Override
+ public void endElement(StylesheetHandler handler, String uri,
+ String localName, String rawName) throws org.xml.sax.SAXException {
- ElemVariable v = (ElemVariable) handler.getElemTemplateElement();
+ ElemVariable v = (ElemVariable) handler.getElemTemplateElement();
- handler.getStylesheet().appendChild(v);
- handler.getStylesheet().setVariable(v);
- super.endElement(handler, uri, localName, rawName);
- }
+ handler.getStylesheet().appendChild(v);
+ handler.getStylesheet().setVariable(v);
+ super.endElement(handler, uri, localName, rawName);
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorImport.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorImport.java
index 039dbb2..822f62d 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorImport.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorImport.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorImport.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorImport.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -34,33 +34,34 @@
/**
* This class processes parse events for an xsl:import element.
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
* @see <a href="http://www.w3.org/TR/xslt#import">import in XSLT Specification</a>
*
* @xsl.usage internal
*/
-public class ProcessorImport extends ProcessorInclude
-{
- static final long serialVersionUID = -8247537698214245237L;
+public class ProcessorImport extends ProcessorInclude {
+ static final long serialVersionUID = -8247537698214245237L;
- /**
- * Get the stylesheet type associated with an imported stylesheet
- *
- * @return the type of the stylesheet
- */
- protected int getStylesheetType()
- {
- return StylesheetHandler.STYPE_IMPORT;
- }
+ /**
+ * Get the stylesheet type associated with an imported stylesheet
+ *
+ * @return the type of the stylesheet
+ */
+ @Override
+ protected int getStylesheetType() {
+ return StylesheetHandler.STYPE_IMPORT;
+ }
- /**
- * Get the error number associated with this type of stylesheet importing itself
- *
- * @return the appropriate error number
- */
- protected String getStylesheetInclErr()
- {
- return XSLTErrorResources.ER_IMPORTING_ITSELF;
- }
+ /**
+ * Get the error number associated with this type of stylesheet importing
+ * itself
+ *
+ * @return the appropriate error number
+ */
+ @Override
+ protected String getStylesheetInclErr() {
+ return XSLTErrorResources.ER_IMPORTING_ITSELF;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorInclude.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorInclude.java
index 096b1d4..a07895f 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorInclude.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorInclude.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorInclude.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorInclude.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -54,273 +54,264 @@
/**
* TransformerFactory class for xsl:include markup.
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
- * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT Specification</a>
+ * @see <a href="http://www.w3.org/TR/xslt#include">include in XSLT
+ * Specification</a>
*
* @xsl.usage internal
*/
-public class ProcessorInclude extends XSLTElementProcessor
-{
- static final long serialVersionUID = -4570078731972673481L;
+public class ProcessorInclude extends XSLTElementProcessor {
+ static final long serialVersionUID = -4570078731972673481L;
- /**
- * The base URL of the XSL document.
- * @serial
- */
- private String m_href = null;
+ /**
+ * The base URL of the XSL document.
+ *
+ * @serial
+ */
+ private String m_href = null;
- /**
- * Get the base identifier with which this stylesheet is associated.
- *
- * @return non-null reference to the href attribute string, or
- * null if setHref has not been called.
- */
- public String getHref()
- {
- return m_href;
- }
+ /**
+ * Get the base identifier with which this stylesheet is associated.
+ *
+ * @return non-null reference to the href attribute string, or null if
+ * setHref has not been called.
+ */
+ public String getHref() {
+ return m_href;
+ }
- /**
- * Get the base identifier with which this stylesheet is associated.
- *
- * @param baseIdent Should be a non-null reference to a valid URL string.
- */
- public void setHref(String baseIdent)
- {
- // Validate?
- m_href = baseIdent;
- }
+ /**
+ * Get the base identifier with which this stylesheet is associated.
+ *
+ * @param baseIdent
+ * Should be a non-null reference to a valid URL string.
+ */
+ public void setHref(String baseIdent) {
+ // Validate?
+ m_href = baseIdent;
+ }
- /**
- * Get the stylesheet type associated with an included stylesheet
- *
- * @return the type of the stylesheet
- */
- protected int getStylesheetType()
- {
- return StylesheetHandler.STYPE_INCLUDE;
- }
+ /**
+ * Get the stylesheet type associated with an included stylesheet
+ *
+ * @return the type of the stylesheet
+ */
+ protected int getStylesheetType() {
+ return StylesheetHandler.STYPE_INCLUDE;
+ }
- /**
- * Get the error number associated with this type of stylesheet including itself
- *
- * @return the appropriate error number
- */
- protected String getStylesheetInclErr()
- {
- return XSLTErrorResources.ER_STYLESHEET_INCLUDES_ITSELF;
- }
+ /**
+ * Get the error number associated with this type of stylesheet including
+ * itself
+ *
+ * @return the appropriate error number
+ */
+ protected String getStylesheetInclErr() {
+ return XSLTErrorResources.ER_STYLESHEET_INCLUDES_ITSELF;
+ }
- /**
- * Receive notification of the start of an xsl:include element.
- *
- * @param handler The calling StylesheetHandler/TemplatesBuilder.
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param rawName The raw XML 1.0 name (with prefix), or the
- * empty string if raw names are not available.
- * @param attributes The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- *
- * @throws org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- public void startElement(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Receive notification of the start of an xsl:include element.
+ *
+ * @param handler
+ * The calling StylesheetHandler/TemplatesBuilder.
+ * @param uri
+ * The Namespace URI, or the empty string if the element has no
+ * Namespace URI or if Namespace processing is not being
+ * performed.
+ * @param localName
+ * The local name (without prefix), or the empty string if
+ * Namespace processing is not being performed.
+ * @param rawName
+ * The raw XML 1.0 name (with prefix), or the empty string if raw
+ * names are not available.
+ * @param attributes
+ * The attributes attached to the element. If there are no
+ * attributes, it shall be an empty Attributes object.
+ *
+ * @throws org.xml.sax.SAXException
+ * Any SAX exception, possibly wrapping another exception.
+ */
+ @Override
+ public void startElement(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws org.xml.sax.SAXException {
+ setPropertiesFromAttributes(handler, rawName, attributes, this);
- setPropertiesFromAttributes(handler, rawName, attributes, this);
+ try {
+ String hrefUrl = SystemIDResolver.getAbsoluteURI(getHref(), handler
+ .getBaseIdentifier());
- try
- {
- String hrefUrl = SystemIDResolver.getAbsoluteURI(getHref(),
- handler.getBaseIdentifier());
+ if (handler.importStackContains(hrefUrl)) {
+ throw new org.xml.sax.SAXException(XSLMessages.createMessage(
+ getStylesheetInclErr(), new Object[] { hrefUrl })); // "(StylesheetHandler)
+ // "+hrefUrl+"
+ // is
+ // directly
+ // or
+ // indirectly
+ // importing
+ // itself!");
+ }
- if (handler.importStackContains(hrefUrl))
- {
- throw new org.xml.sax.SAXException(
- XSLMessages.createMessage(
- getStylesheetInclErr(), new Object[]{ hrefUrl })); //"(StylesheetHandler) "+hrefUrl+" is directly or indirectly importing itself!");
- }
+ handler.pushImportURL(hrefUrl);
- handler.pushImportURL(hrefUrl);
+ int savedStylesheetType = handler.getStylesheetType();
- int savedStylesheetType = handler.getStylesheetType();
+ handler.setStylesheetType(this.getStylesheetType());
+ handler.pushNewNamespaceSupport();
- handler.setStylesheetType(this.getStylesheetType());
- handler.pushNewNamespaceSupport();
+ try {
+ parse(handler, uri, localName, rawName, attributes);
+ } finally {
+ handler.setStylesheetType(savedStylesheetType);
+ handler.popImportURL();
+ handler.popNamespaceSupport();
+ }
+ } catch (TransformerException te) {
+ handler.error(te.getMessage(), te);
+ }
+ }
- try
- {
- parse(handler, uri, localName, rawName, attributes);
- }
- finally
- {
- handler.setStylesheetType(savedStylesheetType);
- handler.popImportURL();
- handler.popNamespaceSupport();
- }
- }
- catch(TransformerException te)
- {
- handler.error(te.getMessage(), te);
- }
- }
+ /**
+ * Set off a new parse for an included or imported stylesheet. This will set
+ * the {@link StylesheetHandler} to a new state, and recurse in with a new
+ * set of parse events. Once this function returns, the state of the
+ * StylesheetHandler should be restored.
+ *
+ * @param handler
+ * non-null reference to current StylesheetHandler that is
+ * constructing the Templates.
+ * @param uri
+ * The Namespace URI, which should be the XSLT namespace.
+ * @param localName
+ * The local name (without prefix), which should be "include" or
+ * "import".
+ * @param rawName
+ * The qualified name (with prefix).
+ * @param attributes
+ * The list of attributes on the xsl:include or xsl:import
+ * element.
+ *
+ * @throws org.xml.sax.SAXException
+ * Any SAX exception, possibly wrapping another exception.
+ */
+ protected void parse(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws org.xml.sax.SAXException {
+ TransformerFactoryImpl processor = handler.getStylesheetProcessor();
+ URIResolver uriresolver = processor.getURIResolver();
- /**
- * Set off a new parse for an included or imported stylesheet. This will
- * set the {@link StylesheetHandler} to a new state, and recurse in with
- * a new set of parse events. Once this function returns, the state of
- * the StylesheetHandler should be restored.
- *
- * @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
- * @param uri The Namespace URI, which should be the XSLT namespace.
- * @param localName The local name (without prefix), which should be "include" or "import".
- * @param rawName The qualified name (with prefix).
- * @param attributes The list of attributes on the xsl:include or xsl:import element.
- *
- * @throws org.xml.sax.SAXException Any SAX exception, possibly
- * wrapping another exception.
- */
- protected void parse(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws org.xml.sax.SAXException
- {
- TransformerFactoryImpl processor = handler.getStylesheetProcessor();
- URIResolver uriresolver = processor.getURIResolver();
+ try {
+ Source source = null;
- try
- {
- Source source = null;
+ if (null != uriresolver) {
+ source = uriresolver.resolve(getHref(), handler
+ .getBaseIdentifier());
- if (null != uriresolver)
- {
- source = uriresolver.resolve(getHref(),
- handler.getBaseIdentifier());
+ if (null != source && source instanceof DOMSource) {
+ Node node = ((DOMSource) source).getNode();
- if (null != source && source instanceof DOMSource)
- {
- Node node = ((DOMSource)source).getNode();
-
- String systemId = source.getSystemId();
- if (systemId == null)
- {
- systemId = SystemIDResolver.getAbsoluteURI(getHref(),
- handler.getBaseIdentifier());
-
- }
-
- TreeWalker walker = new TreeWalker(handler, new org.apache.xml.utils.DOM2Helper(), systemId);
+ String systemId = source.getSystemId();
+ if (systemId == null) {
+ systemId = SystemIDResolver.getAbsoluteURI(getHref(),
+ handler.getBaseIdentifier());
- try
- {
- walker.traverse(node);
- }
- catch(org.xml.sax.SAXException se)
- {
- throw new TransformerException(se);
- }
- return;
- }
- }
-
- if(null == source)
- {
- String absURL = SystemIDResolver.getAbsoluteURI(getHref(),
- handler.getBaseIdentifier());
+ }
- source = new StreamSource(absURL);
- }
-
- // possible callback to a class that over-rides this method.
- source = processSource(handler, source);
-
- XMLReader reader = null;
-
- if(source instanceof SAXSource)
- {
- SAXSource saxSource = (SAXSource)source;
- reader = saxSource.getXMLReader(); // may be null
- }
-
- InputSource inputSource = SAXSource.sourceToInputSource(source);
+ TreeWalker walker = new TreeWalker(handler,
+ new org.apache.xml.utils.DOM2Helper(), systemId);
- if (null == reader)
- {
- // Use JAXP1.1 ( if possible )
- try {
- javax.xml.parsers.SAXParserFactory factory=
- javax.xml.parsers.SAXParserFactory.newInstance();
- factory.setNamespaceAware( true );
-
- if (handler.getStylesheetProcessor().isSecureProcessing())
- {
- try
- {
- factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- }
- catch (org.xml.sax.SAXException se) {}
- }
-
- javax.xml.parsers.SAXParser jaxpParser=
- factory.newSAXParser();
- reader=jaxpParser.getXMLReader();
-
- } catch( javax.xml.parsers.ParserConfigurationException ex ) {
- throw new org.xml.sax.SAXException( ex );
- } catch( javax.xml.parsers.FactoryConfigurationError ex1 ) {
- throw new org.xml.sax.SAXException( ex1.toString() );
- }
- catch( NoSuchMethodError ex2 )
- {
- }
- catch (AbstractMethodError ame){}
- }
- if (null == reader)
- reader = XMLReaderFactory.createXMLReader();
+ try {
+ walker.traverse(node);
+ } catch (org.xml.sax.SAXException se) {
+ throw new TransformerException(se);
+ }
+ return;
+ }
+ }
- if (null != reader)
- {
- reader.setContentHandler(handler);
- handler.pushBaseIndentifier(inputSource.getSystemId());
+ if (null == source) {
+ String absURL = SystemIDResolver.getAbsoluteURI(getHref(),
+ handler.getBaseIdentifier());
- try
- {
- reader.parse(inputSource);
- }
- finally
- {
- handler.popBaseIndentifier();
- }
- }
- }
- catch (IOException ioe)
- {
- handler.error(XSLTErrorResources.ER_IOEXCEPTION,
- new Object[]{ getHref() }, ioe);
- }
- catch(TransformerException te)
- {
- handler.error(te.getMessage(), te);
- }
- }
+ source = new StreamSource(absURL);
+ }
- /**
- * This method does nothing, but a class that extends this class could
- * over-ride it and do some processing of the source.
- * @param handler The calling StylesheetHandler/TemplatesBuilder.
- * @param source The source of the included stylesheet.
- * @return the same or an equivalent source to what was passed in.
- */
- protected Source processSource(StylesheetHandler handler, Source source)
- {
- return source;
- }
+ // possible callback to a class that over-rides this method.
+ source = processSource(handler, source);
+
+ XMLReader reader = null;
+
+ if (source instanceof SAXSource) {
+ SAXSource saxSource = (SAXSource) source;
+ reader = saxSource.getXMLReader(); // may be null
+ }
+
+ InputSource inputSource = SAXSource.sourceToInputSource(source);
+
+ if (null == reader) {
+ // Use JAXP1.1 ( if possible )
+ try {
+ javax.xml.parsers.SAXParserFactory factory = javax.xml.parsers.SAXParserFactory
+ .newInstance();
+ factory.setNamespaceAware(true);
+
+ if (handler.getStylesheetProcessor().isSecureProcessing()) {
+ try {
+ factory.setFeature(
+ XMLConstants.FEATURE_SECURE_PROCESSING,
+ true);
+ } catch (org.xml.sax.SAXException se) {
+ }
+ }
+
+ javax.xml.parsers.SAXParser jaxpParser = factory
+ .newSAXParser();
+ reader = jaxpParser.getXMLReader();
+
+ } catch (javax.xml.parsers.ParserConfigurationException ex) {
+ throw new org.xml.sax.SAXException(ex);
+ } catch (javax.xml.parsers.FactoryConfigurationError ex1) {
+ throw new org.xml.sax.SAXException(ex1.toString());
+ } catch (NoSuchMethodError ex2) {
+ } catch (AbstractMethodError ame) {
+ }
+ }
+ if (null == reader)
+ reader = XMLReaderFactory.createXMLReader();
+
+ if (null != reader) {
+ reader.setContentHandler(handler);
+ handler.pushBaseIndentifier(inputSource.getSystemId());
+
+ try {
+ reader.parse(inputSource);
+ } finally {
+ handler.popBaseIndentifier();
+ }
+ }
+ } catch (IOException ioe) {
+ handler.error(XSLTErrorResources.ER_IOEXCEPTION,
+ new Object[] { getHref() }, ioe);
+ } catch (TransformerException te) {
+ handler.error(te.getMessage(), te);
+ }
+ }
+
+ /**
+ * This method does nothing, but a class that extends this class could
+ * over-ride it and do some processing of the source.
+ *
+ * @param handler
+ * The calling StylesheetHandler/TemplatesBuilder.
+ * @param source
+ * The source of the included stylesheet.
+ * @return the same or an equivalent source to what was passed in.
+ */
+ protected Source processSource(StylesheetHandler handler, Source source) {
+ return source;
+ }
}
diff --git a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorKey.java b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorKey.java
index e43baad..c6f8ba9 100644
--- a/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorKey.java
+++ b/bundles/org.eclipse.wst.xsl.core/src_validation/org/eclipse/wst/xsl/core/internal/compiler/xslt10/processor/ProcessorKey.java
@@ -26,7 +26,7 @@
* limitations under the License.
*/
/*
- * $Id: ProcessorKey.java,v 1.1 2008/03/27 01:08:55 dacarver Exp $
+ * $Id: ProcessorKey.java,v 1.2 2008/03/28 02:38:16 dacarver Exp $
*/
package org.eclipse.wst.xsl.core.internal.compiler.xslt10.processor;
@@ -41,127 +41,128 @@
/**
* TransformerFactory for xsl:key markup.
+ *
* <pre>
- * <!ELEMENT xsl:key EMPTY>
- * <!ATTLIST xsl:key
+ * <!ELEMENT xsl:key EMPTY>
+ * <!ATTLIST xsl:key
* name %qname; #REQUIRED
* match %pattern; #REQUIRED
* use %expr; #REQUIRED
- * >
+ * >
* </pre>
+ *
* @see <a href="http://www.w3.org/TR/xslt#dtd">XSLT DTD</a>
* @see <a href="http://www.w3.org/TR/xslt#key">key in XSLT Specification</a>
*/
-class ProcessorKey extends XSLTElementProcessor
-{
- static final long serialVersionUID = 4285205417566822979L;
+class ProcessorKey extends XSLTElementProcessor {
+ static final long serialVersionUID = 4285205417566822979L;
- /**
- * Receive notification of the start of an xsl:key element.
- *
- * @param handler The calling StylesheetHandler/TemplatesBuilder.
- * @param uri The Namespace URI, or the empty string if the
- * element has no Namespace URI or if Namespace
- * processing is not being performed.
- * @param localName The local name (without prefix), or the
- * empty string if Namespace processing is not being
- * performed.
- * @param rawName The raw XML 1.0 name (with prefix), or the
- * empty string if raw names are not available.
- * @param attributes The attributes attached to the element. If
- * there are no attributes, it shall be an empty
- * Attributes object.
- */
- public void startElement(
- StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Receive notification of the start of an xsl:key element.
+ *
+ * @param handler
+ * The calling StylesheetHandler/TemplatesBuilder.
+ * @param uri
+ * The Namespace URI, or the empty string if the element has no
+ * Namespace URI or if Namespace processing is not being
+ * performed.
+ * @param localName
+ * The local name (without prefix), or the empty string if
+ * Namespace processing is not being performed.
+ * @param rawName
+ * The raw XML 1.0 name (with prefix), or the empty string if raw
+ * names are not available.
+ * @param attributes
+ * The attributes attached to the element. If there are no
+ * attributes, it shall be an empty Attributes object.
+ */
+ @Override
+ public void startElement(StylesheetHandler handler, String uri,
+ String localName, String rawName, Attributes attributes)
+ throws org.xml.sax.SAXException {
- KeyDeclaration kd = new KeyDeclaration(handler.getStylesheet(), handler.nextUid());
+ KeyDeclaration kd = new KeyDeclaration(handler.getStylesheet(), handler
+ .nextUid());
- kd.setDOMBackPointer(handler.getOriginatingNode());
- kd.setLocaterInfo(handler.getLocator());
- setPropertiesFromAttributes(handler, rawName, attributes, kd);
- handler.getStylesheet().setKey(kd);
- }
+ kd.setDOMBackPointer(handler.getOriginatingNode());
+ kd.setLocaterInfo(handler.getLocator());
+ setPropertiesFromAttributes(handler, rawName, attributes, kd);
+ handler.getStylesheet().setKey(kd);
+ }
- /**
- * Set the properties of an object from the given attribute list.
- * @param handler The stylesheet's Content handler, needed for
- * error reporting.
- * @param rawName The raw name of the owner element, needed for
- * error reporting.
- * @param attributes The list of attributes.
- * @param target The target element where the properties will be set.
- */
- public void setPropertiesFromAttributes(
- StylesheetHandler handler, String rawName, Attributes attributes,
- ElemTemplateElement target)
- throws org.xml.sax.SAXException
- {
+ /**
+ * Set the properties of an object from the given attribute list.
+ *
+ * @param handler
+ * The stylesheet's Content handler, needed for error reporting.
+ * @param rawName
+ * The raw name of the owner element, needed for error reporting.
+ * @param attributes
+ * The list of attributes.
+ * @param target
+ * The target element where the properties will be set.
+ */
+ @Override
+ public void setPropertiesFromAttributes(StylesheetHandler handler,
+ String rawName, Attributes attributes, ElemTemplateElement target)
+ throws org.xml.sax.SAXException {
- XSLTElementDef def = getElemDef();
+ XSLTElementDef def = getElemDef();
- // Keep track of which XSLTAttributeDefs have been processed, so
- // I can see which default values need to be set.
- Vector processedDefs = new Vector();
- int nAttrs = attributes.