Package org.apache.xpath.objects

Examples of org.apache.xpath.objects.XString


    if (propName.equals("version") && result.length() > 0)
    {
      try
      {
        // Needs to return the version number of the spec we conform to.
        return new XString("1.0");
      }
      catch (Exception ex)
      {
        return new XString(result);
      }
    }
    else
      return new XString(result);
  }
View Full Code Here


    public double toNumber(org.w3c.dom.Node n)
    {
      // %REVIEW% You can't get much uglier than this...
      int nodeHandle = getDTMHandleFromNode(n);
      DTM dtm = getDTM(nodeHandle);
      XString xobj = (XString)dtm.getStringValue(nodeHandle);
      return xobj.num();
    }
View Full Code Here

      {
        value = (XObject) obj;
      }
      else if (obj instanceof String)
      {
        value = new XString((String) obj);
      }
      else if (obj instanceof Boolean)
      {
        value = new XBoolean(((Boolean) obj).booleanValue());
      }
      else if (obj instanceof Double)
      {
        value = new XNumber(((Double) obj).doubleValue());
      }
      else if (obj instanceof DocumentFragment)
      {
        int handle = xctxt.getDTMHandleFromNode((DocumentFragment)obj);
       
        value = new XRTreeFrag(handle, xctxt);
      }
      else if (obj instanceof DTM)
      {
        DTM dtm = (DTM)obj;
        DTMIterator iterator = new DescendantIterator();
        // %%ISSUE%% getDocument may not be valid for DTMs shared by multiple
        // document trees, eg RTFs. But in that case, we shouldn't be trying
        // to iterate over the whole DTM; we should be iterating over
        // dtm.getDocumentRoot(rootNodeHandle), and folks should have told us
        // this by passing a more appropriate type.
        iterator.setRoot(dtm.getDocument(), xctxt);
        value = new XNodeSet(iterator);
      }
      else if (obj instanceof DTMAxisIterator)
      {
        DTMAxisIterator iter = (DTMAxisIterator)obj;
        DTMIterator iterator = new OneStepIterator(iter, -1);
        value = new XNodeSet(iterator);
      }
      else if (obj instanceof DTMIterator)
      {
        value = new XNodeSet((DTMIterator) obj);
      }
      else if (obj instanceof NodeIterator)
      {
        value = new XNodeSet(new org.apache.xpath.NodeSetDTM(((NodeIterator)obj), xctxt));
      }
      else if (obj instanceof org.w3c.dom.Node)
      {
        value =
          new XNodeSet(xctxt.getDTMHandleFromNode((org.w3c.dom.Node) obj),
                       xctxt.getDTMManager());
      }
      else
      {
        value = new XString(obj.toString());
      }

      int type = value.getType();
      String s;
View Full Code Here

        if (lit.getDisableOutputEscaping() == false
                && lit.getDOMBackPointer() == null)
        {
          String str = lit.getNodeValue();
          XString xstr = new XString(str);

          varElem.m_firstChild = null;

          return new XPath(new XRTreeFragSelectWrapper(xstr));
        }
View Full Code Here

      // already made.
      int tokenQueuePos = m_queueMark - 1;

      m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos);

      Object obj = new XString(m_token.substring(1, last));

      m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos);

      // lit = m_token.substring(1, last);
      m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos);
View Full Code Here

        switch (op)
        {
          case OpCodes.OP_NEG :
            return new XNumber(- ((XObject) val).num());
          case OpCodes.OP_STRING :
            return new XString(((XObject) val).str());
          case OpCodes.OP_BOOL :
            return new XBoolean(((XObject) val).bool());
          case OpCodes.OP_NUMBER :
            return new XNumber(((XObject) val).num());
          default :
View Full Code Here

        else
        {
          return null;
        }
      }
      return new XString(sb.toString());
    }
View Full Code Here

      if (args.size() == 1)
      {
        Object o = args.get(0);
        if (o instanceof XObject)
        {
          return new XString(QueryEngine.normalizeString(((XObject) o).str()));
        }
      }
      return null;
    }
View Full Code Here

      if (args.size() == 1)
      {
        Object o = args.get(0);
        if (o instanceof XObject)
        {
          return new XString(((XObject) o).str());
        }
      }
      return null;
    }
View Full Code Here

        {
          int ipos = (int) ((XObject) pos).num() - 1;
          if (len != null)
          {
            int ilen = (int) ((XObject) len).num();
            return new XString(((XObject) o).str().substring(ipos, ipos + ilen));
          }
          else
            return new XString(((XObject) o).str().substring(ipos));
        }
      }
      return null;
    }
View Full Code Here

TOP

Related Classes of org.apache.xpath.objects.XString

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.