What ways, methods exist to build XML hierarchy string,
If I have ID, PARENTID columns in Data base Table.
I am not understanding what you need, but I find it perfectly feasible to parse an XML document into a DOM and then use the DOM as the only representation of the data I need. This preserves the hierarchy of the original document and if you modify the data you can transform it back to a new XML file.
This is really nice and informative information dear.