Vilya Harvey wrote:
I'm sorry I didn't make it clear, but it's actually the code to perform the validation that I'm looking for. I have no problem writing loops in JavaScript! Thanks for the reply anyway,

Should have mentioned, but this is what I've tried so far:

==================
function ValidationErrorHandler_handleError(error) {
  this.errorsFound = true;
}

function ValidationErrorHandler() {
  this.errorsFound = false;
  this.handleError = ValidationErrorHandler_handleError;
}

function validateDocument(documentObj) {
  var handler = new ValidationErrorHandler();
  var docConfig = documentObj.domConfig;

  docConfig.setParameter("error-handler", handler);
  docConfig.setParameter("validate", true);
  documentObj.normalizeDocument();

  return handler.errorsFound;
}
==================

The ValidationErrorHandler class is supposed to be an implementation of the
This fails with a TYPE_MISMATCH_ERR message on the line which sets the handler on the docConfig object. Presumably that's because ValidationErrorHandler doesn't explicitly implement the DOMErrorHandler interface, but I don't know JavaScript well enough to know how to make it implement that interface.


Initially I tried just calling docConfig.setParameter("validate", true) followed by the call to normalizeDocument(). That works, in so far as the document does get validated against the schema, but there doesn't seem to be a way of finding out whether validation succeeded or not. I was hoping an exception would be thrown if validation failed, but instead it just fails silently in the absence of an error handler.

So that's where I'm at now. I guess I could implement the ValidationErrorHandler in java; that'll be the next step. Any other suggestions would be great though!
--
__
o| _. / \|o._ _ _ ._ _ ._ _ _|_
\/ ||\/(_|| (|/||| |(/_(_)| |(/_o| |(/_ |_
/ \__
http://website.lineone.net/~vilya


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to