本文整理匯總了Java中org.apache.xalan.res.XSLMessages.createMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java XSLMessages.createMessage方法的具體用法?Java XSLMessages.createMessage怎麽用?Java XSLMessages.createMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.xalan.res.XSLMessages
的用法示例。
在下文中一共展示了XSLMessages.createMessage方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: StylesheetRoot
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Uses an XSL stylesheet document.
* @throws TransformerConfigurationException if the baseIdentifier can not be resolved to a URL.
*/
public StylesheetRoot(ErrorListener errorListener) throws TransformerConfigurationException
{
super(null);
setStylesheetRoot(this);
try
{
m_selectDefault = new XPath("node()", this, this, XPath.SELECT, errorListener);
initDefaultRule(errorListener);
}
catch (TransformerException se)
{
throw new TransformerConfigurationException(XSLMessages.createMessage(XSLTErrorResources.ER_CANNOT_INIT_DEFAULT_TEMPLATES, null), se); //"Can't init default templates!", se);
}
}
示例2: processPREFIX_URLLIST
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Process an attribute string of type T_URLLIST into
* a vector of prefixes that may be resolved to URLs.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value A list of whitespace delimited prefixes.
*
* @return A vector of strings that may be resolved to URLs.
*
* @throws org.xml.sax.SAXException if one of the prefixes can not be resolved.
*/
StringVector processPREFIX_URLLIST(
StylesheetHandler handler, String uri, String name, String rawName, String value)
throws org.xml.sax.SAXException
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
for (int i = 0; i < nStrings; i++)
{
String prefix = tokenizer.nextToken();
String url = handler.getNamespaceForPrefix(prefix);
if (url != null)
strings.addElement(url);
else
throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix}));
}
return strings;
}
示例3: getOutputProperty
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Get an output property that is in effect for the
* transformation. The property specified may be a property
* that was set with setOutputProperty, or it may be a
* property specified in the stylesheet.
*
* NEEDSDOC @param qnameString
*
* @return The string value of the output property, or null
* if no property was found.
*
* @throws IllegalArgumentException If the property is not supported.
*
* @see javax.xml.transform.OutputKeys
*/
public String getOutputProperty(String qnameString)
throws IllegalArgumentException
{
String value = null;
OutputProperties props = getOutputFormat();
value = props.getProperty(qnameString);
if (null == value)
{
if (!OutputProperties.isLegalPropertyKey(qnameString))
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_OUTPUT_PROPERTY_NOT_RECOGNIZED, new Object[]{qnameString})); //"output property not recognized: "
//+ qnameString);
}
return value;
}
示例4: execute
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Execute the function. The function must return
* a valid object.
* @param xctxt The current execution context.
* @return A valid XObject.
*
* @throws javax.xml.transform.TransformerException
*/
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
SubContextList subContextList = xctxt.getCurrentNodeList();
int currentNode = DTM.NULL;
if (null != subContextList) {
if (subContextList instanceof PredicatedNodeTest) {
LocPathIterator iter = ((PredicatedNodeTest)subContextList)
.getLocPathIterator();
currentNode = iter.getCurrentContextNode();
} else if(subContextList instanceof StepPattern) {
throw new RuntimeException(XSLMessages.createMessage(
XSLTErrorResources.ER_PROCESSOR_ERROR,null));
}
} else {
// not predicate => ContextNode == CurrentNode
currentNode = xctxt.getContextNode();
}
return new XNodeSet(currentNode, xctxt.getDTMManager());
}
示例5: setFeature
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* <p>Set a feature for this <code>TransformerFactory</code> and <code>Transformer</code>s
* or <code>Template</code>s created by this factory.</p>
*
* <p>
* Feature names are fully qualified {@link java.net.URI}s.
* Implementations may define their own features.
* An {@link TransformerConfigurationException} is thrown if this <code>TransformerFactory</code> or the
* <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
* It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
* </p>
*
* <p>See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.</p>
*
* @param name Feature name.
* @param value Is feature state <code>true</code> or <code>false</code>.
*
* @throws TransformerConfigurationException if this <code>TransformerFactory</code>
* or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
* @throws NullPointerException If the <code>name</code> parameter is null.
*/
public void setFeature(String name, boolean value)
throws TransformerConfigurationException {
// feature name cannot be null
if (name == null) {
throw new NullPointerException(
XSLMessages.createMessage(
XSLTErrorResources.ER_SET_FEATURE_NULL_NAME, null));
}
// secure processing?
if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
m_isSecureProcessing = value;
}
// This implementation does not support the setting of a feature other than
// the secure processing feature.
else
{
throw new TransformerConfigurationException(
XSLMessages.createMessage(
XSLTErrorResources.ER_UNSUPPORTED_FEATURE,
new Object[] {name}));
}
}
示例6: error
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param msg Message text to issue
* @param args Arguments to use in message
* @param e Exception to throw
* @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
* the error condition is severe enough to halt processing.
*
* @throws TransformerException
* @xsl.usage internal
*/
public void error(SourceLocator srcLctr, String msg, Object args[], Exception e) throws TransformerException
{
//msg = (null == msg) ? XSLTErrorResources.ER_PROCESSOR_ERROR : msg;
String formattedMsg = XSLMessages.createMessage(msg, args);
// Locator locator = m_stylesheetLocatorStack.isEmpty()
// ? null :
// ((Locator)m_stylesheetLocatorStack.peek());
// Locator locator = null;
ErrorListener errHandler = m_transformer.getErrorListener();
if (null != errHandler)
errHandler.fatalError(new TransformerException(formattedMsg, srcLctr));
else
throw new TransformerException(formattedMsg, srcLctr);
}
示例7: processPREFIX_LIST
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Process an attribute string of type T_PREFIXLIST into
* a vector of prefixes that may be resolved to URLs.
*
* @param handler non-null reference to current StylesheetHandler that is constructing the Templates.
* @param uri The Namespace URI, or an empty string.
* @param name The local name (without prefix), or empty string if not namespace processing.
* @param rawName The qualified name (with prefix).
* @param value A list of whitespace delimited prefixes.
*
* @return A vector of strings that may be resolved to URLs.
*
* @throws org.xml.sax.SAXException if one of the prefixes can not be resolved.
*/
StringVector processPREFIX_LIST(
StylesheetHandler handler, String uri, String name,
String rawName, String value) throws org.xml.sax.SAXException
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
for (int i = 0; i < nStrings; i++)
{
String prefix = tokenizer.nextToken();
String url = handler.getNamespaceForPrefix(prefix);
if (prefix.equals(Constants.ATTRVAL_DEFAULT_PREFIX) || url != null)
strings.addElement(prefix);
else
throw new org.xml.sax.SAXException(
XSLMessages.createMessage(
XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX,
new Object[] {prefix}));
}
return strings;
}
示例8: setContentHandler
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Set the content event handler.
*
* NEEDSDOC @param handler
* @throws java.lang.NullPointerException If the handler
* is null.
* @see org.xml.sax.XMLReader#setContentHandler
*/
public void setContentHandler(ContentHandler handler)
{
if (handler == null)
{
throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_CONTENT_HANDLER, null)); //"Null content handler");
}
else
{
m_outputContentHandler = handler;
if (null == m_serializationHandler)
{
ToXMLSAXHandler h = new ToXMLSAXHandler();
h.setContentHandler(handler);
h.setTransformer(this);
m_serializationHandler = h;
}
else
m_serializationHandler.setContentHandler(handler);
}
}
示例9: setupParse
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Set up before a parse.
*
* <p>Before every parse, check whether the parent is
* non-null, and re-register the filter for all of the
* events.</p>
*/
private void setupParse ()
{
XMLReader p = getParent();
if (p == null) {
throw new NullPointerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_PARENT_FOR_FILTER, null)); //"No parent for filter");
}
ContentHandler ch = m_transformer.getInputContentHandler();
// if(ch instanceof SourceTreeHandler)
// ((SourceTreeHandler)ch).setUseMultiThreading(true);
p.setContentHandler(ch);
p.setEntityResolver(this);
p.setDTDHandler(this);
p.setErrorHandler(this);
}
示例10: setResult
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Enables the user of the TransformerHandler to set the
* to set the Result for the transformation.
*
* @param result A Result instance, should not be null.
*
* @throws IllegalArgumentException if result is invalid for some reason.
*/
public void setResult(Result result) throws IllegalArgumentException
{
if (null == result)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_NULL, null)); //"result should not be null");
try
{
// ContentHandler handler =
// m_transformer.createResultContentHandler(result);
// m_transformer.setContentHandler(handler);
SerializationHandler xoh =
m_transformer.createSerializationHandler(result);
m_transformer.setSerializationHandler(xoh);
}
catch (javax.xml.transform.TransformerException te)
{
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_RESULT_COULD_NOT_BE_SET, null)); //"result could not be set");
}
m_result = result;
}
示例11: setErrorListener
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Set the error event listener.
*
* @param listener The new error listener.
* @throws IllegalArgumentException if
*/
public void setErrorListener(ErrorListener listener)
throws IllegalArgumentException
{
synchronized (m_reentryGuard)
{
if (listener == null)
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_NULL_ERROR_HANDLER, null)); //"Null error handler");
m_errorHandler = listener;
}
}
示例12: error
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Throw a template element runtime error. (Note: should we throw a TransformerException instead?)
*
* @param msg key of the error that occured.
* @param args Arguments to be used in the message
*/
public void error(String msg, Object[] args)
{
String themsg = XSLMessages.createMessage(msg, args);
throw new RuntimeException(XSLMessages.createMessage(
XSLTErrorResources.ER_ELEMTEMPLATEELEM_ERR,
new Object[]{ themsg }));
}
示例13: error
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Tell the user of an error, and probably throw an
* exception.
*
* @param xctxt The XPath runtime state.
* @param msg The error message key
* @param args Arguments to be used in the error message
* @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide
* the error condition is severe enough to halt processing.
*
* @throws javax.xml.transform.TransformerException
*/
public void error(XPathContext xctxt, String msg, Object args[])
throws javax.xml.transform.TransformerException
{
String formattedMsg = XSLMessages.createMessage(msg, args);
ErrorListener errHandler = xctxt.getErrorListener();
TransformerException spe = new TransformerException(formattedMsg,
(SourceLocator)xctxt.getSAXLocator());
if (null != errHandler)
errHandler.error(spe);
else
System.out.println(formattedMsg);
}
示例14: throwDOMException
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* Throw a DOMException
*
* @param msg key of the error that occured.
*/
public void throwDOMException(short code, String msg)
{
String themsg = XSLMessages.createMessage(msg, null);
throw new DOMException(code, themsg);
}
示例15: getElemFromExpression
import org.apache.xalan.res.XSLMessages; //導入方法依賴的package包/類
/**
* From an XPath expression component, get the ElemTemplateElement
* owner.
*
* @param expr Should be static expression with proper parentage.
* @return Valid ElemTemplateElement, or throw a runtime exception
* if it is not found.
*/
protected ElemTemplateElement getElemFromExpression(Expression expr)
{
ExpressionNode parent = expr.exprGetParent();
while(null != parent)
{
if(parent instanceof ElemTemplateElement)
return (ElemTemplateElement)parent;
parent = parent.exprGetParent();
}
throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_ASSERT_NO_TEMPLATE_PARENT, null));
// "Programmer's error! expr has no ElemTemplateElement parent!");
}