David Spades wrote:
1. Does the element must be <schema>?
If you mean element by the root element commonly appeared in a (w3c xml) schema document, then absolutely. But that piece of element itself can pick up any meaning it is destined to mean. That being what you mean, then yes, it must be named "schema".
2. What's the purpose of "target" namespace?
"target" is a prefixed declared in the namespace declaration xmlns:target="...". This is said in order not to confuse with the targetNamespace attribute. But your meaning is clear. The purpose should be asked like this : what is the purpose of the namespace declaration xmlns:target="...". The purpose of such declaration is that within the schema document, sometimes not always, needs arise that the author(s) has to make reference to some top-level schema element (xs:element, xs:complexType, xs:simpleType etc...) defined in that namespace (which happens to be the targetNamespace of the schema itself, but it can be some other namespace(s), not as rarely happens as you might think). In that case, you need the prefix to construct a fully-qualified name to refer to it.
You can however conceive a schema simple enough not to have that happens. In that case, that kind of declaration may perfectly not be appearing. It is not a rule that it must be there as such with a namespace uri coincides with the targetNamespace. No.
3. What's the purpose of targetNamespace attr?
The targetNamespace attr is to declare to the users of the schema document that this schema is purporting to define vocabulary and grammar of that specific namespace. In the case of targetNamespace being absent, things can be more complicated. To simplify the first step perception, it means that schema document is to do the defining work for the null (or empty) namespace. If however you couple the piece of schema in a grand design layout, that can be more complicated in the interpretation. But leave that aside for the moment as it won't help, and rather it confuses the issue prematurely.
David Spades wrote:
1. Does the namespace must point to the same location as target in schema?
If you mean the "default" namespace declaration and that you mean the above schema is meant to validate this document instance, then yes.
2. how does the schemalocation affect the physical file location?
The schemaLocation does not force the users to have the schema document physical file being named name5.xsd nor its presence in the baseURL, whatever it means... It is good to have that happens, but it has no binding obligation the application using the schema to follow that setting. That is what the recommendation means by saying that "physical" location is just a "hint". The author of an application using the schema has the full control of where to get the validating schema rather than the name5.xsd sitting somewhere of some baseURL agreed upon. A "hint" may help and very often help a lot. But it does not mandate the application following it.
ps You've to use simple double quotes in the document where you use magic quotes.