You'll need to keep track of the level of the last BAY_NO element you've parsed. Assuming that those elements can only be nested one level deep -not multiple levels- a boolean will suffice for this. You'd set it on the startElement method, and clear it in the endElement method.
As an aside, it looks as if the characters method is buggy. It assumes that something like "<tag>abc 123 def</tag>" will cause exactly one call to the characters method with a parameter of "abc 123 def". But that's not the case - that string can be split up into multiple consecutive calls, the string parameters of which will need to be concatenated.
I have tried to modified the startElement and endElement methods like Ulf described:
I am setting the isRowCreated flag(line 20) in the startElement method and unsetting it in the endElement method(line 55). Now, I cannot get the child nodes which have different name than the parent node in my output. The values inside the BAY_NO tags are visible on my output jsp.It seems that my code doesn't recognise the other child nodes which have different name than the parent node name.However,This code works fine for the xml files where the parent node names and child node names are different.
Hope that I made sense with the above. Please advice