Make XML Tag InDesign CS

Hi All,

I have a InDesign document with so many pages. I want to make XML tag of name in the following hirarchy. Please do some needful I just need a help on it of how I should have to start rest of all I will do it myself.

dtdbook
level1
level2
p(value:class)
level3
list(value:a)
p
level4
etc.

Thanks a ton…
Pooja