- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中net.sf.saxon.sxpath.XPathVariable.getVariableQName()
方法的一些代码示例,展示了XPathVariable.getVariableQName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XPathVariable.getVariableQName()
方法的具体详情如下:
包路径:net.sf.saxon.sxpath.XPathVariable
类名称:XPathVariable
方法名:getVariableQName
[英]Get the name of the variable as a QNameValue.
[中]获取变量的名称作为QNameValue。
代码示例来源:origin: pmd/pmd
/**
* Attempt to create a dynamic context on which to evaluate the {@link #xpathExpression}.
*
* @param elementNode the node on which to create the context; generally this node is the root node of the Saxon
* Tree
* @return the dynamic context on which to run the query
* @throws XPathException if the supplied value does not conform to the required type of the
* variable, when setting up the dynamic context; or if the supplied value contains a node that does not belong to
* this Configuration (or another Configuration that shares the same namePool)
*/
private XPathDynamicContext createDynamicContext(final ElementNode elementNode) throws XPathException {
final XPathDynamicContext dynamicContext = xpathExpression.createDynamicContext(elementNode);
// Set variable values on the dynamic context
for (final XPathVariable xpathVariable : xpathVariables) {
final String variableName = xpathVariable.getVariableQName().getLocalName();
for (final Map.Entry<PropertyDescriptor<?>, Object> entry : super.properties.entrySet()) {
if (variableName.equals(entry.getKey().name())) {
final ValueRepresentation valueRepresentation = getRepresentation(entry.getKey(), entry.getValue());
dynamicContext.setVariable(xpathVariable, valueRepresentation);
}
}
}
return dynamicContext;
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
public QName next() {
return new QName(((XPathVariable) varIterator.next()).getVariableQName());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
public QName next() {
return new QName(((XPathVariable) varIterator.next()).getVariableQName());
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Load the compiled XPath expression to prepare it for execution.
*
* @return An XPathSelector. The returned XPathSelector can be used to set up the
* dynamic context, and then to evaluate the expression.
*/
public XPathSelector load() {
Map<StructuredQName, XPathVariable> declaredVariables = new LinkedHashMap<StructuredQName, XPathVariable>();
for (Iterator iter = env.iterateExternalVariables(); iter.hasNext(); ) {
XPathVariable var = (XPathVariable) iter.next();
declaredVariables.put(var.getVariableQName(), var);
}
return new XPathSelector(exp, declaredVariables);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Load the compiled XPath expression to prepare it for execution.
*
* @return An XPathSelector. The returned XPathSelector can be used to set up the
* dynamic context, and then to evaluate the expression.
*/
public XPathSelector load() {
Map<StructuredQName, XPathVariable> declaredVariables = new LinkedHashMap<StructuredQName, XPathVariable>();
for (Iterator iter = env.iterateExternalVariables(); iter.hasNext(); ) {
XPathVariable var = (XPathVariable) iter.next();
declaredVariables.put(var.getVariableQName(), var);
}
return new XPathSelector(exp, declaredVariables);
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Get a Stack Frame Map containing definitions of all the declared variables. This will return a newly
* created object that the caller is free to modify by adding additional variables, without affecting
* the static context itself.
*/
public SlotManager getStackFrameMap() {
SlotManager map = getConfiguration().makeSlotManager();
for (Iterator v = variables.values().iterator(); v.hasNext();) {
XPathVariable var = (XPathVariable)v.next();
map.allocateSlotNumber(var.getVariableQName());
}
return map;
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Get a Stack Frame Map containing definitions of all the declared variables. This will return a newly
* created object that the caller is free to modify by adding additional variables, without affecting
* the static context itself.
*/
public SlotManager getStackFrameMap() {
SlotManager map = getConfiguration().makeSlotManager();
XPathVariable[] va = new XPathVariable[variables.size()];
for (Iterator v = variables.values().iterator(); v.hasNext();) {
XPathVariable var = (XPathVariable)v.next();
va[var.getLocalSlotNumber()] = var;
}
for (int i=0; i<va.length; i++) {
map.allocateSlotNumber(va[i].getVariableQName());
}
return map;
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Declare a variable. A variable must be declared before an expression referring
* to it is compiled. The initial value of the variable will be the empty sequence
* @param namespaceURI The namespace URI of the name of the variable. Supply "" to represent
* names in no namespace (null is also accepted)
* @param localName The local part of the name of the variable (an NCName)
* @return an XPathVariable object representing information about the variable that has been
* declared.
*/
public XPathVariable declareVariable(String namespaceURI, String localName) {
XPathVariable var = XPathVariable.make(new StructuredQName("", namespaceURI, localName));
StructuredQName qName = var.getVariableQName();
int slot = variables.size();
var.setSlotNumber(slot);
variables.put(qName, var);
return var;
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Declare a variable. A variable must be declared before an expression referring
* to it is compiled. The initial value of the variable will be the empty sequence
* @param namespaceURI The namespace URI of the name of the variable. Supply "" to represent
* names in no namespace (null is also accepted)
* @param localName The local part of the name of the variable (an NCName)
* @return an XPathVariable object representing information about the variable that has been
* declared.
*/
public XPathVariable declareVariable(String namespaceURI, String localName) {
XPathVariable var = XPathVariable.make(new StructuredQName("", namespaceURI, localName));
StructuredQName qName = var.getVariableQName();
int slot = variables.size();
var.setSlotNumber(slot);
variables.put(qName, var);
return var;
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Get a Stack Frame Map containing definitions of all the declared variables. This will return a newly
* created object that the caller is free to modify by adding additional variables, without affecting
* the static context itself.
*/
public SlotManager getStackFrameMap() {
SlotManager map = getConfiguration().makeSlotManager();
XPathVariable[] va = new XPathVariable[variables.size()];
for (XPathVariable var : variables.values()) {
va[var.getLocalSlotNumber()] = var;
}
for (XPathVariable v : va) {
map.allocateSlotNumber(v.getVariableQName());
}
return map;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
/**
* Get a Stack Frame Map containing definitions of all the declared variables. This will return a newly
* created object that the caller is free to modify by adding additional variables, without affecting
* the static context itself.
*/
public SlotManager getStackFrameMap() {
SlotManager map = getConfiguration().makeSlotManager();
XPathVariable[] va = new XPathVariable[variables.size()];
for (XPathVariable var : variables.values()) {
va[var.getLocalSlotNumber()] = var;
}
for (XPathVariable v : va) {
map.allocateSlotNumber(v.getVariableQName());
}
return map;
}
代码示例来源:origin: net.sourceforge.pmd/pmd-core
/**
* Attempt to create a dynamic context on which to evaluate the {@link #xpathExpression}.
*
* @param elementNode the node on which to create the context; generally this node is the root node of the Saxon
* Tree
* @return the dynamic context on which to run the query
* @throws XPathException if the supplied value does not conform to the required type of the
* variable, when setting up the dynamic context; or if the supplied value contains a node that does not belong to
* this Configuration (or another Configuration that shares the same namePool)
*/
private XPathDynamicContext createDynamicContext(final ElementNode elementNode) throws XPathException {
final XPathDynamicContext dynamicContext = xpathExpression.createDynamicContext(elementNode);
// Set variable values on the dynamic context
for (final XPathVariable xpathVariable : xpathVariables) {
final String variableName = xpathVariable.getVariableQName().getLocalName();
for (final Map.Entry<PropertyDescriptor<?>, Object> entry : super.properties.entrySet()) {
if (variableName.equals(entry.getKey().name())) {
final ValueRepresentation valueRepresentation = getRepresentation(entry.getKey(), entry.getValue());
dynamicContext.setVariable(xpathVariable, valueRepresentation);
}
}
}
return dynamicContext;
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
private XPathExecutable internalCompile(String source) throws SaxonApiException {
try {
env.getDecimalFormatManager().checkConsistency();
} catch (net.sf.saxon.trans.XPathException e) {
throw new SaxonApiException(e);
}
XPathEvaluator eval = evaluator;
IndependentContext ic = env;
if (ic.isAllowUndeclaredVariables()) {
// self-declaring variables modify the static context. The XPathCompiler must not change state
// as the result of compiling an expression, so we need to copy the static context.
eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
ic = new IndependentContext(env);
eval.setStaticContext(ic);
for (Iterator iter = env.iterateExternalVariables(); iter.hasNext(); ) {
XPathVariable var = (XPathVariable) iter.next();
XPathVariable var2 = ic.declareVariable(var.getVariableQName());
var2.setRequiredType(var.getRequiredType());
}
}
try {
XPathExpression cexp = eval.createExpression(source);
return new XPathExecutable(cexp, processor, ic);
} catch (XPathException e) {
throw new SaxonApiException(e);
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
private XPathExecutable internalCompile(String source) throws SaxonApiException {
try {
env.getDecimalFormatManager().checkConsistency();
} catch (net.sf.saxon.trans.XPathException e) {
throw new SaxonApiException(e);
}
XPathEvaluator eval = evaluator;
IndependentContext ic = env;
if (ic.isAllowUndeclaredVariables()) {
// self-declaring variables modify the static context. The XPathCompiler must not change state
// as the result of compiling an expression, so we need to copy the static context.
eval = new XPathEvaluator(processor.getUnderlyingConfiguration());
ic = new IndependentContext(env);
eval.setStaticContext(ic);
for (Iterator iter = env.iterateExternalVariables(); iter.hasNext(); ) {
XPathVariable var = (XPathVariable) iter.next();
XPathVariable var2 = ic.declareVariable(var.getVariableQName());
var2.setRequiredType(var.getRequiredType());
}
}
try {
XPathExpression cexp = eval.createExpression(source);
return new XPathExecutable(cexp, processor, ic);
} catch (XPathException e) {
throw new SaxonApiException(e);
}
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Set the value of a variable
*
* @param name The name of the variable. This must match the name of a variable
* that was declared to the XPathCompiler. No error occurs if the expression does not
* actually reference a variable with this name.
* @param value The value to be given to the variable.
* @throws SaxonApiException if the variable has not been declared or if the type of the value
* supplied does not conform to the required type that was specified when the variable was declared
*/
public void setVariable(QName name, XdmValue value) throws SaxonApiException {
XPathVariable var = null;
for (XPathVariable v : declaredVariables) {
if (v.getVariableQName().equals(name.getStructuredQName())) {
var = v;
break;
}
}
if (var == null) {
throw new SaxonApiException(
new XPathException("Variable has not been declared: " + name));
}
try {
dynamicContext.setVariable(var, value.getUnderlyingValue());
} catch (XPathException e) {
throw new SaxonApiException(e);
}
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
StructuredQName expectedName = slot >= stackFrameMap.getNumberOfVariables() ? null :
stackFrameMap.getVariableMap().get(slot);
if (!variable.getVariableQName().equals(expectedName)) {
throw new XPathException(
"Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context");
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.saxon
StructuredQName expectedName = slot >= stackFrameMap.getNumberOfVariables() ? null :
stackFrameMap.getVariableMap().get(slot);
if (!variable.getVariableQName().equals(expectedName)) {
throw new XPathException(
"Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context");
代码示例来源:origin: net.sourceforge.saxon/saxon
StructuredQName expectedName = (slot >= stackFrameMap.getNumberOfVariables() ? null :
(StructuredQName)stackFrameMap.getVariableMap().get(slot));
if (!variable.getVariableQName().equals(expectedName)) {
throw new XPathException(
"Supplied XPathVariable is bound to the wrong slot: perhaps it was created using a different static context");
代码示例来源:origin: org.daisy.libs/com.xmlcalabash
while (variables.hasNext()) {
XPathVariable var = variables.next();
QName name = new QName(var.getVariableQName().toJaxpQName());
dynamicContext.setVariable(var, globals.get(name).getStringValue());
本文整理了Java中net.sf.saxon.sxpath.XPathVariable.getVariableQName()方法的一些代码示例,展示了XPathVariable.getVariable
我是一名优秀的程序员,十分优秀!