• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

xml schema like validation check

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not a beginner's topic. Moving.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You don't sound dense; this is however too complicated a question for the beginner's forum.
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic