That was a one good solution. But i do want to know that is there is any rule that an XML may or may not contain the Parent Node.
But as i am using DOM to parse the XML, i require the parent node for sure.
Please let me know whether there is any other possibility to parse the XML which doesn't have a parent Node.
I am Using DOM Parser for now. Is it the good practice or else i should go for SAX. Please Help me which is better way to parse and WHY?