0

I am new to this validation process in Java...

-->XML file named Validation Limits

-->Structure of the XML

parameter /parameter

lowerLimit /lowerLimit

upperLimit /upperLimit

enable /enable

-->Depending the the enable status, 'true or false', i must perform the validation process for the respective parameter

--> what could be the best possible method to perform this operation...

I have parsed the xml (DOM) [forgot this to mention earlier] and stored the values in the arrays but is complicated with lot of referencing that take place from one array to another. If any better method that could replace array procedure will be helpful

Thank you in advance.

Jeetesh Nataraj
  • 608
  • 2
  • 8
  • 20

1 Answers1

0

Try using a DOM or SAX parser, they will do the parsing for you. You can find some good, free tutorials in the internet.

The difference between DOM and SAX is as follows: DOM loads the XML into a tree structure which you can browse through (i.e. the whole XML is loaded), whereas SAX parses the document and triggers events (calls methods) in the process. Both have advantages and disadvantages, but personally, for reasonably sized XML files, I would use DOM.

So, in your case: use DOM to get a tree of your XML document, locate the attribute, see other elements depending on it.

Also, you can achieve this in pure XML, using XML Schema, although this might be too much for simple needs.

Miki
  • 7,052
  • 2
  • 29
  • 39