• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xml schema like validation check

 
Udayan Kumar
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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

Uday
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not a beginner's topic. Moving.
 
Campbell Ritchie
Sheriff
Pie
Posts: 49367
62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't sound dense; this is however too complicated a question for the beginner's forum.
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic