An XML file is text. You can either parse the text yourself using something like a perl script, or you can go the slightly more complicated route of getting an XML parser and having a script talk to that. It's a useful skill to learn, though.
If you want to go the latter route, if you send me the XML file, I'll send you back the XPATH expression necessary to find the docBase item. You will still need to find an XML parser and get it to work. I have no experience with tomcat.