Appendix C. Error Summary

This appendix lists all of the errors that may be raised during evaluation of a query, in alphabetical order by name. The XQuery spec does not define any programming API defining how queries are executed from, for example, C# or Java; but there is an expectation that in any such API, you will be able to test these error codes to find out what went wrong. In most cases, you can also expect that the error code will be accompanied with an error message that gives much more detailed information.

Error names, which are in the namespace http://www.w3.org/2005/xqt-errors, are broken down into three parts:

  1. A two-character prefix indicating the specification that defines the error, listed in Table C-1.

  2. A two-character category that groups the error messages into their functional meaning. In the case of XP and XQ errors, the categories are ST for static errors, DY for dynamic errors, and TY for type errors.

  3. A four-digit number.

Table C-1. Error prefixes
Error prefixMeaning
FOFunctions and operators
SESerialization
XPXPath
XQXQuery

FOAP0001

The apply function was called, but the arity of the function in the first argument was different from the size of the array in the second argument. For example, apply(upper-case#1, ['a', 'b']), where the arity is 1 and the array has a length of 2.

FOAR0001

Division by zero, which may be raised by the div or mod operator (if the operands are xs:integer or xs:decimal values) or by the idiv operator (regardless of the types of the operands). Using the div operator on values of type xs:float or xs:double will not raise this error; it will return INF or -INF.

FOAR0002

Overflow or underflow occurred during a numeric operation. This occurs when the result of an arithmetic operation or cast is a value that is either larger or smaller (that is, closer to zero) than the values supported by the implementation.

FOAY0001

An attempt was made to retrieve a member from a position that does not exist in an array. For example: [1, 2, 3](4) will return this error because it is attempting to retrieve the fourth member in a three-member array. Likewise, array:get([1, 2, 3], 4) will return the same error. This error may also be raised by array:subarray, array:remove, array:insert-before, array:put, array:head, or array:tail.

FOAY0002

The function array:subarray was called with a negative $length argument.

FOCA0001

An attempt was made to cast to xs:decimal a value that is too large to be supported by the implementation.

FOCA0002

A value that is not lexically valid for a particular type has been encountered. This can be raised in two situations:

  • When passing an invalid name to the QName or resolve-QName function; see the descriptions of these functions in Appendix A for details

  • When attempting to cast one of the special values NaN, INF, or -INF to xs:decimal or xs:integer

FOCA0003

An attempt was made to cast to xs:integer a value that is too large to be supported by the implementation.

FOCA0005

When multiplying or dividing a duration value by a number, the number supplied was NaN.

FOCA0006

When casting to xs:decimal, the value supplied has greater precision than is supported by the implementation.

FOCH0001

A codepoint passed as an argument to the codepoints-to-string function does not refer to a valid XML character.

FOCH0002

An unsupported collation was passed as an argument to a function. Functions that accept collations as arguments (named $collation) are compare, collation-key, contains, contains-token, starts-with, ends-with, substring-before, substring-after, index-of, distinct-values, deep-equal, sort, array:sort, max, and min.

This error might also be raised if no collation was passed to these functions, but the default collation is unsupported.

FOCH0003

An unsupported normalization form was passed as the $normalizationForm argument to the normalize-unicode function.

FOCH0004

A collation that does not support collation units was passed to a function that requires collation units. Functions that require collation units are collation-key, contains, starts-with, ends-with, substring-before, and substring-after.

FODC0001

A node that is not part of a complete document (i.e., does not have a document node among its ancestors) was passed to the id, idref, or element-with-id function.

FODC0002

When calling the doc, collection, or uri-collection function, the processor could not retrieve a resource from the specified URI. This can happen in several cases:

  • The argument specifies a URI for which there is no available document or collection.

  • The argument is a relative URI and the static base URI is absent.

  • The argument is not provided or is the empty sequence and there is no default collection (in the case of collection or uri-collection).

  • The resource cannot be parsed successfully as XML (in the case of doc or collection).

FODC0003

When calling the doc, collection, or uri-collection function multiple times with the same argument, stability of the results returned cannot be guaranteed.

FODC0004

A lexically invalid URI was passed to the collection or uri-collection function. A URI can be relative or absolute, but it must conform to the syntax required by xs:anyURI.

FODC0005

An invalid URI was passed to the doc or doc-available function. A URI can be relative or absolute, but it must conform to the syntax required by xs:anyURI.

FODC0006

The $arg string passed as an argument to the parse-xml function is not well-formed XML. This error could also be raised if DTD validation was attempted but $arg was not valid according to the DTD. Calling parse-xml-fragment can also raise this error if it is not a well-formed XML fragment. In this case, it is not required to have a single root element, but it must otherwise follow the rules for XML syntax.

FODC0010

The serialize function has been called with a processor that does not support serialization (an optional feature).

FODF1280

The format-number function has been called with an invalid decimal format name (the third argument). A decimal format by that name must be declared using a decimal format declaration.

FODF1310

The format-number or format-integer function has been called with an invalid picture string (the second argument).

FODT0001

Overflow or underflow has occurred during an operation involving a date or time value. This occurs when the result of an arithmetic operation or cast is a value that is either larger or smaller than the values supported by the implementation.

FODT0002

Overflow or underflow has occurred during an operation involving a duration value. This occurs when the result of an arithmetic operation or cast is a value that is either larger or smaller than the values supported by the implementation.

FODT0003

An invalid time zone value was passed to one of the three adjust-xxx-to-timezone functions. This may occur if the value of $timezone is not between -PT14H and PT14H, inclusive, or if it does not have an even number of minutes (e.g., -PT2H30M30S).

FOER0000

A non-specific unidentified error has occurred. This may arise if the built-in error function is called with no arguments.

FOFD1340

The format-date, format-time, or format-dateTime function has been called with an invalid picture string (the second argument) or calendar (the fourth argument).

FOFD1350

The format-date or format-time function has been called with a component in the picture string that is not relevant to that type. For example, the format-date function was called and the minute component was referenced in the picture string.

FOJS0001

parse-json, json-doc, or json-to-xml was called with an argument that does not conform to the JSON grammar (optionally including implementation-defined extensions).

FOJS0003

parse-json, json-doc, json-to-xml, or json-to-xml was called with an argument that contains a JSON object with duplicate keys, when the chosen policy is to reject duplicates. Duplicates can be allowed by using a duplicates entry in the $options map passed to the function. This error is also raised when calling the map:merge function with duplicates set to reject, and the merged map would have duplicate keys.

FOJS0004

json-to-xml was called with an $options argument that contains an entry "validate": true(), but the processor does not support schema validation or typed nodes. Consider using "validate": false() instead.

FOJS0005

parse-json, json-doc, json-to-xml, map:merge, or xml-to-json was called with an $options argument that contains an invalid value.

FOJS0006

xml-to-json was called with XML input that does not conform to the rules for the XML representation of JSON. See “Converting Between JSON and XML” for more information on the required XML structure.

FOJS0007

xml-to-json was called with XML input that contained an element with the attribute escaped="true" or escaped-key="true", but the content of that element is not a valid JSON escape sequence. In JSON, a backslash () must be followed by one of the characters ", , /, b, f, n, r, t, or u. If u appears, it must be followed by four hexadecimal digits to indicate a Unicode codepoint.

FONS0004

An undeclared prefix was used in either:

  • The argument to the xs:QName type constructor

  • The first argument to the resolve-QName function

FONS0005

When calling the resolve-uri function, the $base argument is not provided and the static base URI is absent. Either add a $base argument or use a base URI declaration in the query prolog.

FOQM0001

load-xquery-module was called with a $module-uri argument that is a zero-length string.

FOQM0002

load-xquery-module was called with a $module-uri argument for which no module can be found.

FOQM0003

load-xquery-module encountered a static error when trying to load a library module. Ensure that the library module is syntactically correct and has no static type errors.

FOQM0005

load-xquery-module tried to dynamically load a module, but provided an invalid or missing value for the initial context item or for an external variable.

This error might occur for the initial context item if the library module uses a context item declaration to specify the type of the context item, that type does not allow the empty sequence, and the context-item entry in $options passed to the load-xquery-module was omitted or equal to the empty sequence.

This error might also occur for the initial context item if the library module uses a context item declaration to specify the type of the context item, and the context-item entry in $options passed to the load-xquery-module function is not of that type. No type conversion is applied automatically on the context item.

It might occur for a variable if the library module specifies the type by using the as keyword in the variable declaration, that type does not allow the empty sequence, and the value specified in the variables entry in $options passed to the load-xquery-module was omitted or equal to the empty sequence.

Similarly, it will occur if the library module specifies the type by using the as keyword in the variable declaration, and the value specified in the variables entry in $options passed to the load-xquery-module function is not of that type. No type conversion is applied automatically on the variable values.

FOQM0006

load-xquery-module tried to dynamically load a module, but no suitable XQuery processor could be found. This might be because no processor was found, or the processor does not support the specified version, or the processor does not support the Module Feature.

FORG0001

An invalid value was passed to a type constructor or a cast expression. It might be invalid because it is too large or too small, or because it does not have the correct lexical form or it does not follow the validity rules for the target datatype. This can happen in several situations:

  • When passing an invalid value to a type constructor, for example, xs:integer("abc")

  • When passing an invalid value to a cast expression, for example "2015-13-32" cast as xs:date

  • When passing an untyped value to one of the sum, min, max, or avg functions and that value cannot be cast to xs:double

FORG0002

When calling the resolve-uri function, either the $relative or $base argument is not a syntactically valid URI.

FORG0003

A sequence of more than one item was passed to the zero-or-one function; the argument must be either the empty sequence or a single item.

FORG0004

An empty sequence was passed to the one-or-more function; the argument must be a sequence of one or more items.

FORG0005

An empty sequence or a sequence of more than one item was passed to the exactly-one function; the argument must be a single item.

FORG0006

An invalid argument was used in a function or operation. This can happen in three situations:

  • You passed an argument sequence to one of the sum or avg functions that contains values that are not numbers or durations, or that are a mixture of numbers and durations.

  • You passed an argument sequence to one of the min or max functions that contains values that do not support the < and > operators, or that have a mixture of different types.

  • You attempted to find the effective boolean value of a sequence for which it cannot be determined. Effective boolean value cannot be determined for a multi-item sequence whose first item is an atomic value, an individual atomic value whose type is not numeric, untyped, xs:boolean, or xs:string, or a function item (including a map or array).

    Effective boolean value is calculated when calling the boolean and not functions, but also in many different operations that do not involve functions, such as conditional (if-then-else) expressions, where clauses of FLWORs, and predicates of path expressions. Effective boolean value is discussed in more detail in “Effective Boolean Value”.

One common cause of this is using an expression like:

doc("catalog.xml")//product[1 to 3]

Although this expression is allowed by some XQuery processors, it is technically not valid because it attempts to find the effective boolean value of a sequence of integers. Instead, you should use:

doc("catalog.xml")//product[position() = 1 to 3]

FORG0008

The two arguments passed to the dateTime function have different time zones. They should have the same time zone or none at all.

FORG0009

When calling the resolve-uri function, the $relative argument cannot be resolved relative to the $base argument.

FORG0010

parse-ietf-date was called with a $value argument which does not match the prescribed grammar, or represents an invalid date or time such as April 31.

FORX0001

The $flags argument passed to the matches, replace, tokenize, or analyze-string function includes invalid letters. Valid letters are lowercase s, m, i, x, and q, and they may appear in any order.

FORX0002

The $pattern argument passed to the matches, replace, tokenize, or analyze-string function is not a valid regular expression. This might occur if, for example, there are mismatched parentheses or unescaped special characters. Note that the regular expression language supported omits many constructs that may be familiar, for example, to Perl programmers.

FORX0003

The $pattern argument passed to the replace, tokenize, or analyze-string function matches a zero-length string—for example, q?.

FORX0004

The $replacement argument passed to the replace function is invalid. This can happen in two cases:

  • It contains a dollar sign ($) that is not followed by a digit and is not preceded by a backslash ().

  • It contains a backslash that is not followed by a dollar sign and is not preceded by another backslash.

FOTY0012

An attempt was made to find the typed value of a node that has no typed value. This occurs, for example, when you pass to the data function an element node whose type (after schema validation) has element-only content. It may also be raised during atomization, which extracts the typed value of a node, sorting, or finding distinct values.

FOTY0013

An attempt was made to find the typed value of a function item. This occurs when you pass a function item (other than an array) to the data function. It may also be raised during atomization, which extracts the typed value of a node.

FOTY0014

The string function was called with a function item as the argument.

FOTY0015

The deep-equal function was called with a function item (other than a map or array) as the argument.

FOUT1170

The unparsed-text or unparsed-text-lines function was called with an invalid $href (first argument). This can occur in several cases:

  • The processor cannot find a resource at that URI.

  • The URI contains a fragment identifier (#).

  • The processor cannot resolve the URI (to make it absolute) because it is relative and no static base URI is available.

FOUT1190

The resource retrieved by the unparsed-text or unparsed-text-lines function could not be decoded. This can occur in several cases:

  • $encoding does not represent a valid encoding name.

  • The processor does not support the encoding specified in $encoding.

  • The resource retrieved cannot be decoded using the specified encoding (because it is not validly encoded).

  • The resource contains characters that are not allowed by XML.

FOUT1200

The unparsed-text or unparsed-text-lines function was called with no $encoding argument, the retrieved resource was not encoded in UTF-8, and the processor cannot otherwise infer the encoding.

FOXT0001

The transform function was called but no XSLT processor is available.

FOXT0002

The transform function was called with invalid parameters, for example two mutually-exclusive parameters were supplied. This error is returned when a more specific XSLT error code is not available.

FOXT0003

The transform function attempted to transform using an XSLT that failed with a static or dynamic error. This error is returned when a more specific XSLT error code is not available.

FOXT0004

The transform function was called, but XSLT transformation (or a specific transformation option) has been disabled for security or other reasons.

FOXT0006

The transform function was called, but the output contains characters only allowed in XML 1.1, and the processor cannot support these characters.

SENR0001

The output method is not json or adaptive, and the results of a query contain either function items (including maps or arrays), or attribute or namespace nodes that are not associated with any elements. This result cannot be serialized. To serialize maps or arrays, use the json output method.

SEPM0004

The result has no single element node and consists of multiple text nodes or element nodes. In this case, it is considered to be an XML entity that may be included in another XML document but cannot stand on its own. Therefore, it is an error to specify the doctype-system parameter, or to specify the standalone parameter with a value other than omit.

SEPM0009

If the omit-xml-declaration parameter has the value yes, it is an error if either:

  • The standalone attribute has a value other than omit.

  • The version parameter has a value other than 1.0 and the doctype-system parameter is specified.

SEPM0010

Undeclaring namespaces is not allowed in Namespaces 1.0. Therefore, if the output method is xml or xhtml, it is an error if the value of the undeclare-prefixes parameter is yes and the value of the version parameter is 1.0.

SEPM0016

A serialization parameter has an incorrect value. Generally, a more specific error message will be provided.

SEPM0017

When the serialization parameters were supplied as an XML instance, evaluating an expression to extract a serialization parameter value encountered an error.

SEPM0018

When the serialization parameters were supplied as an XML instance, there was a duplicate output:character-map element with the same value for the character attribute. The characters supplied in a character map must be unique.

SEPM0019

When the serialization parameters were supplied as an XML instance, there was an attempt to supply multiple elements for the same setting. All child elements of output:serialization-parameters must have unique names.

SERE0003

This is a general-purpose error message that indicates that the serializer is unable to create a well-formed XML document or entity.

SERE0005

The result includes an NCName that contains a character not permitted by the version specified by the version parameter. The characters allowed in names in XML 1.1 (and Namespaces 1.1) are different from those allowed in XML 1.0 (and Namespaces 1.0).

SERE0006

The result contains a character not permitted by the version specified by the version parameter. The characters allowed in XML 1.1 (and Namespaces 1.1) are different from those allowed in XML 1.0 (and Namespaces 1.0).

SERE0008

The result contains a character that cannot be represented in the encoding being used by the serializer, and it cannot be replaced by a character reference (because, for example, it appears in a name, where character references are not allowed by XML syntax).

SERE0012

The value of the normalization-form parameter is set to fully-normalized, but some text in the result (for example, names or element content) begins with a combining character.

SERE0014

The output method is set to HTML, but the result contains one of the control characters #x7F-#x9F. These characters are allowed in XML, but not HTML. The most likely cause of this error is that the encoding of your input document is incorrectly declared. Microsoft Windows uses codes in this range to represent special characters such as an em dash or a euro currency symbol. If your source XML document uses these Microsoft codes, it must declare this by specifying encoding="cp1252" in the XML declaration. Otherwise they will be taken to represent the Unicode control characters at these positions, which are not allowed in HTML.

SERE0015

The output method is set to HTML, but the result contains a processing instruction that has the character > in its content. This is allowed in XML, but not HTML, because HTML terminates processing instructions with >.

SERE0020

When serializing JSON, the output contained a numeric value such as INF or NaN that is not supported in the JSON syntax.

SERE0021

When serializing JSON, the output contained an item for which there are no rules for serialization, for example, a function item that is not a map or array.

SERE0022

When serializing JSON, a map contained two keys that are duplicates when converted to strings. This could arise if the keys have different typed values in the XQuery map, for example, the string 1 and the integer 1. This error is not raised if allow-duplicate-names is set to yes.

SERE0023

When serializing JSON, a top-level sequence being serialized cannot contain more than one item. To serialize multiple items, they should be contained in an array or map.

SESU0007

The value of the encoding parameter is not supported by the serializer. All serializers support, at a minimum, UTF-8 and UTF-16.

SESU0011

The value of the normalization-form parameter is not supported by the serializer. All serializers support, at a minimum, NFC and none.

SESU0013

One of the following is true:

  • The output method is set to html, and the value of the version or html-version parameter is a version of HTML not supported by the serializer.

  • The output method is set to xml, and the value of the version parameter is a version of XML not supported by the serializer.

XPDY0002

An expression relies on some part of the dynamic context that is absent. Most often, this is a path expression or function call that relies on the current context item, but the context item is absent. This may be because you used a relative path, when no outer expression set the context for the path. For example, if your entire query is:

//catalog/product

and the context is not set outside the query by the processor (or by a context item declaration), this error will be raised because the processor will not know what the path is relative to. Instead, start your path with a function call or variable that sets the context, as in:

doc("catalog.xml")//catalog/product

This error may occur when you use paths in a FLWOR expression and forget to start each path with a step that sets the context. For example:

for $prod in doc("catalog.xml")//product
where number > 500
return number

In this case, the processor does not automatically know to evaluate number relative to the $prod variable; it has to be explicitly specified, as in:

for $prod in doc("catalog.xml")//product
where $prod/number > 500
return $prod/number

This error might also occur if you forget to put the dollar sign in front of the variable name, causing the processor to interpret it as a path. For example:

for $prod in doc("catalog.xml")//product
return prod

With the dollar sign omitted from the beginning of prod in the return clause, the processor will interpret it as a relative path to a child element named prod.

A number of built-in function calls will raise this error as well if they require the current context item and it is absent. There are a number of built-in functions that operate on the current context item by default if no appropriate argument is passed. These functions are base-uri, data, element-with-id, document-uri, generate-id, has-children, id, idref, lang, last, local-name, name, namespace-uri, nilled, node-name, normalize-space, number, path, position, root, string, and string-length. For example, the function call name() (with no arguments) uses the current context item.

Finally, this error can be raised in another situation: if a global variable is defined as external, but it was not bound to a value outside the scope of the query, any references to that variable will raise this error.

XPDY0050

This error is raised in two separate cases:

  • When a path expression starts with / or // and the current context item is not part of a complete XML document (with a document node at its root)

  • When using a treat expression, if the operand of the expression does not match the sequence type specified

In the first case, you can fix the expression by starting with a call to the root function, which does not require the root to be a document node. For example, you could use root(.)/descendant-or-self::product instead of just //product.

XPDY0130

An implementation-defined limit has been exceeded, for example relating to maximum numbers or sizes of various objects.

XPST0001

This is a general-purpose error that is raised if an expression relies on a component of the static context that has not been assigned a value. One example is attempting to resolve a relative URI when there is no static base URI available. In most cases, a more specific error code and message are provided.

XPST0003

A syntax or parsing error has occurred. This may happen, for example, if there are mismatched parentheses or invalid keywords.

XPST0005

If static typing is in effect, this error will be raised if any expression in your query (other than () and data( () )) will always return the empty sequence. Often, this is the result of a misspelling or an invalid path. For more information, see Chapter 15.

XPST0008

An undefined name was encountered. This could be a variable name, an element name, an attribute name, or a type name. It may be that you misspelled the name or referred to it in the wrong namespace.

If it is a variable name, that variable may be referenced outside the scope for which it is bound. One reason for this error is misplaced or missing parentheses. A common case is when you attempt to return two items by using a FLWOR expression, as in:

for $prod in doc("catalog.xml")//product
return $prod/number, $prod/name

In this case, the second reference to $prod on the last line is out of scope, because only a single expression is included in the return clause. The rest of the line (, $prod/name) is considered to be a separate expression that appears after the FLWOR expression. This example can be remedied by placing parentheses around the return clause, as in:

for $prod in doc("catalog.xml")//product
return ($prod/number, $prod/name)

This error is also raised if the body of a user-defined function relies on the context item, which is absent inside a function. Instead, the relevant node must be passed to the function as an argument, as described in “Functions and Context”.

Finally, this error may be raised if an element, attribute, or type name appears in a sequence type but is not part of the in-scope schema definitions. For example, the sequence type:

element(prod, ProductType)

will raise an error if the in-scope schema definitions do not include a type definition for ProductType.

XPST0017

You have attempted to call a function that is not declared. This may be because:

  • You are using the wrong function name.

  • You are using the wrong namespace prefix for the function name.

  • You didn’t import the module in which the function is declared.

  • You are passing an incorrect number of arguments to a function. When calling a function, there must be an argument for every parameter specified in the function signature.

  • You are using an implementation that doesn’t support the Higher Order Function Feature, but you are attempting to call a higher-order function such as for-each or filter.

XPST0051

A sequence type refers to a type (other than within the element() or attribute() constructs) that is not an atomic or union type in the in-scope schema definitions. Sequence types most commonly appear in function signatures, as in:

declare function local:xyz ($arg1 as xs:string*, $arg2 as prod:SizeType?) { };

where xs:string* and prod:SizeType? are sequence types that described the types of the arguments. This error might be raised if you:

  • Misspelled or incorrectly capitalized the name of a built-in type, e.g., xs:String or xs:srting.

  • Used a user-defined type name that is not declared in an in-scope schema—for example, if prod:SizeType is not in an imported schema.

  • Used a user-defined type name that is a complex or list type, not an atomic type—for example, if prod:SizeType allows children. Using the sequence type element(*, prod:SizeType) would be allowed.

XPST0080

A cast or castable expression refers to one of the types xs:NOTATION, xs:anySimpleType, or xs:anyAtomicType. It is not permitted to cast values to these types.

XPST0081

A qualified name (QName) in your query has a prefix that is not declared, or that is referenced outside the scope in which it is declared. Anything that appears before a colon in a name is considered to be a prefix, and it must be declared, either in the prolog or in an element constructor. This error is raised for path expressions, element and attribute constructors, element and attribute sequence types, pragma names, and option names. For example, the path expression:

doc("cat_ns.xml")//prod:product

raises an error if the prod prefix is not declared either in the query prolog or in a surrounding direct element constructor.

XPTY0004

This error is a general type error that is raised when a value has a type that is incompatible with the type expected by a function or other expression. This could be because the type of the value is incorrect for the expression, which is the case when you try to multiply two strings. It could also arise if the value is a sequence of fewer or more items than are expected, for example, when you pass the substring function a sequence of multiple strings instead of just a single string.

Common cases that raise this type error are:

  • Comparing values with incomparable types, for example, "abc" = 1.

  • Attempting to compare sequences of more than one value by using the value comparison operators, for example, (1, 2) eq (1, 2).

  • Attempting arithmetic operations on values that are not numbers or dates, for example, "abc" + "def".

  • Calling a function with arguments that have incorrect types, for example, substring(1234, 3), whose first argument is an integer instead of a string.

  • Calling a function with too few or too many items in an argument, for example, substring( ("a", "b"), 3), which passes a sequence of two items as the first argument instead of just one.

  • Passing an invalid operand to a type constructor or cast as expression. This includes passing a non-literal value when constructing a value of type xs:QName (or a type derived from xs:QName or xs:NOTATION). These types have a special constraint that they can only accept a literal xs:string value, not an evaluated expression.

  • Using an order by clause that returns more than one item to sort on, for example, order by $prod/*.

  • Using an as keyword and then supplying a value that does not conform to that type. For example, let $foo as xs:integer := "abc".

  • Specifying a value with an incompatible type in a type constructor or cast expression, as in 53 cast as xs:date.

  • Supplying an element node that has not been validated to a function that expects a validated element node.

  • Calling a function that relies on the current context item being a node rather than an atomic value. A number of built-in functions will operate on the current context item by default if no appropriate argument is passed. These functions are base-uri, document-uri, element-with-id, generate-id, has-children, id, idref, lang, local-name, node-name, name, namespace-uri, nilled, path, and root.

XPTY0018

The last step in a path expression is returning both nodes and non-nodes, which is not permitted. It must return either all nodes or all non-nodes (i.e., atomic values or function items). The reason for this rule is that “/” causes sorting into document order if the step delivers nodes, but not if it delivers atomic values. Therefore, it doesn’t make sense to return a mixture. This can generally be remedied by changing the last slash to a simple map operator (!).

XPTY0019

A step in a path expression (that is not the last step) is returning non-nodes (i.e., atomic values or function items), which is not permitted. For example, the following expression:

doc("catalog.xml")//name/substring(., 1, 3)/replace(., 'A', 'a')

is not permitted because the second to last step, substring(., 1, 3), is returning atomic values. The offending slash can be replaced with the simple map operator (!), which does allow non-nodes, for example:

doc("catalog.xml")//name/substring(., 1, 3) ! replace(., 'A', 'a')

XPTY0020

You have specified a relative path expression, but the current context item is not a node. This might occur, for example, if you use a relative path in a predicate where the current context item is an atomic value, as in:

doc("catalog.xml")//product/substring(name, 1, 3)[@dept = 'ACC']

The path expression @dept is being evaluated relative to the substring of the name (an atomic value) rather than the product element. In this case, the predicate can be moved to the previous step, as in:

doc("catalog.xml")//product[@dept = 'ACC']/substring(name, 1, 3)

XPTY0117

When calling a function, an untyped value cannot be converted to a namespace-sensitive type like xs:QName or xs:NOTATION. You can avoid this error by explicitly casting the value to the desired type before calling the function.

XQDY0025

You have attempted to add two attributes with the same name to a constructed element. XML does not allow two attributes with the same name on the same element.

XQDY0026

You are trying to construct a processing instruction that contains the string ?>, which is not allowed.

XQDY0027

An element was determined to be invalid when a validate expression was applied to it.

XQDY0041

When constructing a processing instruction, its target (name) is a value that cannot be cast to xs:NCName. Processing instruction targets must be castable to xs:NCName, whose valid values are included in xs:NCName.

XQDY0044

The name specified for an attribute constructor has one of the following problems that indicate you are trying to create a namespace declaration by using an attribute constructor, which is not allowed:

  • Its namespace prefix is xmlns.

  • Its name is xmlns (with no prefix).

  • Its namespace URI is http://www.w3.org/2000/xmlns/.

Instead, you should declare the namespace in the query prolog or in an outer direct element constructor.

This error is also raised due to improper use of the xml prefix or the XML namespace. This includes attempting to use a name where the prefix xml is bound to a namespace other than http://www.w3.org/XML/1998/namespace, or where some prefix other than xml is bound to that namespace. The xml prefix is predeclared, so it does not need an associated namespace declaration.

XQDY0054

Function and variable declarations with circular definitions were encountered; these are not allowed. For example, an initializing expression in a variable declaration cannot call a function whose body itself references the variable being initialized. Likewise, two variable declarations cannot depend on each other (directly or indirectly).

XQDY0061

If the expression that appears in curly braces after the validate keyword is a document node, that document node must have exactly one child element node. It may also have as children zero, one, or many comment nodes and processing-instruction nodes, in any order.

XQDY0064

When constructing a processing instruction, its target (name) cannot be the letters XML (in any combination of uppercase or lowercase letters). If you are attempting to add an XML declaration to your results, this is controlled by setting the omit-xml-declaration serialization parameter to no rather than being constructed in your query.

XQDY0072

A computed comment constructor results in a comment that contains two consecutive hyphens (--) or ends in a hyphen, which is not allowed.

XQDY0074

The name expression in a computed constructor cannot be cast to xs:QName, for example, because it is an invalid XML name or an undeclared prefix is used.

XQDY0084

When evaluating a validate expression whose validation mode is strict, the processor could not find a global element declaration in the in-scope schema definitions or anywhere else. This may be because the schema was not imported or because the element was not globally declared.

XQDY0091

You have attempted to construct an attribute named xml:id with an invalid value. ID values must start with a letter or underscore and can only contain letters, digits, underscores, hyphens, and periods.

XQDY0092

You have attempted to construct an attribute named xml:space with a value other than preserve or default. Those are the only two values allowed.

XQDY0096

The name specified for an element constructor has one of the following problems:

  • Its namespace prefix is xmlns.

  • Its name is xmlns (with no prefix).

  • Its namespace URI is http://www.w3.org/2000/xmlns/.

This error is also raised due to improper use of the xml prefix or the XML namespace. This includes attempting to use a name where the prefix xml is bound to a namespace other than http://www.w3.org/XML/1998/namespace, or where some prefix other than xml is bound to that namespace. The xml prefix is predeclared, so it does not need an associated namespace declaration.

XQDY0101

This error is raised when a computed namespace constructor misuses the xmlns prefix or the http://www.w3.org/2000/xmlns/ namespace. It is not valid to attempt to bind xmlns to any namespace, or to bind any prefix to http://www.w3.org/2000/xmlns/. For example:

namespace xmlns { "http://datypic.com/prod" }

Although this might look like it is declaring a default namespace, it is actually attempting to bind that namespace to the prefix xmlns. To make that the default namespace, the correct syntax is:

namespace {""} { "http://datypic.com/prod" }

It is also invalid to use a computed namespace constructor to declare a zero-length namespace name, as in:

namespace prod { "" }

Another reason for this error is improper use of the xml prefix or the XML namespace. This includes attempting to bind the prefix xml to a namespace other than http://www.w3.org/XML/1998/namespace, and attempting to bind some prefix other than xml to that namespace. The xml prefix is predeclared, so it does not need an associated namespace declaration.

XQDY0102

In an element constructor, the same prefix cannot be bound to different namespaces in the same scope. This might arise when you’re using computed namespace constructors, for example:

element root { namespace prod {"http://datypic.com/prod1"},
               namespace prod {"http://datypic.com/prod2"} } 

This would create two conflicting namespace declarations for the prefix prod, in the same scope (the root element). This can be remedied by using different prefixes for different namespace names.

XQDY0137

A map constructor tried to define two keys with the same value. The values must be unique, taking into account the data type of the values.

XQST0009

The processor found a schema import in the prolog, but it does not support the optional Schema Aware Feature.

XQST0012

One or more of the imported schemas contain definitions that are incomplete or invalid, or contain duplicate declarations.

XQST0013

The processor has recognized a pragma but determined that it contains invalid content as defined by the implementation. Consult the documentation for your implementation to determine what values are allowed for the pragma.

XQST0016

The processor encountered a module declaration or module import, but it does not support the optional Module Feature.

XQST0022

The namespace name used in a namespace declaration attribute (in a direct element constructor) uses an enclosed expression. It must be a literal value; it cannot be dynamically evaluated.

XQST0031

The processor has encountered a version of XQuery that it does not support in the version declaration. If, for example, you have specified version 3.1 as shown below, you should ensure that your processor supports 3.1. Otherwise, you may need to use XQuery 1.0 or 3.0.

xquery version "3.1" encoding "UTF-8";

XQST0032

The prolog contains more than one base URI declaration, which is not allowed. Base URI declarations start with declare base-uri.

XQST0033

The prolog contains more than one declaration for the same namespace prefix, which is not allowed. Namespaces can be declared using standard namespace declarations, module declarations, module imports, and schema imports. If a namespace is declared in a module import or declaration, it does not need to be separately declared in a namespace declaration.

XQST0034

You may have attempted to declare two functions with the same qualified name and the same number of parameters (arity). The conflicting function signature may appear in a separate module that has been imported.

This error is also raised if you declare a function with only one parameter, and it has the same qualified name as a type that is in scope. For example, if you import a schema that contains a type named order in the namespace http://datypic.com/prod, you cannot also declare a function, with one parameter, named order in the same namespace. This is because each type has a constructor function that shares its name, and it would be impossible to distinguish between the type constructor and the user-defined function.

XQST0035

You have attempted to import two schema documents that have duplicate names for globally declared components such as elements, attributes, and types.

XQST0038

This error is raised in two situations:

  • The prolog contains more than one default collation declaration. Default collation declarations start with declare default collation.

  • The prolog refers to a default collation that is not supported by the implementation.

XQST0039

A function signature (or an inline function expression) contains more than one parameter with the same name; the parameter names within a particular function signature must be unique.

XQST0040

A direct element constructor contains two attributes with the same qualified name. As with normal XML syntax, the attributes of an element must have unique names.

XQST0045

You have attempted to declare your own function, or use an annotation, in one of the following namespaces:

  • http://www.w3.org/XML/1998/namespace (xml)

  • http://www.w3.org/2001/XMLSchema (xs)

  • http://www.w3.org/2001/XMLSchema-instance (xsi)

  • http://www.w3.org/2005/xpath-functions (fn)

  • http://www.w3.org/2005/xpath-functions/math (math)

  • http://www.w3.org/2005/xpath-functions/array (array)

  • http://www.w3.org/2005/xpath-functions/map (map)

  • http://www.w3.org/2012/xquery (used in annotations)

This is not permitted. Instead, use the prefix local, or declare a new namespace and prefix your function name with the appropriate prefix for that namespace.

XQST0046

URI values (including namespace names) used in queries should be syntactically valid URIs, which can be URLs or URNs. A processor may optionally raise this error if a URI is not syntactically valid according to the rules, which are described in RFC 3986, Uniform Resource Identifiers (URI): Generic Syntax.

This error may be raised by any of the following URIs used in a query:

  • The namespace name in a namespace declaration (either in the prolog or in a direct element constructor)

  • The module location or namespace name in a module import

  • The target namespace in a module declaration

  • The schema location or namespace name in a schema import

  • The collation URI in a default collation declaration or in an order by or group by clause

  • The base URI in a base URI declaration

XQST0047

Two separate module imports specify the same target namespace, which is not permitted. Instead, specify multiple module locations for the same target namespace in a single import, using commas to separate them. For example, change this:

import module "http://datypic.com/strings"
               at "strings.xqm";
import module "http://datypic.com/strings"
               at  "strings2.xqm";

to this:

import module "http://datypic.com/strings"
               at "strings.xqm",
                  "strings2.xqm";

XQST0048

One of the functions and variables declared in a library module is not in the target namespace. Every function and global variable declared in a library module must be qualified with the target namespace of that module. Generally, this means that they use the prefix that is bound to the target namespace in the module declaration. For example, the following is not permitted because the variable maxStringLength is not in the target namespace:

module namespace strings = "http://datypic.com/strings";
declare variable $maxStringLength := 32;
declare function strings:trim($arg as xs:string?) as xs:string? {
  substring($arg, 1, 10)
};

Instead, it must be prefixed with strings to put it in the target namespace http://datypic.com/strings.

XQST0049

Duplicate prolog variable declarations were found. The qualified names of all variables declared in prologs must be unique across all modules that are used together. This includes the main module and any imported library modules.

XQST0052

A cast or castable expression refers to a type that is not defined in the in-scope schema types, or that is not a simple type. If you are using types from a schema definition, make sure that schema document is being imported, and that the type in question is a simple type.

XQST0055

The prolog contains more than one copy-namespaces declaration, which is not permitted. Copy-namespaces declarations start with declare copy-namespaces.

XQST0057

A schema import that specifies a prefix has a zero-length namespace name, which is not allowed. For example, the following schema import is invalid:

import schema namespace prod = ""
              at "prod_nons.xsd";

You can, however, import a schema with no target namespace if you make “no namespace” the default, as in:

import schema default element namespace ""
              at "prod_nons.xsd";

XQST0058

Two separate schema imports specify the same target namespace, which is not permitted. For example:

import schema "http://datypic.com/prod"
               at "http://datypic.com/input/prod.xsd";
import schema "http://datypic.com/prod"
               at  "http://datypic.com/input/prod2.xsd";

Instead, you can specify multiple schema locations for the same target namespace in a single import, using commas to separate them. For example:

import schema "http://datypic.com/prod"
               at "http://datypic.com/input/prod.xsd",
                  "http://datypic.com/input/prod2.xsd";

However, the semantics of this are somewhat implementation-dependent because schema locations are just hints, and the processor could choose to ignore the second location. A safer option is to create a schema document that includes the two other schema documents, and import that.

XQST0059

The processor cannot find a valid library module for the target namespace specified in a module import, or a valid schema for the target namespace specified in a schema import. This might occur, for example, because it could not find a module or schema at all, or it found a module or schema with a different target namespace than the one specified in the import. Different processors have different strategies for locating modules—for example, some might allow independent compilation of library modules.

XQST0060

A function is declared with a name that is not in a namespace. All function names must be in a namespace. Note that default element namespace declarations do not apply to function names.

To remedy this, revise your function name to include a namespace prefix. In a main module, you can use any prefix that is declared in the prolog or the predeclared prefix local. In a library module, you must use the prefix that is bound to the target namespace of the module.

XQST0065

The prolog cannot contain more than one ordering mode declaration. Ordering mode declarations start with declare ordering.

XQST0066

The prolog contains more than one default element namespace declaration or more than one default function namespace declaration, which is not allowed. Default element namespace declarations start with declare default element namespace, and default function namespace declarations start with declare default function namespace.

XQST0067

The prolog contains more than one construction declaration, which is not allowed. Construction declarations start with declare construction.

XQST0068

The prolog contains more than one boundary-space declaration, which is not allowed. Boundary-space declarations start with declare boundary-space.

XQST0069

The prolog contains more than one empty order declaration, which is not allowed. Empty order declarations start with declare default order.

XQST0070

This error is raised if a namespace declaration attempts to:

  • Bind a URI to the prefix xmlns. This built-in prefix has special meaning in XML and cannot be used in a declaration.

  • Bind the http://www.w3.org/2000/xmlns/ namespace to any prefix.

  • Bind the xml prefix to a namespace other than http://www.w3.org/XML/1998/namespace.

  • Bind the http://www.w3.org/XML/1998/namespace namespace to a prefix other than xml.

This error could be raised by a standard namespace declaration (either in a prolog or direct constructor), or by the namespace binding that occurs as part of a module declaration, module import, or schema import.

XQST0071

More than one namespace declaration attribute on a single element constructor uses the same prefix, which is not allowed. For example, the following raises an error because the prod prefix is bound twice on the same element:

<product xmlns:prod="http://datypic.com/prod"
         xmlns:prod="http://datypic.com/prd">...</product>

XQST0075

The processor encountered a validate expression, but it does not support the Schema Aware Feature. Not all implementations support the validate expression; it is an optional feature.

XQST0076

The collation specified in an order by or group by clause is not supported by the implementation.

XQST0079

An extension expression has no expression between its curly braces, and the processor does not recognize the pragma(s).

XQST0085

Namespace declaration attributes that map prefixes to namespace names that are zero-length strings, such as xmlns:cat="", are only allowed if the implementation supports Namespaces 1.1.

XQST0087

The version declaration contains an invalid encoding value. Example valid values for the encoding include UTF-8, UTF-16, ISO-8859-1, and US-ASCII. Encoding names always start with a letter and may contain letters, digits, periods, underscores, and hyphens.

XQST0088

The target namespace specified in a module import or a module declaration is a zero-length string, which is not allowed.

XQST0089

A variable bound in a for or window clause has the same name as the positional variable used in that same clause. This is not permitted. For example, change:

for $x at $x in (doc("catalog.xml")//product)
return $x

to:

for $x at $y in (doc("catalog.xml")//product)
return $x

XQST0090

A character reference (e.g., &#x20;) refers to a character that is not a valid character in the version of XML that is in use.

XQST0094

The name of a variable used in a group by clause (directly after the keywords group by) must be previously bound in a prior clause of the FLWOR expression.

XQST0097

A decimal format declaration supplies an invalid value for a particular property. For example, zero-digit has a non-digit value, or pattern-separator has more than one character.

XQST0098

A decimal format declaration attempts to use the same character for multiple properties representing characters used in a picture string. These properties are decimal-separator, grouping-separator, percent, per-mille, zero-digit, digit, exponent-separator, and pattern-separator. For example, if you attempted to specify the comma character for both the decimal-separator and the grouping-separator properties, this error is raised.

XQST0099

A module contains more than one context item declaration, which is not allowed. Context item declarations start with declare context item.

XQST0103

A duplicate variable name was used in a window clause. All the variables in a window clause must have distinct names.

XQST0104

A validate expression has a type clause that uses a type name that is not among the in-scope schema definitions. This may be because the schema was not imported.

XQST0106

A function declaration contains both a %private and a %public annotation, more than one %private annotation, or more than one %public annotation. Only one %private or one %public annotation is allowed.

XQST0108

An output declaration appears in a library module, which is not allowed. Output declarations can only appear in main modules.

XQST0109

An output declaration that uses the namespace http://www.w3.org/2010/xslt-xquery-serialization refers to an invalid name, i.e., one that is not described in “Serialization Parameters”. One exception is that the value use-character-maps is not allowed in an output declaration; it can only be set in a separate document. The value parameter-document is allowed in addition to the values in the table, to indicate the name of a document containing the serialization parameters.

XQST0110

The query contains output declarations that specify the same serialization parameter more than once. Only one value is allowed per parameter.

XQST0111

The query contains more than one decimal format declaration with the same name, or more than one default decimal format declaration. The decimal formats must have unique names within a module.

XQST0113

A context item declaration in a library module must be external, and it cannot contain a := operator to specify a default value.

XQST0114

A decimal format declaration is specifying the same property more than once, which is not allowed.

XQST0115

An output declaration is using parameter-document to refer to an external document, but this document raises a serialization error.

XQST0116

A variable declaration contains both a %private and a %public annotation, more than one %private annotation, or more than one %public annotation. Only one %private or one %public annotation is allowed.

XQST0118

In a direct element constructor, the name used in the end tag must exactly match the name used in the corresponding start tag. This error will be raised even if the two tags represent the same qualified names but they have different prefixes (or one has no prefix).

XQST0119

An output declaration is using parameter-document to refer to an external document, but the processor is unable to parse this document, possibly because it is not well-formed XML.

XQST0125

An inline function expression contains a %private or a %public annotation, which is not allowed. Inline function expressions can have other annotations, but not these two.

XQST0129

An implementation encountered an expression that it does not support because it does not implement the Higher-Order Function Feature, namely a function test, dynamic function call, named function reference, inline function expression, or partial function application.

XQST0134

XQuery does not support the namespace axis, including the node test that relies on this axis, namely namespace-node().

XQTY0024

In element constructor content, enclosed expressions that evaluate to attributes must appear first in the element constructor content, before any other kinds of nodes. For example, the following query is not valid because the second enclosed expression, {$prod/@dept}, appears after an enclosed expression that returns element nodes.

for $prod in doc("catalog.xml")/catalog/product
return <li>{$prod/number}{$prod/@dept}</li>

If the intent was to put the value of the dept attribute inside the li element, consider using the data function to extract the value of the attribute.

XQTY0030

The expression that appears in curly braces after the validate keyword must be a single document or element node. If it evaluates to a sequence of multiple items, another kind of node, or an atomic value, this error is raised.

XQTY0086

If you set the copy-namespaces mode to no-preserve, and the construction mode to preserve, there may be a conflict if your element content (or attribute values) contains namespace-sensitive values, such as qualified names. Namespaces used in content (as opposed to in element/attribute names) are not considered to be “used.”

For example, suppose your input document (qnames.xml) looks like this:

<listOfQualifiedNames xmlns:prod="http://datypic.com/prod">
 <qName>prod:xyz</qName>
 <qName>prod:abc</qName>
</listOfQualifiedNames>

Suppose also that this document has been validated with a schema, and the qName elements are annotated with the type xs:QName. You might query the document with:

<myNewList>{doc("qnames.xml")//qName}</myNewList>

intending to return a new element that contains the two qName elements. If construction mode is preserve, the qName elements will still have the type xs:QName. But if the copy-namespaces mode is no-preserve, the http://datypic.com/prod namespace will not be preserved, because it is used only in content, not in element or attribute names. Therefore, the qName elements’ content will have undefined prefixes and this error will be raised.

XQTY0105

An element constructor cannot have an enclosed expression that returns a function (other than an array). It must return nodes, arrays, and/or atomic values.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.80.45