Package org.apache.xml.dtm

Examples of org.apache.xml.dtm.DTMAxisIterator


     * nodes are taken, while 'ns' specifies the namespace URI type.
     */
    public DTMAxisIterator getNamespaceAxisIterator(int axis, int ns)
    {

        DTMAxisIterator iterator = null;

        if (ns == NO_TYPE) {
            return EMPTYITERATOR;
        }
        else {
View Full Code Here


    /**
     * Returns the nth descendant of a node
     */
    public DTMAxisIterator getNthDescendant(int type, int n, boolean includeself)
    {
        DTMAxisIterator source = (DTMAxisIterator) new TypedDescendantIterator(type);
        return new NthDescendantIterator(n);
    }
View Full Code Here

         *
         * @return a deep copy of this iterator.
         */
        public DTMAxisIterator cloneIterator() {
            try {
                DTMAxisIterator nestedClone = m_baseIterator.cloneIterator();
                NamespaceWildcardIterator clone =
                    (NamespaceWildcardIterator) super.clone();

                clone.m_baseIterator = nestedClone;
                clone.m_nsType = m_nsType;
View Full Code Here

  }
  else if (obj instanceof String) {
      return stringToReal((String) obj);
  }
  else if (obj instanceof DTMAxisIterator) {
      DTMAxisIterator iter = (DTMAxisIterator) obj;
      return stringToReal(dom.getStringValueX(iter.reset().next()));
  }
  else if (obj instanceof Node) {
      return stringToReal(dom.getStringValueX(((Node) obj).node));
  }
  else if (obj instanceof DOM) {
View Full Code Here

  }
  else if (obj instanceof String) {
      return !((String) obj).equals(EMPTYSTRING);
  }
  else if (obj instanceof DTMAxisIterator) {
      DTMAxisIterator iter = (DTMAxisIterator) obj;
      return iter.reset().next() != DTMAxisIterator.END;
  }
  else if (obj instanceof Node) {
      return true;
  }
  else if (obj instanceof DOM) {
View Full Code Here

    return result;
      }

      // Next, node-set/t for t in {real, string, node-set, result-tree}

      DTMAxisIterator iter = ((DTMAxisIterator)left).reset();

      if (right instanceof DTMAxisIterator) {
    result = compare(iter, (DTMAxisIterator)right, op, dom);
      }
      else if (right instanceof String) {
    result = compare(iter, (String)right, op, dom);
     
      else if (right instanceof Number) {
    final double temp = ((Number)right).doubleValue();
    result = compare(iter, temp, op, dom);
      }
      else if (right instanceof Boolean) {
    boolean temp = ((Boolean)right).booleanValue();
    result = (iter.reset().next() != DTMAxisIterator.END) == temp;
      }
      else if (right instanceof DOM) {
    result = compare(iter, ((DOM)right).getStringValue(),
         op, dom);
      }
View Full Code Here

    /**
     * Utility function: used to convert reference to org.w3c.dom.NodeList.
     */
    public static NodeList referenceToNodeList(Object obj, DOM dom) {
        if (obj instanceof Node || obj instanceof DTMAxisIterator) {
            DTMAxisIterator iter = referenceToNodeSet(obj);
            return dom.makeNodeList(iter);
        }
        else if (obj instanceof DOM) {
          dom = (DOM)obj;
          return dom.makeNodeList(DTMDefaultBase.ROOTNODE);
View Full Code Here

    /**
     * Utility function: used to convert reference to org.w3c.dom.Node.
     */
    public static org.w3c.dom.Node referenceToNode(Object obj, DOM dom) {
        if (obj instanceof Node || obj instanceof DTMAxisIterator) {
            DTMAxisIterator iter = referenceToNodeSet(obj);
            return dom.makeNode(iter);
        }
        else if (obj instanceof DOM) {
          dom = (DOM)obj;
          DTMAxisIterator iter = dom.getChildren(DTMDefaultBase.ROOTNODE);
          return dom.makeNode(iter);
        }
  else {
      final String className = obj.getClass().getName();
      runTimeError(DATA_CONVERSION_ERR, className, "org.w3c.dom.Node");
View Full Code Here

         + nodeType);
      }
  }

        // w3cDOM -> DTM -> DOMImpl
  DTMAxisIterator iter = null, childIter = null, attrIter = null;
  if (doc != null) {
      final MultiDOM multiDOM = (MultiDOM) dom;
      DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false,
                null, true, false);
      // Create DOMAdapter and register with MultiDOM
      DOMAdapter domAdapter = new DOMAdapter(idom,
                translet.getNamesArray(),
                translet.getUrisArray(),
                translet.getTypesArray(),
    translet.getNamespaceArray());
            multiDOM.addDOMAdapter(domAdapter);

      DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD);
      DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD);
            iter = new AbsoluteIterator(
                new StepIterator(iter1, iter2));

       iter.setStartNode(DTMDefaultBase.ROOTNODE);

      childIter = idom.getAxisIterator(Axis.CHILD);
      attrIter = idom.getAxisIterator(Axis.ATTRIBUTE);
  }

  // Second pass: find DTM handles for every node in the list.
  int[] dtmHandles = new int[n];
  n = 0;
  for (int i = 0; i < nodeList.getLength(); ++i) {
      if (proxyNodes[i] != DTM.NULL) {
    dtmHandles[n++] = proxyNodes[i];
    continue;
      }
      org.w3c.dom.Node node = nodeList.item(i);
      DTMAxisIterator iter3 = null;
      int nodeType = node.getNodeType();
      switch (nodeType) {
    case org.w3c.dom.Node.ELEMENT_NODE:
    case org.w3c.dom.Node.TEXT_NODE:
    case org.w3c.dom.Node.CDATA_SECTION_NODE:
    case org.w3c.dom.Node.COMMENT_NODE:
    case org.w3c.dom.Node.ENTITY_REFERENCE_NODE:
    case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
        iter3 = childIter;
        break;
    case org.w3c.dom.Node.ATTRIBUTE_NODE:
        iter3 = attrIter;
        break;
    default:
        // Should not happen, as first run should have got all these
        throw new InternalRuntimeError("Mismatched cases");
      }
      if (iter3 != null) {
    iter3.setStartNode(iter.next());
    dtmHandles[n] = iter3.next();
    // For now, play it self and perform extra checks:
    if (dtmHandles[n] == DTMAxisIterator.END)
        throw new InternalRuntimeError("Expected element missing at " + i);
    if (iter3.next() != DTMAxisIterator.END)
        throw new InternalRuntimeError("Too many elements at " + i);
    ++n;
      }
  }
  if (n != dtmHandles.length)
View Full Code Here

          int node,
          DOM dom) {
  try {
      if (obj instanceof DTMAxisIterator)
      {
    DTMAxisIterator iter = (DTMAxisIterator) obj;
    dom.copy(iter.reset(), handler);
      }
      else if (obj instanceof Node) {
    dom.copy(((Node) obj).node, handler);
      }
      else if (obj instanceof DOM) {
View Full Code Here

TOP

Related Classes of org.apache.xml.dtm.DTMAxisIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.