Path to fetch/store xsi:type value

If there is no type modifier defined, then the path is parsed and validated against the declared type in the schema.

For example, in the XML instance:

<root>
        <child xsi:type="realtype" realattr="foo"/>
<root>

This address represents the value of the xsi:type attribute:

root.child(0).&xsi:type

Because xsi:type is a valid child for this element and is not tied to a particular type, this path is correct. The value returned is realtype.

  • In this case, where xsi:type is the source value (a retrieve), it validates whether the source value has a substituted type. If the value is not found, then this results in a FETCH_FAILED error.
  • If the xsi:type is the target value (a store) or if there were already children or attributes added, then this returns an error. This is because the type cannot be re-set until the element has been cleared using PATHCOPY.

Type modifier must be used for all attributes and children of type-substituted element.

Based on the previous section’s example, this path is not permitted:

root.child(0).&realattr

Because realattr is only permitted when child has been re-typed as realtype, when this path is evaluated against the instance there is an error:

XML Path Resolution Error: &realattr is not a valid attribute of element child(0) of type abstracttype.