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


Java DTM类代码示例

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


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

示例1: setParser

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
public void setParser(Parser parser) {
    super.setParser(parser);
    // find all expressions in this Union
    final Vector components = new Vector();
    flatten(components);
    final int size = components.size();
    _components = (Expression[])components.toArray(new Expression[size]);
    for (int i = 0; i < size; i++) {
        _components[i].setParser(parser);
        _components[i].setParent(this);
        if (_components[i] instanceof Step) {
            final Step step = (Step)_components[i];
            final int axis = step.getAxis();
            final int type = step.getNodeType();
            // Put attribute iterators first
            if ((axis == Axis.ATTRIBUTE) || (type == DTM.ATTRIBUTE_NODE)) {
                _components[i] = _components[0];
                _components[0] = step;
            }
            // Check if the union contains a reverse iterator
    if (Axis.isReverse(axis)) _reverse = true;
        }
    }
    // No need to reverse anything if another expression lies on top of this
    if (getParent() instanceof Expression) _reverse = false;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:UnionPathExpr.java

示例2: getDTMIdentity

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Given a DTM, find the ID number in the DTM tables which addresses
 * the start of the document. If overflow addressing is in use, other
 * DTM IDs may also be assigned to this DTM.
 *
 * @param dtm The DTM which (hopefully) contains this node.
 *
 * @return The DTM ID (as the high bits of a NodeHandle, not as our
 * internal index), or -1 if the DTM doesn't belong to this manager.
 */
synchronized public int getDTMIdentity(DTM dtm)
{
      // Shortcut using DTMDefaultBase's extension hooks
      // %REVIEW% Should the lookup be part of the basic DTM API?
      if(dtm instanceof DTMDefaultBase)
      {
              DTMDefaultBase dtmdb=(DTMDefaultBase)dtm;
              if(dtmdb.getManager()==this)
                      return dtmdb.getDTMIDs().elementAt(0);
              else
                      return -1;
      }

  int n = m_dtms.length;

  for (int i = 0; i < n; i++)
  {
    DTM tdtm = m_dtms[i];

    if (tdtm == dtm && m_dtm_offsets[i]==0)
      return i << IDENT_DTM_NODE_BITS;
  }

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

示例3: getCurrentNode

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Return the last fetched node.  Needed to support the UnionPathIterator.
 *
 * @return the last fetched node.
 * @throws RuntimeException thrown if this NodeSetDTM is not of
 * a cached type, and thus doesn't permit indexed access.
 */
public int getCurrentNode()
{

  if (!m_cacheNodes)
    throw new RuntimeException(
      "This NodeSetDTM can not do indexing or counting functions!");

  int saved = m_next;
  // because nextNode always increments
  // But watch out for copy29, where the root iterator didn't
  // have nextNode called on it.
  int current = (m_next > 0) ? m_next-1 : m_next;
  int n = (current < m_firstFree) ? elementAt(current) : DTM.NULL;
  m_next = saved; // HACK: I think this is a bit of a hack.  -sb
  return n;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:NodeSetDTM.java

示例4: setRoot

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * @see DTMIterator#setRoot(int, Object)
 */
public void setRoot(int nodeHandle, Object environment)
{
      // If root is DTM.NULL, then something's wrong with the context
      if (nodeHandle == DTM.NULL)
      {
          throw new RuntimeException("Unable to evaluate expression using " +
                  "this context");
      }

      if(null != m_iter)
      {
              XPathContext xctxt = (XPathContext)environment;
              m_dtmMgr = xctxt.getDTMManager();
              m_iter.setRoot(nodeHandle, environment);
              if(!m_iter.isDocOrdered())
              {
                      if(!hasCache())
                              setShouldCacheNodes(true);
                      runTo(-1);
                      m_next=0;
              }
      }
      else
              assertion(false, "Can not setRoot on a non-iterated NodeSequence!");
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:29,代码来源:NodeSequence.java

示例5: setRoot

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Initialize the context values for this expression
 * after it is cloned.
 *
 * @param context The XPath runtime context for this
 * transformation.
 */
public void setRoot(int context, Object environment)
{

  m_context = context;

  XPathContext xctxt = (XPathContext)environment;
  m_execContext = xctxt;
  m_cdtm = xctxt.getDTM(context);

  m_currentContextNode = context; // only if top level?

  // Yech, shouldn't have to do this.  -sb
  if(null == m_prefixResolver)
      m_prefixResolver = xctxt.getNamespaceContext();

  m_lastFetched = DTM.NULL;
  m_foundLast = false;
  m_pos = 0;
  m_length = -1;

  if (m_isTopLevel)
    this.m_stackFrame = xctxt.getVarStack().getStackFrame();

  // reset();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:33,代码来源:LocPathIterator.java

示例6: getArg0AsNumber

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Execute the first argument expression that is expected to return a
 * number.  If the argument is null, then get the number value from the
 * current context node.
 *
 * @param xctxt Runtime XPath context.
 *
 * @return The number value of the first argument, or the number value of the
 *         current context node if the first argument is null.
 *
 * @throws javax.xml.transform.TransformerException if an error occurs while
 *                                   executing the argument expression.
 */
protected double getArg0AsNumber(XPathContext xctxt)
        throws javax.xml.transform.TransformerException
{

  if(null == m_arg0)
  {
    int currentNode = xctxt.getCurrentNode();
    if(DTM.NULL == currentNode)
      return 0;
    else
    {
      DTM dtm = xctxt.getDTM(currentNode);
      XMLString str = dtm.getStringValue(currentNode);
      return str.toDouble();
    }

  }
  else
    return m_arg0.execute(xctxt).num();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:34,代码来源:FunctionDef1Arg.java

示例7: execute

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的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

示例8: document

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Create a DTMAxisIterator for the newdom. This is currently only
 * used to create an iterator for the cached stylesheet DOM.
 *
 * @param newdom the cached stylesheet DOM
 * @param translet the translet
 * @param the main dom (should be a MultiDOM)
 * @return a DTMAxisIterator from the document root
 */
private static DTMAxisIterator document(DOM newdom,
                                        AbstractTranslet translet,
                                        DOM dom)
    throws Exception
{
    DTMManager dtmManager = ((MultiDOM)dom).getDTMManager();
    // Need to migrate the cached DTM to the new DTMManager
    if (dtmManager != null && newdom instanceof DTM) {
        ((DTM)newdom).migrateTo(dtmManager);
    }

    translet.prepassDocument(newdom);

    // Wrap the DOM object in a DOM adapter and add to multiplexer
    final DOMAdapter domAdapter = translet.makeDOMAdapter(newdom);
    ((MultiDOM)dom).addDOMAdapter(domAdapter);

    // Create index for any key elements
    translet.buildKeys(domAdapter, null, null,
                       newdom.getDocument());

    // Return a singleton iterator containing the root node
    return new SingletonIterator(newdom.getDocument(), true);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:LoadDocument.java

示例9: getNextAttributeIdentity

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * The optimized version of DTMDefaultBase.getNextAttributeIdentity(int).
 * <p>
 * Given a node identity for an attribute, advance to the next attribute.
 *
 * @param identity int identity of the attribute node.  This
 * <strong>must</strong> be an attribute node.
 *
 * @return int DTM node-identity of the resolved attr,
 * or DTM.NULL to indicate none exists.
 *
 */
protected int getNextAttributeIdentity(int identity) {
  // Assume that attributes and namespace nodes immediately follow the element
  while (true) {
    identity++;
    int type = _type2(identity);

    if (type == DTM.ATTRIBUTE_NODE) {
      return identity;
    } else if (type != DTM.NAMESPACE_NODE) {
      break;
    }
  }

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

示例10: setStartNode

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
public DTMAxisIterator setStartNode(int nodeHandle)
{
    int nodeID = getNodeIdent(nodeHandle);
    _startNode = nodeID;

    // Increase the node ID by 1 if self is not included.
    if (!_includeSelf && nodeID != DTM.NULL) {
        if (_direction == DIRECTION_DOWN)
            nodeID++;
        else if (_direction == DIRECTION_UP)
            nodeID--;
    }

    _currentNode = nodeID;
    return this;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:SimpleResultTreeImpl.java

示例11: rtf

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Cast result object to a result tree fragment.
 *
 * @param support XPath context to use for the conversion
 *
 * @return the objec as a result tree fragment.
 */
public int rtf(XPathContext support)
{

  int result = rtf();

  if (DTM.NULL == result)
  {
    DTM frag = support.createDocumentFragment();

    // %OPT%
    frag.appendTextChild(str());

    result = frag.getDocument();
  }

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

示例12: getReverseMapping

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Get mapping from external element/attribute types to DOM types
 */
public int[] getReverseMapping(String[] names, String[] uris, int[] types)
{
    int i;
    final int[] result = new int[names.length + DTM.NTYPES];

    // primitive types map to themselves
    for (i = 0; i < DTM.NTYPES; i++) {
        result[i] = i;
    }

    // caller's types map into appropriate dom types
    for (i = 0; i < names.length; i++) {
        int type = m_expandedNameTable.getExpandedTypeID(uris[i], names[i], types[i], true);
        result[i+DTM.NTYPES] = type;
    }
    return(result);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:21,代码来源:SAXImpl.java

示例13: getElementById

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Returns the <code>Element</code> whose <code>ID</code> is given by
 * <code>elementId</code>. If no such element exists, returns
 * <code>DTM.NULL</code>. Behavior is not defined if more than one element
 * has this <code>ID</code>. Attributes (including those
 * with the name "ID") are not of type ID unless so defined by DTD/Schema
 * information available to the DTM implementation.
 * Implementations that do not know whether attributes are of type ID or
 * not are expected to return <code>DTM.NULL</code>.
 *
 * <p>%REVIEW% Presumably IDs are still scoped to a single document,
 * and this operation searches only within a single document, right?
 * Wouldn't want collisions between DTMs in the same process.</p>
 *
 * @param elementId The unique <code>id</code> value for an element.
 * @return The handle of the matching element.
 */
public int getElementById(String elementId)
{

  Integer intObj;
  boolean isMore = true;

  do
  {
    intObj = m_idAttributes.get(elementId);

    if (null != intObj)
      return makeNodeHandle(intObj.intValue());

    if (!isMore || m_endDocumentOccured)
      break;

    isMore = nextNode();
  }
  while (null == intObj);

  return DTM.NULL;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:SAX2DTM.java

示例14: eval

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的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

示例15: next

import com.sun.org.apache.xml.internal.dtm.DTM; //导入依赖的package包/类
/**
 * Get the next node in the iteration.
 *
 * @return The next node handle in the iteration, or END.
 */
public int next() {
    if (_currentNode != DTM.NULL) {
        for (int node = (NOTPROCESSED == _currentNode)
                             ? _firstch(makeNodeIdentity(_startNode))
                             : _nextsib(_currentNode);
             node != END;
             node = _nextsib(node)) {
            int nodeHandle = makeNodeHandle(node);

            if (getNSType(nodeHandle) == _nsType) {
                _currentNode = node;

                return returnNode(nodeHandle);
            }
        }
    }

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


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