Firstly, the schemaLocation attribute is only one way to specify the location of a schema, and in many cases it's not the best way (if you don't trust the document to be valid, why would you trust it to tell you where its schema is?). Most schema validators are likely to provide the option of giving a schema location externally, e.g. on the command line or via an API or GUI.
Secondly, the schemaLocation is a URI. It can therefore be a relative URL, for example "test.xsd" identifies a schema document sitting in the same directory as the source document.