Using your first code snipped, I get this error on validation:
[Xerces-J 2.7.1] Validating "zzz-text.xml" against "file://zzz-text.xsd" ... Ln 9 Col 45 - src-ct.1: Complex Type Definition Representation Error for type '#AnonType_studenttest'. When <complexContent> is used, the base type must be a complexType. 'integer' is a simpleType. 1 Errors
The second code is working. Should 'above' read 'below'?