Differences between revisions 1 and 2
Revision 1 as of 2008-05-02 06:08:06
Size: 2426
Comment:
Revision 2 as of 2009-09-20 23:36:29
Size: 2426
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Type Alternatives

  • Type alternatives are used to specify a governing type definition for an element based on some conditions (generally based on the attribute values of the element). Specification found at http://www.w3.org/TR/xmlschema11-1/#cTypeAlternative

  • When <alternative> elements are specified in an element declaration they should be specified as the child elements of the <element> element. These <alternative> child elements build up the type table for the element declaration.

  • Type alternatives are used to specify a governing type definition for an element based on some conditions (generally based on the attribute values of the element).
  • When <alternative> elements are specified in an element declaration they should be specified as the child elements of the <element> element. These <alternative> child elements build up the type table for the element declaration. * An element declaration may have a type definition property and <alternative> elements at the same time. This may even cause the declared type definition of the element to be diffrent from the governing type definition.

  • All <alternative> elements in a type table except the last one must have a 'test' attribute. (The last <alternative> element in the type table may have a 'test' attribute). Otherwise the 'element declaration reprsentation ok' condition is violated.

  • Every <alternative> element must have a type definition property in the form of a 'type' attribute or a 'simpleType' child element or a 'complexType' child element. There should be at least one of these but not more than one.

  • If non of the alternatives do not succesfully selects a type (ie non of the tests evaulate to true) then;
    • If the last <alternative> element of the type table does not have a 'test' attribute the type definition corresponding to the last <alternative> element will be assigned to the element

    • If the last <alternative> element of the type table has a 'test' attribute then the type definition of the parent <element> element will be assigned to the element

  • Apart from the compulsory type definition property an <alternative> element may have an 'id' attribute, 'test' attribute, 'xpathDefaultNamespace' attribute and <annotation> elements.

  • Dynamic errors and type errors that might occur during the evaluation of the 'test' expression causes the test to be considered as failed.

HiranyaJayathilaka/xerces2j/type-alternatives (last edited 2009-09-20 23:36:29 by localhost)