Guessing 'list' attribute for heterogeneous lists

Last modified 22 Apr 2021 17:31 +02:00

XML serialization

See DomLexicalProcessor.isList(..) method:

  1. If list attribute is explicitly specified, it is used.

  2. If type is explicitly specified, then

    1. if it’s unknown, then "no list" is assumed;

    2. if it’s namespace-qualified, then the presence of list attribute is taken from the definition;

    3. if it’s unqualified, and there’s at least on definition has no list attribute, then "no list" is assumed.

  3. If type is not explicitly specified, we try to look up definition based on element name. If there’s no possible match with a list attribute, then "no list" is assumed.

So, in doubt (unqualified type name with all definitions having the list attribute or element name with at least one definition having the list attribute) we look at the content. We conclude it is a heterogeneous list if:

  1. no application attributes are present,

  2. and all child elements are compatible, that means they share a common "substitution head" root (and are marked as heterogeneousListItem in the schema).

Overall design considerations here are:

  1. "non-list is mistakenly recognized as a heterogeneous list" → this is a BIG PROBLEM. Must be avoided.

  2. "heterogeneous list is not recognized as such" → this is only a minor problem, because it is always fixable by manually putting 'list=true' in the serialized XML. However, it must not occur too often / regularly.

JSON/YAML serialization

In this case we know that we deal with heterogeneous lists when "@element" directive is present. This directive can be currently used only for heterogeneous lists and it must be present on all heterogeneous list items. Otherwise the results are unpredictable (but must probably explicit error will be raised).

Was this page helpful?
YES NO
Thanks for your feedback