PhoenixmlDb.XQuery
XQueryParseException
Exception thrown when XQuery parsing fails due to syntax errors in the source text.
#XQueryParseException
Namespace: PhoenixmlDb.XQuery.Parser
Exception thrown when XQuery parsing fails due to syntax errors in the source text.
This exception is thrown by XQueryParserFacade.Parse when the input contains one or more syntax errors. The XQueryParseException.Errors property provides structured error information including line and column numbers for each error.
To avoid exceptions for expected invalid input, use XQueryParserFacade.TryParse instead, which returns errors through an out parameter.
#Example
try
{
var ast = parser.Parse("for $x in (1,2,3) return"); // missing return expression
}
catch (XQueryParseException ex)
{
foreach (var error in ex.Errors)
Console.Error.WriteLine($"Line {error.Line}, Column {error.Column}: {error.Message}");
}
#Constructors
##ctor(Collections.Generic.IReadOnlyList<PhoenixmlDb.XQuery.Parser.ParseError>)
Creates a new
from a list of parse errors.
Parameters:
-
errors— One or more parse errors.
##ctor(String)
Creates a new
from a single error message. The error is placed at line 1, column 0.
Parameters:
-
message— The error message.
#Properties
| Name | Description |
|---|---|
ErrorCode
|
The error code of the first error: the one its message leads with (a lexer or parser site that knows a specific code, such as XPST0081 for an unbound prefix, writes it there), or XPST0003, the code for text that is not a valid instance of the grammar.
|
Errors
|
The structured list of parse errors with source location information. |