Why can't I determine both the default attribute value and use = is required for the same attribute in XSD?

Section 3.2.3.2 of the W3C XML Schema recommendation states that if "default definition" and "use" are present in the attribute definition, "use" should have the actual value "optional."

I do not understand why. What's wrong with something like xs: attribute name = "..." type = "..." use = "required" default = "xy"? How can I simulate something like the attribute can not missing and has a default value of "xy"?

+4
source share
2 answers

The default value will never be used when use = "required", so that is unnecessary. This is not conceptually wrong, just useless.

+3
source

The default value determines what value the attribute takes if it is not specified in the document being checked. If it cannot be skipped from the document being checked, there is no dot indicating the default value.

+1
source

Source: https://habr.com/ru/post/1383093/


All Articles