You are right that the validator must know the type associations of all the elements and attributes that it checks, and that the validator can thus provide access to this information.
However, for better or worse, both the API between the caller and the validator, and the choice of information related to the verification information available to the caller, are fully defined. Some validators (Xerces J is a great example) provide a complete set of validation data available; others do not.
Without knowing which validator you are using, no one can say with certainty whether the type information you are looking for is available. Since you are calling a validator, there must be an API; if type associations are available through the API, the documentation will probably say that. If the API does not provide access to it, this may be due to the fact that the main authentication module does not provide access to information, or it may be because the creator of the API did not see this point; your job (if you want to continue this) will be to figure out what comes of this, and then try to convince the relevant parties that it would be useful to make this information available.
If you are unable to access the information through the API, you can help yourself with a more complex version of the approach mentioned in another answer by David B. This XSD schema property that controls the type of any element is strictly a function of the path to this element from the validation root, therefore in principle (if this is more than a little tiring in practice) for any element in a document instance, you can determine what its control type will be if the document instance is checked for a specific scheme. For example, for the case you are talking about, it is simple to say whether a given wakeupNote deviceDescription or otherElement as an ancestor or which is the closest ancestor if wakeupNote has both, and infer a definition of the appropriate type of control based on this knowledge.
Assistance in this manner is likely to require a non-trivial amount of work. This would help if there were general-purpose tools for calculating this information and making it available in various forms, but if they exist, I do not know about them. (I know people who could build such a tool for a fee.) So, if I were you, I would try to get the information through the API first.
source share