At the XSD level, can I define an element requirement based on presence of another element in the document?
For example, I want to require the element <firstname /> be provided whenever the <id /> element is also present, otherwise first name is optional.
If this cannot be enforced at the XSD level, then should I make both elements optional and enforce the requirement through a different level of checking?
Options welcome.
This cannot be enforced at the XSD level.
Making both elements optional and enforcing the requirement at a different level in the application architecture sounds like a good option to me.