I need to create a schema for an XML file that is pretty flexible. It has to meet the following requirements:
Your requirement number 3 cannot be addressed if the name elements are optional because your schema would then violate the unique particle attribution rule (basically, the processor won't know whether to validate firstname against firstname or against any).
You are not restricted to a single schema as far as validation is concerned. If you are ok with using two schemas in different namespaces, you can do this:
Schema one - allow anything:
Schema two - add specific validation for some elements:
Then make sure your instance document's xsi:include references both schemas.