Difference between revisions of "XQuery Errors"

From BaseX Documentation
Jump to navigation Jump to search
Line 65: Line 65:
 
|<code>XQST0032</code>
 
|<code>XQST0032</code>
 
| The base URI was declared more than once.
 
| The base URI was declared more than once.
|<code>declare base-uri "a";<br/>declare base-uri "b"; ()</code>
+
|<code>declare base-uri ...</code>
 
|- valign="top" scope="row"
 
|- valign="top" scope="row"
 
|<code>XQST0033</code>
 
|<code>XQST0033</code>
Line 77: Line 77:
 
|<code>XQST0038</code>
 
|<code>XQST0038</code>
 
| The default collation was declared more than once.
 
| The default collation was declared more than once.
|<code>declare default collation "a";<br/>declare default collation "b"; ()</code>
+
|<code>declare default collation ...</code>
 
|- valign="top" scope="row"
 
|- valign="top" scope="row"
 
|<code>XQST0039</code>
 
|<code>XQST0039</code>
Line 93: Line 93:
 
|<code>XQST0047</code>
 
|<code>XQST0047</code>
 
| A module was defined more than once.
 
| A module was defined more than once.
|<code>import module "uri";<br/>import module "uri"; 1</code>
+
|<code>import module ...</code>
 
|- valign="top" scope="row"
 
|- valign="top" scope="row"
 
|<code>XQST0048</code>
 
|<code>XQST0048</code>
Line 102: Line 102:
 
| A global variable was declared more than once.
 
| A global variable was declared more than once.
 
|<code>declare variable $a := 1;<br/>declare variable $a := 1; $a</code>
 
|<code>declare variable $a := 1;<br/>declare variable $a := 1; $a</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0054</code>
 +
| A global variable depends on itself. This may be triggered by a circular variable definition.
 +
|<code>declare variable $a := local:a();<br/>declare function local:a() { $a }; $a</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0055</code>
 +
| The mode for copying namespaces was declared more than once.
 +
|<code>declare copy-namespaces ...</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0057</code>
 +
| The namespace of a schema import may not be empty.
 +
|<code>import schema ""; ()</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0059</code>
 +
| The schema or module with the specified namespace cannot be found or processed.
 +
|<code>import module "unknown"; ()</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0060</code>
 +
| A user-defined function has no namespace.
 +
|<code>declare default function namespace "";<br/>declare function x() { 1 }; 1</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0065</code>
 +
| The ordering mode was declared more than once.
 +
|<code>declare ordering ...</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0065</code>
 +
| The default namespace mode for elements or functions was declared more than once.
 +
|<code>declare default element namespace ...</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0067</code>
 +
| The construction mode was declared more than once.
 +
|<code>declare construction ...</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0068</code>
 +
| The mode for handling boundary spaces was declared more than once.
 +
|<code>declare boundary-space ...</code>
 +
|- valign="top" scope="row"
 +
|<code>XQST0069</code>
 +
| The default order for empty sequences was declared more than once.
 +
|<code>declare default order empty ...</code>
 
|}
 
|}
  

Revision as of 14:30, 29 January 2011

This article is part of the Query Portal. It summarizes all error codes that may be thrown by the BaseX XQuery processor.

As the official specifications are written too formal to be easily understood, we tried our best to make this article comprehensible to everyone. The following tables include the error code that is raised by BaseX, a description, and examples of queries raising that error.

XPST: Static XPath Errors

Code Description Examples
XPST0003 An error occurred while parsing the query string (i.e., before the query could be compiled and executed). This error is the most common one, and may be accompanied by a variety of different error messages. 1+
for i in //* return $i
XPST0005 An expression will never results, no matter what input will be processed. doc('input')/..
XPST0008 A variable or type name is used that has not been defined in the current scope. $a---
element(*, x)
XPST0017 • The specified function is unknown, or
• it uses the wrong number of arguments.
fn:unknown()
fn:count(1,2,3)
XPST0051 An unknown QName is used in a sequence type (e.g. in the target type of the cast expression). 1 instance of x
"test" cast as xs:itr
XPST0080 xs:NOTATION or xs:anyAtomicType is used as target type of cast or castable. 1 castable as xs:NOTATION
XPST0081 • A QName uses a prefix that has not been bound to any namespace, or
• A pragma or option declaration has not been prefixed.
unknown:x
(# pragma #) { 1 }

XQST: Static XQuery Errors

Code Description Examples
XQST0009 The query imports a schema (schema import is not supported by BaseX). import schema "x"; ()
XQST0022 Namespace values must be constant strings. <elem xmlns="{ 'dynamic' }"/>
XQST0031 The specified XQuery version is not specified. xquery version "9.9"; ()
XQST0032 The base URI was declared more than once. declare base-uri ...
XQST0033 A namespace prefix was declared more than once. declare namespace a="a";
declare namespace a="b"; ()
XQST0034 A function was declared more than once. declare function local:a() { 1 };
declare function local:a() { 2 };
local:a()
XQST0038 The default collation was declared more than once. declare default collation ...
XQST0039 Two or more parameters in a user-defined function have the same name. declare function local:fun($a, $a) { $a * $a };
local:fun(1,2)
XQDY0040 Two or more attributes in an element have the same node name. <elem a="1" a="12"/>
XQDY0045 A user-defined function uses a reserved namespace. declare function fn:fun() { 1 }; ()
XQST0047 A module was defined more than once. import module ...
XQST0048 A module declaration does not match the namespace of the specified module. import module namespace invalid="uri"; 1
XQST0049 A global variable was declared more than once. declare variable $a := 1;
declare variable $a := 1; $a
XQST0054 A global variable depends on itself. This may be triggered by a circular variable definition. declare variable $a := local:a();
declare function local:a() { $a }; $a
XQST0055 The mode for copying namespaces was declared more than once. declare copy-namespaces ...
XQST0057 The namespace of a schema import may not be empty. import schema ""; ()
XQST0059 The schema or module with the specified namespace cannot be found or processed. import module "unknown"; ()
XQST0060 A user-defined function has no namespace. declare default function namespace "";
declare function x() { 1 }; 1
XQST0065 The ordering mode was declared more than once. declare ordering ...
XQST0065 The default namespace mode for elements or functions was declared more than once. declare default element namespace ...
XQST0067 The construction mode was declared more than once. declare construction ...
XQST0068 The mode for handling boundary spaces was declared more than once. declare boundary-space ...
XQST0069 The default order for empty sequences was declared more than once. declare default order empty ...

XPTY: Type Errors

Code Description Examples
XPTY0004 This error is raised if an expression has the wrong type, or cannot be cast into the specified type. It may be raised both statically (during query compilation) or dynamically (at runtime). 1 + "A"
fn:abs("a")
1 cast as xs:gYear
XPTY0018 The result of the last step in a path expression contains both nodes and atomic values. doc('input.xml')/(*, 1)
XPTY0019 The result of a step (other than the last step) in a path expression contains an atomic values. (1 to 10)/*

XPDY: Dynamic XPath Errors

Code Description Examples
XPDY0002 • No value has been defined for an external variable, or
• no context item has been set before the query was executed.
declare variable $x external; $x
descendant::*
XPDY0050 • The operand type of a treat expression does not match the type of the argument, or
• the root of the context item must be a document node.
"string" treat as xs:int
"string"[/]

XQDY: Dynamic XQuery Errors

Code Description Examples
XQDY0025 Two or more attributes in a constructed element have the same node name. element x { attribute a { "" } attribute a { "" } }
XQDY0026 The content of a computed processing instruction contains "?>". processing-instruction pi { "?>" }
XQDY0041 The name of a processing instruction is invalid. processing-instruction { "1" } { "" }
XQDY0043 The node name of an attribute uses certain pre-defined prefixes or namespaces. attribute xmlns { "etc" }
XQDY0064 The name of a processing instruction equals "XML" (case insensitive). processing-instruction xml { "etc" }
XQDY0072 The content of a computed comment contains "--" or ends with "-". comment { "one -- two" }
XQDY0074 The name of a computed attribute or element is invalid, or uses an unbound prefix. element { "x y" } { "" }
XQDY0095 A sequence with more than one item was bound to a group by clause. let $a := (1,2) group by $a return $a
XQDY0096 The node name of an element uses certain pre-defined prefixes or namespaces. element { fn:QName("uri", "xml:n") } {}

In Progress

Code Description Examples