I have the following XML file which includes internal DTD validation:
In principle you can do:
... schema goes here ...
... instance goes here ...
But (a) there's no guarantee that any particular schema processor will support this form of location URI, and (b) it's hard to see the point.
I know it's done with DTDs, but I've never really understood:
(i) if you want to validate a document, surely you want to know what schema it's valid against, rather than trusting it to define its own? What use is it to know "this document is valid against some schema but I've no idea what's in that schema"?
(ii) when did you ever have a schema that described only a single instance document? Schemas by their nature define classes of document, and those classes are rarely singletons.