当前位置: 首页>>代码示例>>Java>>正文


Java XObject类代码示例

本文整理汇总了Java中com.sun.org.apache.xpath.internal.objects.XObject的典型用法代码示例。如果您正苦于以下问题:Java XObject类的具体用法?Java XObject怎么用?Java XObject使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


XObject类属于com.sun.org.apache.xpath.internal.objects包,在下文中一共展示了XObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Execute this pattern step, including predicates.
 *
 *
 * @param xctxt XPath runtime context.
 * @param currentNode The current node context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt, int currentNode)
        throws javax.xml.transform.TransformerException
{

  DTM dtm = xctxt.getDTM(currentNode);

  if (dtm != null)
  {
    int expType = dtm.getExpandedTypeID(currentNode);

    return execute(xctxt, currentNode, dtm, expType);
  }

  return NodeTest.SCORE_NONE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:StepPattern.java

示例2: getMatchScore

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Get the match score of the given node.
 *
 * @param xctxt The XPath runtime context.
 * @param context The node to be tested.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
public double getMatchScore(XPathContext xctxt, int context)
        throws javax.xml.transform.TransformerException
{

  xctxt.pushCurrentNode(context);
  xctxt.pushCurrentExpressionNode(context);

  try
  {
    XObject score = execute(xctxt);

    return score.num();
  }
  finally
  {
    xctxt.popCurrentNode();
    xctxt.popCurrentExpressionNode();
  }

  // return XPath.MATCH_SCORE_NONE;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:36,代码来源:StepPattern.java

示例3: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的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
{

  int context = getArg0AsNode(xctxt);
  XObject val;

  if (DTM.NULL != context)
  {
    DTM dtm = xctxt.getDTM(context);
    String qname = dtm.getNodeNameX(context);
    val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
  }
  else
  {
    val = XString.EMPTYSTRING;
  }

  return val;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:FuncQname.java

示例4: executeCharsToContentHandler

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Execute an expression in the XPath runtime context, and return the
 * result of the expression.
 *
 *
 * @param xctxt The XPath runtime context.
 *
 * @return The result of the expression in the form of a <code>XObject</code>.
 *
 * @throws javax.xml.transform.TransformerException if a runtime exception
 *         occurs.
 */
public void executeCharsToContentHandler(XPathContext xctxt,
                                            ContentHandler handler)
  throws javax.xml.transform.TransformerException,
         org.xml.sax.SAXException
{
  if(Arg0IsNodesetExpr())
  {
    int node = getArg0AsNode(xctxt);
    if(DTM.NULL != node)
    {
      DTM dtm = xctxt.getDTM(node);
      dtm.dispatchCharactersEvents(node, handler, true);
    }
  }
  else
  {
    XObject obj = execute(xctxt);
    obj.dispatchCharactersEvents(handler);
  }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:33,代码来源:FuncNormalizeSpace.java

示例5: eval

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
private XObject eval ( Object contextItem )
        throws javax.xml.transform.TransformerException {
    com.sun.org.apache.xpath.internal.XPathContext xpathSupport = null;
    if ( functionResolver != null ) {
        JAXPExtensionsProvider jep = new JAXPExtensionsProvider(
                functionResolver, featureSecureProcessing, featureManager );
        xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext( jep );
    } else {
        xpathSupport = new com.sun.org.apache.xpath.internal.XPathContext();
    }

    xpathSupport.setVarStack(new JAXPVariableStack(variableResolver));
    XObject xobj = null;

    Node contextNode = (Node)contextItem;
    // We always need to have a ContextNode with Xalan XPath implementation
    // To allow simple expression evaluation like 1+1 we are setting
    // dummy Document as Context Node

    if ( contextNode == null )
        xobj = xpath.execute(xpathSupport, DTM.NULL, prefixResolver);
    else
        xobj = xpath.execute(xpathSupport, contextNode, prefixResolver);

    return xobj;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:XPathExpressionImpl.java

示例6: getTypeFromXObject

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
   * Given an XObject, determine the corresponding DOM XPath type
   *
   * @return type string
   */
  private short getTypeFromXObject(XObject object) {
      switch (object.getType()) {
        case XObject.CLASS_BOOLEAN: return BOOLEAN_TYPE;
        case XObject.CLASS_NODESET: return UNORDERED_NODE_ITERATOR_TYPE;
        case XObject.CLASS_NUMBER: return NUMBER_TYPE;
        case XObject.CLASS_STRING: return STRING_TYPE;
        // XPath 2.0 types
//          case XObject.CLASS_DATE:
//          case XObject.CLASS_DATETIME:
//          case XObject.CLASS_DTDURATION:
//          case XObject.CLASS_GDAY:
//          case XObject.CLASS_GMONTH:
//          case XObject.CLASS_GMONTHDAY:
//          case XObject.CLASS_GYEAR:
//          case XObject.CLASS_GYEARMONTH:
//          case XObject.CLASS_TIME:
//          case XObject.CLASS_YMDURATION: return STRING_TYPE; // treat all date types as strings?

        case XObject.CLASS_RTREEFRAG: return UNORDERED_NODE_ITERATOR_TYPE;
        case XObject.CLASS_NULL: return ANY_TYPE; // throw exception ?
        default: return ANY_TYPE; // throw exception ?
    }

  }
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:XPathResultImpl.java

示例7: getLocalVariable

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Get a local variable or parameter in the current stack frame.
 *
 *
 * @param xctxt The XPath context, which must be passed in order to
 * lazy evaluate variables.
 *
 * @param index Local variable index relative to the current stack
 * frame bottom.
 *
 * @return The value of the variable.
 *
 * @throws TransformerException
 */
public XObject getLocalVariable(XPathContext xctxt, int index, boolean destructiveOK)
        throws TransformerException
{

  index += _currentFrameBottom;

  XObject val = _stackFrames[index];

  if(null == val)
    throw new TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VARIABLE_ACCESSED_BEFORE_BIND, null),
                   xctxt.getSAXLocator());
    // "Variable accessed before it is bound!", xctxt.getSAXLocator());

  // Lazy execution of variables.
  if (val.getType() == XObject.CLASS_UNRESOLVEDVARIABLE)
    return (_stackFrames[index] = val.execute(xctxt));

  return destructiveOK ? val : val.getFresh();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:VariableStack.java

示例8: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的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());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:30,代码来源:FuncCurrent.java

示例9: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的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
{

  int which = getArg0AsNode(xctxt);

  if (DTM.NULL != which)
  {
    // Note that this is a different value than in previous releases
    // of Xalan. It's sensitive to the exact encoding of the node
    // handle anyway, so fighting to maintain backward compatability
    // really didn't make sense; it may change again as we continue
    // to experiment with balancing document and node numbers within
    // that value.
    return new XString("N" + Integer.toHexString(which).toUpperCase());
  }
  else
    return XString.EMPTYSTRING;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:FuncGenerateId.java

示例10: evaluateExpression

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
@Override
public <T>T evaluateExpression(Object item, Class<T> type)
    throws XPathExpressionException {
    isSupportedClassType(type);

    try {
        XObject resultObject = eval(item, xpath);
        if (type.isAssignableFrom(XPathEvaluationResult.class)) {
            return getXPathResult(resultObject, type);
        } else {
            return XPathResultImpl.getValue(resultObject, type);
        }

    } catch (javax.xml.transform.TransformerException te) {
        throw new XPathExpressionException(te);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:XPathExpressionImpl.java

示例11: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的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
{

  StringBuffer sb = new StringBuffer();

  // Compiler says we must have at least two arguments.
  sb.append(m_arg0.execute(xctxt).str());
  sb.append(m_arg1.execute(xctxt).str());

  if (null != m_arg2)
    sb.append(m_arg2.execute(xctxt).str());

  if (null != m_args)
  {
    for (int i = 0; i < m_args.length; i++)
    {
      sb.append(m_args[i].execute(xctxt).str());
    }
  }

  return new XString(sb.toString());
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:FuncConcat.java

示例12: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Execute a binary operation by calling execute on each of the operands,
 * and then calling the operate method on the derived class.
 *
 *
 * @param xctxt The runtime execution context.
 *
 * @return The XObject result of the operation.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  XObject left = m_left.execute(xctxt, true);
  XObject right = m_right.execute(xctxt, true);

  XObject result = operate(left, right);
  left.detach();
  right.detach();
  return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:Operation.java

示例13: link

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Allocates memory (called a stackframe) on the stack; used to store
 * local variables and parameter arguments.
 *
 * <p>I use the link/unlink concept because of distant
 * <a href="http://math.millikin.edu/mprogers/Courses/currentCourses/CS481-ComputerArchitecture/cs481.Motorola68000.html">
 * Motorola 68000 assembler</a> memories.</p>
 *
 * @param size The size of the stack frame allocation.  This ammount should
 * normally be the maximum number of variables that you can have allocated
 * at one time in the new stack frame.
 *
 * @return The bottom of the stack frame, from where local variable addressing
 * should start from.
 */
public int link(final int size)
{

  _currentFrameBottom = _frameTop;
  _frameTop += size;

  if (_frameTop >= _stackFrames.length)
  {
    XObject newsf[] = new XObject[_stackFrames.length + XPathContext.RECURSIONLIMIT + size];

    System.arraycopy(_stackFrames, 0, newsf, 0, _stackFrames.length);

    _stackFrames = newsf;
  }

  if (_linksTop + 1 >= _links.length)
  {
    int newlinks[] = new int[_links.length + (CLEARLIMITATION * 2)];

    System.arraycopy(_links, 0, newlinks, 0, _links.length);

    _links = newlinks;
  }

  _links[_linksTop++] = _currentFrameBottom;

  return _currentFrameBottom;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:44,代码来源:VariableStack.java

示例14: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的package包/类
/**
 * Test a node to see if it matches the given node test.
 *
 * @param xctxt XPath runtime context.
 *
 * @return {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NODETEST},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NONE},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_NSWILD},
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_QNAME}, or
 *         {@link com.sun.org.apache.xpath.internal.patterns.NodeTest#SCORE_OTHER}.
 *
 * @throws javax.xml.transform.TransformerException
 */
public XObject execute(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  int context = xctxt.getCurrentNode();
  DTMIterator nl = m_functionExpr.asIterator(xctxt, context);
  XNumber score = SCORE_NONE;

  if (null != nl)
  {
    int n;

    while (DTM.NULL != (n = nl.nextNode()))
    {
      score = (n == context) ? SCORE_OTHER : SCORE_NONE;

      if (score == SCORE_OTHER)
      {
        context = n;

        break;
      }
    }

    nl.detach();
  }

  return score;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:FunctionPattern.java

示例15: execute

import com.sun.org.apache.xpath.internal.objects.XObject; //导入依赖的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
{

  int context = getArg0AsNode(xctxt);

  String s;
  if(context != DTM.NULL)
  {
    DTM dtm = xctxt.getDTM(context);
    int t = dtm.getNodeType(context);
    if(t == DTM.ELEMENT_NODE)
    {
      s = dtm.getNamespaceURI(context);
    }
    else if(t == DTM.ATTRIBUTE_NODE)
    {

      // This function always returns an empty string for namespace nodes.
      // We check for those here.  Fix inspired by Davanum Srinivas.

      s = dtm.getNodeName(context);
      if(s.startsWith("xmlns:") || s.equals("xmlns"))
        return XString.EMPTYSTRING;

      s = dtm.getNamespaceURI(context);
    }
    else
      return XString.EMPTYSTRING;
  }
  else
    return XString.EMPTYSTRING;

  return ((null == s) ? XString.EMPTYSTRING : new XString(s));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:43,代码来源:FuncNamespace.java


注:本文中的com.sun.org.apache.xpath.internal.objects.XObject类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。