Error message does not indicate the Saxon/C method it was called from.
Reported by user:
While updating to the new Saxon/C version, I spent quite an hour trying to figure out why I got
Error on line 1 column 1 of file: SXXP0003: Error reported by XML parser: Content is not allowed in prolog. Error: The most recent Stylesheet Object failed or has not been set.
In the end, it turned out I had mixed up compileFromString with compileFromFile. So, you might want to consider changing the error message in this case to something more obvious.
Updated by O'Neil Delpratt over 4 years ago
This error message message is coming from the Saxon internals. It is unfortunate that the error message does not give more details of the method it was called from. Maybe we can make the message more user friendly by concatenating the method name.
Running the gdb (GNU Debugger) would have given the stack trace.
Updated by Michael Kay over 4 years ago
This kind of thing is a perennial problem: reporting the error exactly as returned by an underlying component (in this case the XML parser) loses the context of what the user was doing at the time, while reporting the error in terms of what the user was doing loses information about how and why it failed. Our general approach should be to concatenate the error messages: first report what the user was doing, then report what went wrong:
Error reported by XML parser when compiling stylesheet using compileFromString(): Error on line 1 column 1 of file: SXXP0003: Content is not allowed in Prolog.
The message "The most recent Stylesheet Object failed or has not been set." feels like it's referring to Saxon internals rather than something the user is in control of?
The part of the message saying what method was being called is redundant if a stack trace is output that contains this information.
Updated by O'Neil Delpratt about 4 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
I have changed the error message to the following pattern:
Error: No stylesheet found. Please compile stylesheet before calling applyTemplatesReturningValue or check exceptions
Please register to edit this issue