Capturing Errors from Oracle's XSDBuilder

Discussions

XML & Web services: Capturing Errors from Oracle's XSDBuilder

  1. Capturing Errors from Oracle's XSDBuilder (1 messages)

    I have tried to find the answer elsewhere, but now I am coming back to the panacea that is The ServerSide! I am using Oracle's XML software to do something I don't find many others doing--testing to see if an XML Schema document meets the W3C specifications. No instance document is involved at all.

    To do this, I have code similar to the following:

        try {
          XSDBuilder xsdb = new XSDBuilder();
          xsdb.build(schemaLocation);
          //Not saving the reference to the returned
          //XMLSchema object because not needed
        }
        catch(XSDException xsde) {
         .
         .
        }

    This is of course quite simple. The problem is that while the errors are being reported quite well to the console, capturing them as Java exceptions is not so trivial. The XSDException object's getMessage() method has the message for the first error only. The line and column information are absent, and I don't get anything (line, column, or message) for any subsequent errors.

    For those of you who may have some familiarity, I have tried to use the XSDBuilder with the XMLError object and its setErrorHandler method to try to capture the errors as Java exceptions. However, when I use the XMLError object, errors are no longer being reported to the console either--let alone as Java exceptions. Thus even though it seems intuitively like a step in the right direction, I end up worse off!

    I am truly at a loss and need the answer fairly quickly. The APIs and documentation don't offer much latitude or much help of any kind, so I would appreciate any insight you could provide.

    Thanks very much.
  2. OK well I actually figured this out--almost. I simply use the methods in XMLError to retrieve all error information. My only problem now is that while I can find message text for all errors from the XMLError.getMessge(index) method, the getLineNumber(index) and getColumnNumber(index) methods both return 0 for all errors. This looks like a bug, but any help would be appreciated. Thanks.