Difference between revisions of "XQuery Errors"
Jump to navigation
Jump to search
Line 280: | Line 280: | ||
|- valign="top" scope="row" | |- valign="top" scope="row" | ||
|<code>FOAR0002</code> | |<code>FOAR0002</code> | ||
− | | A | + | | A numeric declaration or operation causes an over- or underflow. |
− | |<code>xs:double("-INF") idiv 1</code> | + | |<code>12345678901234567890<hr/>xs:double("-INF") idiv 1</code> |
|- | |- | ||
| colspan=3 | | | colspan=3 | | ||
Line 288: | Line 288: | ||
| • A float number cannot be converted to <code>xs:decimal</code> or <code>xs:integer</code>, or<br />• a QName in a function has the wrong lexical value. | | • A float number cannot be converted to <code>xs:decimal</code> or <code>xs:integer</code>, or<br />• a QName in a function has the wrong lexical value. | ||
|<code>xs:int(xs:double("INF"))<hr/>QName("", "el em")</code> | |<code>xs:int(xs:double("INF"))<hr/>QName("", "el em")</code> | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FOCA0003</code> | ||
+ | | A value is too large to be represented as integer. | ||
+ | |<code>xs:integer(99e100)</code> | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FOCA0005</code> | ||
+ | | <code>"NaN"</code> is supplied to duration operations. | ||
+ | |<code>xs:yearMonthDuration("P1Y") * xs:double("NaN")</code> | ||
+ | |- | ||
+ | | colspan=3 | | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FOCH0001</code> | ||
+ | | A codepoint was specified that does not represent a valid XML character. | ||
+ | |<code>codepoints-to-string(0)</code> | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FOCH0002</code> | ||
+ | | A unsupported collation was specified in a function. | ||
+ | |<code>compare('a', 'a', 'unknown')</code> | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FOCH0003</code> | ||
+ | | A unsupported normalization form was specified in a function. | ||
+ | |<code>normalize-unicode('a', 'unknown')</code> | ||
+ | |- | ||
+ | | colspan=3 | | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FODC0001</code> | ||
+ | | The root of an argument specified in <code>fn:id()</code> or <code>fn:idref()</code> must have a document node as root. | ||
+ | |<code>id("id0", <xml/>)</code> | ||
+ | |- valign="top" scope="row" | ||
+ | |<code>FODC0002</code> | ||
+ | | The specified document or collection cannot be retrieved. | ||
+ | |<code>doc("unknown.xml")</code> | ||
|} | |} | ||
− | Still in | + | Still in progress… |
Revision as of 16:05, 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.
Contents
Static Errors: XSPT, XQST
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+
|
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---
|
XQST0009
|
The query imports a schema (schema import is not supported by BaseX). | import schema "x"; ()
|
XPST0017
|
• The specified function is unknown, or • it uses the wrong number of arguments. |
fn:unknown()
|
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";
|
XQST0034
|
A function was declared more than once. | declare function local:a() { 1 };
|
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 };
|
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
|
XPST0051
|
An unknown QName is used in a sequence type (e.g. in the target type of the cast expression).
|
1 instance of x
|
XQST0049
|
A global variable was declared more than once. | declare variable $a := 1;
|
XQST0054
|
A global variable depends on itself. This may be triggered by a circular variable definition. | declare variable $a := local: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 "";
|
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 ...
|
XQST0070
|
A namespace declaration overwrites a reserved namespace. | declare namespace xml=""; ()
|
XQST0071
|
A namespace is declared more than once in an element constructor. | <a xmlns="uri1" xmlns="uri2"/>
|
XQST0075
|
The query contains a validate expression (validation is not supported by BaseX). | validate strict { () }
|
XQST0076
|
A group by or order by clause specifies an unknown collation.
|
for $i in 1 to 10
|
XQST0079
|
A pragma was specified without the expression that is to be evaluated. | (# xml:a #) {}
|
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
|
XQST0085
|
An empty namespace URI was specified. | <pref:elem xmlns:pref=""/>
|
XQST0087
|
An unknown encoding was specified. Note that the encoding declaration is currently ignored in BaseX. | xquery version "1.0" encoding "a b"; ()
|
XQST0088
|
An empty module namespace was specified. | import module ""; ()
|
XQST0089
|
Two variables in a for or let clause have the same name.
|
for $a at $a in 1 return $i
|
XQST0090
|
A character reference specifies an invalid character. | "�"
|
XQST0093
|
A module depends on itself. This may be triggered by a circular module definition. | import module ...
|
XQST0094
|
group by references a variable that has not been declared before.
|
for $a in 1 group by $b return $a
|
XQST0108
|
Output declarations may only be specified in the main module. | Module: declare output ...
|
XQST0109
|
The specified serialization parameter is unknown. | declare option output:unknown "..."; 1
|
Type Errors: XPTY, XQTY
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"
|
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)/*
|
XQTY0024
|
An attribute node cannot be bound to its parent element, as other nodes of a different type were specified before. | <elem>text { attribute a { "val" } }</elem>
|
Dynamic Errors (XPDY, XQDY)
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
|
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" }
|
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
|
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") } {}
|
Function Errors (FOAR, FOCA, FOCH, FODC, FODT, FOER)
Code | Description | Examples |
---|---|---|
FOAR0001
|
A value was divided by zero. | 1 div 0
|
FOAR0002
|
A numeric declaration or operation causes an over- or underflow. | 12345678901234567890
|
FOCA0002
|
• A float number cannot be converted to xs:decimal or xs:integer , or• a QName in a function has the wrong lexical value. |
xs:int(xs:double("INF"))
|
FOCA0003
|
A value is too large to be represented as integer. | xs:integer(99e100)
|
FOCA0005
|
"NaN" is supplied to duration operations.
|
xs:yearMonthDuration("P1Y") * xs:double("NaN")
|
FOCH0001
|
A codepoint was specified that does not represent a valid XML character. | codepoints-to-string(0)
|
FOCH0002
|
A unsupported collation was specified in a function. | compare('a', 'a', 'unknown')
|
FOCH0003
|
A unsupported normalization form was specified in a function. | normalize-unicode('a', 'unknown')
|
FODC0001
|
The root of an argument specified in fn:id() or fn:idref() must have a document node as root.
|
id("id0", <xml/>)
|
FODC0002
|
The specified document or collection cannot be retrieved. | doc("unknown.xml")
|
Still in progress…