Package client.net.sf.saxon.ce.om

Examples of client.net.sf.saxon.ce.om.ValueRepresentation


        }
        return found;
    }
   
    public TailCall processLeavingTail(XPathContext context) throws XPathException {
        ValueRepresentation content =
                ExpressionTool.evaluate(select, ExpressionTool.ITERATE_AND_MATERIALIZE, context, 1);
        String message = content.getStringValue();        
        boolean abort = false;
        if (terminate != null) {
            String term = terminate.evaluateAsString(context).toString();
            if (term.equals("no")) {
                // no action
View Full Code Here


    * only when the cardinality is zero or one. If the function is tail recursive,
    * it returns an Object representing the arguments to the next (recursive) call
    */

    public Item evaluateItem(XPathContext c) throws XPathException {
        ValueRepresentation val = callFunction(c);
        return Value.asItem(val);
    }
View Full Code Here

    * Call the function, returning an iterator over the results. (But if the function is
    * tail recursive, it returns an iterator over the arguments of the recursive call)
    */

    public SequenceIterator iterate(XPathContext c) throws XPathException {
        ValueRepresentation result = callFunction(c);
        return Value.getIterator(result);
    }
View Full Code Here

        } else if (localName.equals("eval")) {
          String script = argument[0].evaluateAsString(context).toString();
          return evaluateJsFunction(script, context);
         
        } else if (localName.equals("call")) {
          ValueRepresentation itemVal = (ValueRepresentation)argument[0].evaluateItem(context);
          JavaScriptObject target = (JavaScriptObject)convertToJavaScript(itemVal);
          if (target != null) {
              String method = argument[1].evaluateAsString(context).toString();
              JavaScriptObject jsArgs = jsArray(argument.length - 2);
              for (int i=2; i<argument.length; i++) {
                  ValueRepresentation val = SequenceExtent.makeSequenceExtent(argument[i].iterate(context));
                  jsSetArrayItem(jsArgs, i-2, convertToJavaScript(val));
              }
              // Issue: if following throws an exception - GWT doesn't always allow it to be caught - it's rethrown
              // as a GWT unhandled exception
              try {
                JavaScriptObject jsObj = jsCall(target, method, jsArgs);
                Object result = getValueFromTypeValuePair(jsObj);
                return convertFromJavaScript(result, context.getConfiguration());
              } catch(Exception e) {
                boolean doRetry = false;
               
                // try again setting any null values to zero-length arrays
                for (int i = 0; i < argument.length - 2; i++) {
                  if (jsGetArrayItem(jsArgs, i) == null) {
                    jsSetArrayItem(jsArgs, i, jsArray(0));
                    doRetry = true;
                  }
                }
                if (doRetry) {
                    try {
                      Object result = getValueFromTypeValuePair(jsCall(target, method, jsArgs));
                      return convertFromJavaScript(result, context.getConfiguration());
                    } catch(Exception e2) {}                 
                }
                // if we get this far then throw exception - recovery failed
                throw(new XPathException("JavaScriptException in ixsl:call(): Object does not support property or method '" +
                    method + "' with " + (argument.length - 2) + " argument(s)."));
              }
          } else {
              throw(new XPathException("JavaScriptException in ixsl:call(): Call target object is null or undefined"));
          }
        } else if (localName.equals("get")) {
          ValueRepresentation itemVal = (ValueRepresentation)argument[0].evaluateItem(context);
          JavaScriptObject target = (JavaScriptObject)convertToJavaScript(itemVal);
          if (target != null) {
                String property = argument[1].evaluateAsString(context).toString();
                Object result;
                try {
View Full Code Here

    public SequenceIterator iterate(XPathContext context) throws XPathException {
        final XPathContextMajor cm = (XPathContextMajor)context;
        while (true) {
            SequenceIterator iter = operand.iterate(cm);
            ValueRepresentation extent = SequenceExtent.makeSequenceExtent(iter);
            UserFunction fn = cm.getTailCallFunction();
            if (fn == null) {
                return Value.asIterator(extent);
            }
            if (fn != containingFunction) {
View Full Code Here

     * @throws XPathException if the variable is undefined
     */

    public SequenceIterator iterate(XPathContext c) throws XPathException {
        try {
            ValueRepresentation actual = evaluateVariable(c);
            return Value.getIterator(actual);
        } catch (XPathException err) {
            err.maybeSetLocation(getSourceLocator());
            throw err;
        } catch (AssertionError err) {
View Full Code Here

        }
    }

    public Item evaluateItem(XPathContext c) throws XPathException {
        try {
            ValueRepresentation actual = evaluateVariable(c);
            if (actual instanceof Item) {
                return (Item) actual;
            }
            return Value.asItem(actual);
        } catch (XPathException err) {
View Full Code Here

        }
    }

    public void process(XPathContext c) throws XPathException {
        try {
            ValueRepresentation actual = evaluateVariable(c);
            if (actual instanceof NodeInfo) {
                actual = new SingletonItem((NodeInfo) actual);
            }
            ((Value) actual).process(c);
        } catch (XPathException err) {
View Full Code Here

        if (startValue instanceof EmptySequence) {
            return EmptyIterator.getInstance();
        }

        ValueRepresentation filterValue = null;
        if (filter instanceof Literal) {
            filterValue = ((Literal)filter).getValue();
        } else if (filter instanceof VariableReference) {
            filterValue = ((VariableReference)filter).evaluateVariable(context);
        }
View Full Code Here

    */

    public Item evaluateItem(XPathContext context) throws XPathException {
        SequenceIterator forwards = operand.iterate(context);
        if ((forwards.getProperties() & SequenceIterator.GROUNDED) != 0) {
            ValueRepresentation repr = ((GroundedIterator)forwards).materialize();
            Value val = Value.asValue(repr);
            int length = val.getLength();
            return val.itemAt(length - 1);
        } else {
            Item current = null;
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.om.ValueRepresentation

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.