Some guides on the Internet claim that ANY
means shutting down the validation process for this element, but this is not correct information. Content model ANY
in DTD doesn't actually mean "allow whatever well formed XML content in this element". Instead it means "allow any content defined in this DTD". This means that you will get an error for every element which content model you have not defined (or you can not define). Conceptually speaking this means the same as being unable to allow contents from another namespace.
Unfortunately at the moment I can't recall any way to do this with DTD. However, this is possible with XML Schemas:
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip"/>
</xs:sequence>
</xs:complexType>
This would allow any elements from any namespace and skip the validation for this element. If you are able to switch from DTDs to XML Schemas, this would solve your problem.
Note about a simple error when using ANY
(Original poster didn't have this error but I'm just mentioning it here since I'm already writing about this subject.)
This is a simple typo to make, but these two do not mean the same:
<!ELEMENT X ANY >
<!ELEMENT X (ANY) >
The first one refers to content model keyword ANY
but the second one means an element with name "ANY", and it's the parenthesis that cause this difference.