List of usage examples for javax.xml.namespace QName valueOf
public static QName valueOf(String qNameAsString)
From source file:org.xchain.framework.quartz.CommandJob.java
/** * <p>Gets the command name out of the JobExecutionContext's JobDataMap.</p> *///from w w w.j ava2 s.c o m private QName getCommandName(JobExecutionContext jobContext) throws JobExecutionException { JobDataMap dataMap = jobContext.getJobDetail().getJobDataMap(); // get the name of the command. String commandNameString = dataMap.getString(COMMAND_NAME); QName commandName = null; if (commandNameString == null) { throw new JobExecutionException( "The command name was not specified in the job data map key 'command'."); } try { commandName = QName.valueOf(commandNameString); } catch (Exception e) { throw new JobExecutionException("The command name '" + commandNameString + "' is not a valid QName.", e); } return commandName; }
From source file:org.xchain.framework.util.QNameConverter.java
public Object convert(Class type, Object value) { if (value == null) { return null; }/*from ww w . jav a 2 s . c o m*/ if (QName.class.isAssignableFrom(value.getClass())) { return value; } // if we are currently in an execution, then look up any prefixes based on the currently executing context. if (Execution.inExecution() && value instanceof String) { JXPathContext context = Execution.getLocalContext(); try { return JXPathContextUtil.stringToQName(context, (String) value); } catch (Exception e) { throw new ConversionException(e.getMessage(), e); } } else if (value instanceof String) { try { return QName.valueOf((String) value); } catch (Exception e) { throw new ConversionException("The string '" + value + "' could not be converted into a QName."); } } throw new ConversionException( "The object of type '" + value.getClass() + "' could not be converted to '" + QName.class + "'."); }
From source file:xquery4j.TestEvaluator.java
public XQueryEvaluator buildQueryEvaluator() { XQueryEvaluator evaluator = new XQueryEvaluator(); evaluator.setContextObject(this); evaluator.declareJavaClass("http://xmlbeans.apache.org/samples/xquery/employees", MyFunctions.class); evaluator.bindVariable(QName.valueOf("myVar"), 123); return evaluator; }