use of org.apache.xml.utils.QName in project robovm by robovm.
the class TransformerImpl method setParameter.
/**
* Set a parameter for the transformation.
*
* @param name The name of the parameter,
* which may have a namespace URI.
* @param value The value object. This can be any valid Java object
* -- it's up to the processor to provide the proper
* coersion to the object, or simply pass it on for use
* in extensions.
*/
public void setParameter(String name, Object value) {
if (value == null) {
throw new IllegalArgumentException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_SET_PARAM_VALUE, new Object[] { name }));
}
StringTokenizer tokenizer = new StringTokenizer(name, "{}", false);
try {
// The first string might be the namespace, or it might be
// the local name, if the namespace is null.
String s1 = tokenizer.nextToken();
String s2 = tokenizer.hasMoreTokens() ? tokenizer.nextToken() : null;
if (null == m_userParams)
m_userParams = new Vector();
if (null == s2) {
replaceOrPushUserParam(new QName(s1), XObject.create(value, getXPathContext()));
setParameter(s1, null, value);
} else {
replaceOrPushUserParam(new QName(s1, s2), XObject.create(value, getXPathContext()));
setParameter(s2, s1, value);
}
} catch (java.util.NoSuchElementException nsee) {
// Should throw some sort of an error.
}
}
Aggregations