State attribute

Build 1501 on 14/Nov/2017  This topic last edited on: 8/Nov/2012, at 15:21

There is the ‘gs:stateAttr’ schema extension attribute that declares for an object type which of its attributes represent its state. It applies to the ‘complexType’ element and contains the name of the state attribute – e.g.:

  <xs:complexType name="folderObject" abstract="true" gs:stateAttr="folderRef" >

    . . .

  </xs:complexType>

declares ‘foldereRef’ as the state attribute for ‘folderObject’ objects.

There can be only one state attribute for each object type. The state attribute declaration is optional: there can be object types without any associated state attribute. The state attribute must be a (single) reference attribute.

The state attribute declaration is automatically inherited – e.g. the declaration above specifies that ‘folderRef’ is the state attribute also for all the ‘folderObject’ descendants that do not declare explicitly a different state attribute.

It is possible to specify an empty state attribute name to ‘clear’ the state attribute definition – e.g.:

  <xs:element name="audio">

    <xs:complexType gs:key="folderRef name" gs:stateAttr="">

      <xs:complexContent>

        <xs:extension base="folderObject">

        . . .

        </xs:extension>

      </xs:complexContent>

    </xs:complexType>

declares an object type ‘audio’ that even if descends from ‘folderObject’ does not have a state attribute.

The object type’s state attributes are visible in the text dump of a schema – e.g.

  srv4 schema -s ..\config\schemas\gn4tera.xsd

produces the following (fragment) of output:

  objectType 'folderObject', Normal, abstract

      Common ancestor for all objects contained in folders

      stateAttr:folderRef

      descName: @name

      computeTransform:

        . . .

      attrType 'id', Normal, ord:1 id

      . . . 

‘GN4Base.xsd’ defines ‘folderRef’ as the state for folder objects as in the example above.