These questions are taken from a message from the W3C XML Query WG:
Some subsidiary or related questions, which probably also need to be publicly answered:
The following three quotes are fundamental background for answering the above questions:
The processor starts from Schema-Validity Assessment (Element) (§3.3.4) with no stipulated declaration or definition, and either ·strict· or ·lax· assessment ensues, depending on whether or not the element information and the schema determine either an element declaration (by name) or a type definition (via xsi:type) or not.
[Definition:] If either case of clause 1 above holds, the element information item has been strictly assessed.
If the item cannot be ·strictly assessed·, because neither clause 1.1 nor clause 1.2 above are satisfied, [Definition:] an element information item's schema validity may be laxly assessed if its ·context-determined declaration· is not skip by ·validating· with respect to the ·ur-type definition· as per Element Locally Valid (Type) (§3.3.4).
Note the use of the word may in the second quoted paragraph above: the implication is that processors have a choice here.
Note that if an element is ·laxly assessed·, then the [type definition] and [member type definition] properties, or their alternatives, are based on the ·ur-type definition·.
But note also that lax assessment is not the only alternative to strict assessment---as pointed out above, no assessment is also an option.
Some clarification of the question is required before giving the answer. Even in the absence of any user- or file-specified schema document, there is none-the-less always a schema present when schema validity assessment is performed, namely the schema composed of all those components a conformant schema processor is required to have built-in, namely the ur-type definition, the simple ur-type definition and the primitive and derived built-in simple type definitions, as well as the attributes from the XMLSchema-instance namespace. Let's call this the built-in schema. So the revised question is "What type information is associated with the attributes and elements in the PSVI of a document schema-validated using only the components of the built-in schema, assuming no built-in type definition is mandated for use in validation?".
Since there are no element declarations available in the built-in schema, and by stipulation none of the available types is called for (if it were, then only the first or second outcomes below would be possible), the alternative quoted above at Initiating Validation must be used by the processor to begin validation. It follows that there are four possible answers to the question:
xsi:type declaration on the
document element. There are no other elements and no attributes.
xsi:type
declaration is present on the document element but its contents are not valid
with respect to that declaration, or because it has attributes, or because the
named type definition is not present in the built-in schema. What happens to
the other elements and attributes in the document, if any, depends on the
processor's error recovery policy.
One would hope that a processor which chooses option (3) would not, during the resulting recursion, ever choose option (4), but the REC does not rule this out.
Lax validation is never mandated -- it always occurs at processor option. There are at least four ways in which it may arise:
processContents='lax';
processContents='strict', but no
global declaration for the element was found (an error will be recorded, but
processors may continue validation);
The PSVI outcome of case (1) was dealt with in the previous section. For the others, it is as follows (cases (1) and (2) below are not possible for case (4) above):
xsi:type declaration on the element which was satisfied by its
contents and attributes. Validation proceeds as normal for the attributes and
children, if any.
xsi:type
declaration is present on the element but its contents/attributes are not valid
with respect to that declaration, or because the
named type definition is not present in the schema. What happens to
the element's children and attributes, if any, depends on the
processor's error recovery policy.
Skip validation may arise in two ways: Because an element in element or mixed content was allowed because
of a wildcard particle with processContents='skip', or because one
of the circumstances in which lax validation might arise occurs, but the
processor declines the option. The results are indistinguishable:
no type information is present in the PSVI, that is, there is no
[type definition] property, or any of its alternatives and
associates, on the relevent element information item.
The PSVI contains one rooted, well-connected set of attribute and element information items per validation episode which share a single value for the [validation context] property, namely the root of the set. If skip validation occurs at any point, the lower frontier of this set may not co-incide with the frontier of the original Infoset. Every node in the set has values for the [validity] and [validation attempted] properties, which together with the value of the [type definition] property contain sufficient information to diagnose exactly what happened at each step in the validation episode.
C. M. Sperberg McQueen transcribed and elaborated a table of possible outcomes which we and Richard Tobin constructed last June on a whiteboard in Edinburgh.