I found a simple solution to solve this problem. If the xmlString includes DOCTYPE, return error message "NO DOCTYPE needed" (Can you help me to rewrite the message more meaning to the user?).
I found en error in my sample. If the XML contain af reference to a DTD then the sample won't work, because the indexOf() will return -1(+2) and I'm checking for -1. I've made the change to the sample.
Rene, thank you very much! You are really an expert in JAVA! I feel so luck to have you working with me to solve my problems. I wish you can help me again.