jQuery in Action, 3rd edition
The moose likes Java in General and the fly likes xml schema like validation check Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "xml schema like validation check" Watch "xml schema like validation check" New topic

xml schema like validation check

Udayan Kumar
Ranch Hand

Joined: Jan 16, 2007
Posts: 66
Hi All,

Our current application is exposed to be triggered by external apps.
The input for the same being a custom complex java object. We validate this input java object for null checks and empty strings.
Now the check happens in a very generic fashion. What we want to develop is a routine something how xml schema validation happens where in the error message back to the invoking application we can give elaborate details which attribute was null or which string attribute was empty.
Pardon me if I sound dense.
Since the checks we have in java are generic I only manage to return a message back to the calling app like "Invalid input" but what I want to acheive is "String str is empty" or "Object xyz is null" as part of the return error message.
I was wondering in the generic check how can we introspect the attribute name. What i eventually want to do is list out all erroneous attributes and list down the error description for each and send them back to the calling app.

Do let me know your thoughts

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
Not a beginner's topic. Moving.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
You don't sound dense; this is however too complicated a question for the beginner's forum.
Martijn Verburg

Joined: Jun 24, 2003
Posts: 3275

Hi Uday,

Have you perchance had a look at how Apache Command Line Interface project deals with this? Look up their concept of validators and you may see some ideas you like.

In terms of introspection, I assume you've looked at the Reflections API?

Hope that helps steer you in the right direction!

Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
I agree. Here's the link: http://aspose.com/file-tools
subject: xml schema like validation check
It's not a secret anymore!