Package client.net.sf.saxon.ce.trans

Examples of client.net.sf.saxon.ce.trans.XPathException


        expression = visitor.typeCheck(expression, contextItemType);
        RoleLocator role = new RoleLocator(RoleLocator.FUNCTION, "key", 2);
        expression = TypeChecker.staticTypeCheck(expression, SequenceType.ATOMIC_SEQUENCE, false, role, visitor);
        keySet = visitor.getExecutable().getKeyManager().getKeyDefinitionSet(keyName);
        if (keySet == null) {
            XPathException err = new XPathException("Unknown key name " + keyName.getClarkName() + " in pattern");
            err.setErrorCode("XTDE1260");
            err.setLocator(this);
            err.setIsStaticError(true);
            throw err;
        }
        return this;
    }
View Full Code Here


        SequenceIterator iter = iterate();
        Item item = iter.next();
        if (item == null) {
            return null;
        } else if (iter.next() != null) {
            throw new XPathException("Attempting to access a sequence as a singleton item");
        } else {
            return item;
        }
    }
View Full Code Here

    throws XPathException {
        try {
            String[] parts = NameChecker.getQNameParts(Whitespace.trimWhitespace(lexicalName));
            String uri = resolver.getURIForPrefix(parts[0], useDefault);
            if (uri == null) {
                XPathException de = new XPathException("Namespace prefix '" + parts[0] + "' has not been declared");
                de.setErrorCode("FONS0004");
                throw de;
            }
            return new StructuredQName(parts[0], uri, parts[1]);
        } catch (QNameException e) {
            XPathException de = new XPathException(e.getMessage());
            de.setErrorCode("FOCA0002");
            throw de;
        }
    }
View Full Code Here

    public static String[] checkQNameParts(CharSequence qname) throws XPathException {
        try {
            String[] parts = getQNameParts(qname);
            if (parts[0].length() > 0 && !isValidNCName(parts[0])) {
                throw new XPathException("Invalid QName prefix " + Err.wrap(parts[0]));
            }
            return parts;
        } catch (QNameException e) {
            XPathException err = new XPathException(e.getMessage());
            err.setErrorCode("FORG0001");
            throw err;
        }
    }
View Full Code Here

                            depthOfHole = 1;
                            return;
                        }
                    }
                } catch (XPathException e) {
                    XPathException err = new XPathException("Error in use-when expression. " + e.getMessage());
                    err.setLocator(expr.getSourceLocator());
                    err.setErrorCodeQName(e.getErrorCodeQName());
                    getPipelineConfiguration().getErrorListener().error(err);
                    err.setHasBeenReported(true);
                    throw err;
                }
            }
            nextReceiver.startElement(nameCode, properties);
        } else {
View Full Code Here

          } else if (val instanceof HTMLNodeWrapper) {
              return ((HTMLNodeWrapper)val).getUnderlyingNode();
          } else if (val instanceof JSObjectValue) {
              return ((JSObjectValue)val).getJavaScriptObject();
          } else {
                throw new XPathException("Cannot convert " + val.getClass() + " to Javascript object");
            }
        } else {
            int seqLength = ((Value)val).getLength();
            if (seqLength == 0) {
                return null;
View Full Code Here

          JavaScriptObject jsArgs = jsArray(0);
          try {
            Object result = getValueFromTypeValuePair(jsCall(target, fnName, jsArgs));
            return convertFromJavaScript(result, context.getConfiguration());
          } catch(JavaScriptException jexc) {
            throw(new XPathException("JavaScriptException: " + jexc.getDescription() +
                "\noccurred on evaluating:\n" + script));
          }
    }
View Full Code Here

                      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 {
                  result = getValueFromTypeValuePair(jsSplitPropertyTypeAndValue(target, property));
                } catch(Exception e) {
                  throw(new XPathException("JavaScriptException in ixsl:get() for property: " + property));
                }
                return convertFromJavaScript(result, context.getConfiguration());           
          } else {
              throw(new XPathException("JavaScriptException in ixsl:get(): Get target object is null or undefined"));
          }
        } else if (localName.equals("page")) {
            return SingletonIterator.makeIterator(context.getConfiguration().getHostPage());
        } else if (localName.equals("source")) {
            return SingletonIterator.makeIterator(context.getController().getSourceNode());
        } else if (localName.equals("event")) {
            Event event = (Event)context.getController().getUserData("Saxon-CE", "current-event");
            return SingletonIterator.makeIterator(new JSObjectValue(event));
        } else if (localName.equals("parse-xml")) {
          String data = argument[0].evaluateAsString(context).toString();
          return convertFromJavaScript(XMLDOM.parseXML(data), context.getConfiguration());
        }else {
          // previously there was no warning - strictly - this should be caught at compile time
          logger.warning("No such IXSL function: '" + localName + "' - empty sequence returned");
          return EmptyIterator.getInstance();
        } // end of else
      } // end of try block
      catch(XPathException e) {
            e.maybeSetLocation(this.getSourceLocator());
            e.maybeSetContext(context);
            throw e;
      } catch(Exception e) {
        XPathException xe = new XPathException("Exception in ixsl:" + localName + "() " + e.getMessage());
            xe.maybeSetLocation(this.getSourceLocator());
            xe.maybeSetContext(context);
        throw xe;
      }

    }
View Full Code Here

        }
        String s = t.recentText(-1);
        String prefix = getLanguage() + " syntax error " +
                    (s.startsWith("...") ? "near" : "in") +
                    ' ' + Err.wrap(s) + ":\n    ";
        XPathException err = new XPathException(message);
        err.setAdditionalLocationText(prefix);
        err.setIsStaticError(true);
        err.setErrorCodeQName(errorCode);
        throw err;
    }
View Full Code Here

        if (fcall == null) {
            String msg = "Cannot find a matching " + arguments.length +
                    "-argument function named " + functionName.getClarkName() + "()";
            if (env.isInBackwardsCompatibleMode()) {
                // treat this as a dynamic error to be reported only if the function call is executed
                XPathException err = new XPathException(msg, "XTDE1425");
                ErrorExpression exp = new ErrorExpression(err);
                setLocation(exp);
                return exp;
            }
            grumble(msg, "XPST0017");
View Full Code Here

TOP

Related Classes of client.net.sf.saxon.ce.trans.XPathException

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.