org.apache.xpath.objects.XObject.create()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(13.2k)|赞(0)|评价(0)|浏览(98)

本文整理了Java中org.apache.xpath.objects.XObject.create()方法的一些代码示例,展示了XObject.create()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XObject.create()方法的具体详情如下:
包路径:org.apache.xpath.objects.XObject
类名称:XObject
方法名:create

XObject.create介绍

[英]Create the right XObject based on the type of the object passed. This function can not make an XObject that exposes DOM Nodes, NodeLists, and NodeIterators to the XSLT stylesheet as node-sets.
[中]根据传递的对象类型创建右XObject。此函数不能生成将DOM节点、节点列表和节点编辑器作为节点集公开给XSLT样式表的XObject。

代码示例

代码示例来源:origin: robovm/robovm

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: robovm/robovm

replaceOrPushUserParam(new QName(s1), XObject.create(value, getXPathContext()));
setParameter(s1, null, value);
replaceOrPushUserParam(new QName(s1, s2), XObject.create(value, getXPathContext()));
setParameter(s2, s1, value);

代码示例来源:origin: xalan/xalan

replaceOrPushUserParam(new QName(s1), XObject.create(value, getXPathContext()));
setParameter(s1, null, value);
replaceOrPushUserParam(new QName(s1, s2), XObject.create(value, getXPathContext()));
setParameter(s2, s1, value);

代码示例来源:origin: xalan/xalan

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: robovm/robovm

result = XObject.create(val, xctxt);

代码示例来源:origin: xalan/xalan

result = XObject.create(val, xctxt);

代码示例来源:origin: robovm/robovm

/**
 * Set a parameter for the templates.
 * 
 * @param name The name of the parameter.
 * @param namespace The namespace of the parameter.
 * @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, String namespace, Object value)
{
 VariableStack varstack = getXPathContext().getVarStack();
 QName qname = new QName(namespace, name);
 XObject xobject = XObject.create(value, getXPathContext());
 
 StylesheetRoot sroot = m_stylesheetRoot;
 Vector vars = sroot.getVariablesAndParamsComposed();
 int i = vars.size();
 while (--i >= 0)
 {
  ElemVariable variable = (ElemVariable)vars.elementAt(i);
  if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && 
    variable.getName().equals(qname))
  {
    varstack.setGlobalVariable(i, xobject);
  }
 }
}

代码示例来源:origin: xalan/xalan

/**
 * Set a parameter for the templates.
 * 
 * @param name The name of the parameter.
 * @param namespace The namespace of the parameter.
 * @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, String namespace, Object value)
{
 VariableStack varstack = getXPathContext().getVarStack();
 QName qname = new QName(namespace, name);
 XObject xobject = XObject.create(value, getXPathContext());
 
 StylesheetRoot sroot = m_stylesheetRoot;
 Vector vars = sroot.getVariablesAndParamsComposed();
 int i = vars.size();
 while (--i >= 0)
 {
  ElemVariable variable = (ElemVariable)vars.elementAt(i);
  if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && 
    variable.getName().equals(qname))
  {
    varstack.setGlobalVariable(i, xobject);
  }
 }
}

代码示例来源:origin: xalan/xalan

methodArgs[i] =  XObject.create(args.get(i));

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: org.apache.xalan/com.springsource.org.apache.xalan

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: org.apache.karaf.bundles/org.apache.karaf.bundles.xalan-2.7.1

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: ibinti/bugvm

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: MobiVM/robovm

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: com.gluonhq/robovm-rt

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: com.bugvm/bugvm-rt

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan

public XObject getVariableOrParam(XPathContext xctxt, QName qname)
  throws TransformerException,IllegalArgumentException {
  if ( qname == null ) {
    //JAXP 1.3 spec says that if variable name is null then 
    // we need to through IllegalArgumentException
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_ARG_CANNOT_BE_NULL,
      new Object[] {"Variable qname"} );
    throw new IllegalArgumentException( fmsg );
  }
javax.xml.namespace.QName name =
  new javax.xml.namespace.QName(
      qname.getNamespace(),
      qname.getLocalPart());
  Object varValue = resolver.resolveVariable( name );        
  if ( varValue == null ) {
    String fmsg = XSLMessages.createXPATHMessage( 
      XPATHErrorResources.ER_RESOLVE_VARIABLE_RETURNS_NULL,
      new Object[] { name.toString()} );
    throw new TransformerException( fmsg );
  } 
  return XObject.create( varValue, xctxt );
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan

/**
 * Set a parameter for the templates.
 * 
 * @param name The name of the parameter.
 * @param namespace The namespace of the parameter.
 * @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, String namespace, Object value)
{
 VariableStack varstack = getXPathContext().getVarStack();
 QName qname = new QName(namespace, name);
 XObject xobject = XObject.create(value, getXPathContext());
 
 StylesheetRoot sroot = m_stylesheetRoot;
 Vector vars = sroot.getVariablesAndParamsComposed();
 int i = vars.size();
 while (--i >= 0)
 {
  ElemVariable variable = (ElemVariable)vars.elementAt(i);
  if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && 
    variable.getName().equals(qname))
  {
    varstack.setGlobalVariable(i, xobject);
  }
 }
}

代码示例来源:origin: MobiVM/robovm

/**
 * Set a parameter for the templates.
 * 
 * @param name The name of the parameter.
 * @param namespace The namespace of the parameter.
 * @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, String namespace, Object value)
{
 VariableStack varstack = getXPathContext().getVarStack();
 QName qname = new QName(namespace, name);
 XObject xobject = XObject.create(value, getXPathContext());
 
 StylesheetRoot sroot = m_stylesheetRoot;
 Vector vars = sroot.getVariablesAndParamsComposed();
 int i = vars.size();
 while (--i >= 0)
 {
  ElemVariable variable = (ElemVariable)vars.elementAt(i);
  if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && 
    variable.getName().equals(qname))
  {
    varstack.setGlobalVariable(i, xobject);
  }
 }
}

代码示例来源:origin: ibinti/bugvm

/**
 * Set a parameter for the templates.
 * 
 * @param name The name of the parameter.
 * @param namespace The namespace of the parameter.
 * @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, String namespace, Object value)
{
 VariableStack varstack = getXPathContext().getVarStack();
 QName qname = new QName(namespace, name);
 XObject xobject = XObject.create(value, getXPathContext());
 
 StylesheetRoot sroot = m_stylesheetRoot;
 Vector vars = sroot.getVariablesAndParamsComposed();
 int i = vars.size();
 while (--i >= 0)
 {
  ElemVariable variable = (ElemVariable)vars.elementAt(i);
  if(variable.getXSLToken() == Constants.ELEMNAME_PARAMVARIABLE && 
    variable.getName().equals(qname))
  {
    varstack.setGlobalVariable(i, xobject);
  }
 }
}

相关文章