Using MS XML Parser v4.0, You can instantiate a DOMDocument40 object and the document's parseError property will expose well-formedness against any internal DTDs. If you use External DTDs then you must use the resolveExternal method. In the case of Schemas, you can instantiate a SchemaCache40 object and valdate against it.

For more info see:

msdn online

Cheers,

DJ