16.1.3. XDTO data types


<< Prev   Next >>

16.1.3.1. General information

Each type of XDTO data is either a XDTO value type or XDTO object type. So, to describe a value type, use the XDTOValueType object. To describe an object type, use the XDTOObjectType object.

The XDTOValueType object is used to describe types of simple indivisible values, which cannot be divided into parts. These are, for example, various strings, numbers, date and so on.

The XDTOObjectType object is used to describe to types of data instances that have a state presented as a set of this data instance property values. The property types of this data instance can be both XDTO value types and XDTO object types.

The XDTOValueType and XDTOObjectType has the same properties:

  • Name. Type name.
  • NamespaceURI. URI of the namespace where this type is defined.

Value of these properties correspond to the similar parameters identified for the type in the XML schema. The type name and namespace URI create a unique type identifier. The type name must be set. The NamespaceURI property may contain an empty string although this is undesirable.

16.1.3.2. XDTO value type

According to the rules for simple type from an XML schema, you can define an XDTO value type using the following ways:

  • By limiting when you set a base type (the BaseType property) and a set of limits for the set of possible values (the Facets property).
  • By merging when the type is the result of merging several value types. The merged types are listed in the MemberTypes property.
  • By a list when the value is a list of values. Set a value type of items included in the value list in the ListItemType property.

Besides the Name and NamespaceURI properties, the XDTO value type contains the following properties:

  • BaseType. A base type for this XDTO value type. Base type can be inherited but only from other types of XDTO values. The acceptable set of values of the inherited type is the subset of possible base value set. The upper level of the simple types hierarchy is the predefined anySimpleType type from http://www.w3.org/2001/XMLSchema namespace. All value types are directly or indirectly inherited from this type. The types created by merging or by the list are always directly inherited from anySimpleType.
  • Facets. A list of facets limiting the set of possible values against the base type. The list of facets is only set for XDTO value types that are defined by limiting the base type. Each facet is a pair: a facet name and a value. The list of possible facet names is defined. Not all available facets can be applied to the type. The list of facets and their applicability to some type are defined by the XML Schema rules (http://www.w3.org/TR/xmlschema-2/).
  • MemberTypes. A list of types that constitute the merging. Only XDTO value types can be merged. If the type is created by merging, the MemberTypes list includes at least one type. The Facets list must be empty and the ListItemType property must retrieve an undefined value.
  • ListItemType. When an XDTO value type is defined by a list, this property shows a list item type. In this case, the Facets and MemberTypes lists must be empty.
  • The list of available facets names (defined by the XDTOFacetType system enumeration):
    • Length. A length facet. Contains a number of length units. The length unit has different meaning for different types. For the string and anyURI types, the length includes the number of characters. For the hexBinary and base64Binary types, the length includes the number of binary data bytes. For the types defined by the list, the length includes the number of list items.
    • MaxInclusive. A facet of the maximum including the limit. Limits the value space of this type with the maximum value. Any value of this type is less or equal to the specified value.
    • MaxLength. A facet of the maximum length. Includes the maximum number of length units. The length unit has different meaning for different types. For the string type, the maximum length includes the maximum number of characters. For the hexBinary and base64Binary types, the maximum length includes the maximum number of binary data bytes. For the types defined by the list, the maximum length includes the maximum number of list items.
    • MaxExclusive. A facet of the maximum excluding the limit. Limits the value space of this type with the maximum value. Any value of this type is less than the specified value.
    • MinInclusive. A facet of the minimum including the limit. Limits the value space of this type with the minimum value. Any value of this type is larger or equal to the specified value.
    • MinLength. A facet of the minimum length. Includes the minimum number of length units. The length unit has different meaning for different types. For the string type, the minimum length includes the minimum number of characters. For the hexBinary and base64Binary types, the minimum length includes the minimum number of binary data bytes. For the types defined by the list, the minimum length includes the minimum number of list items.
    • MinExclusive. A facet of the minimum excluding the limit. Limits the value space of this type with the minimum value. Any value of this type is larger than the specified value.
    • Pattern. A pattern facet. Includes regular expression that defines the value space of this type.
    • Enumeration. An enumeration facet. Defines the set of acceptable values for this type.
    • SpaceCharacters. A space character facet. It can take the following three values:
      • Save. A string can contain any space characters.
      • Replace. A string cannot contain #x9 (TAB), #xA (linefeed), and #xD (carriage return). If they are present, they must be replaced with #x20 character (space).
      • Collapse. In addition to the requirements for the replace value, a string cannot contain #x20 (space) double characters and leading or closing #x20 (space) characters.
    • TotalDigits. A facet of the total number of digits. Includes the total number of digits (both integer and fractional part).
    • FractionDigits. A facet of the number of fraction digits. Includes the number of digits in the fractional part of the number.

The XDTO infrastructure defines a set of predefined XDTO value types. This set matches a set of primitive types defined in XML Schema Part 2: Datatypes. Predefined types create a hierarchy in accordance with XML Schema Part 2: Datatypes. Type names correspond to type names in XML Schema and belong to the namespace URI: http://www.w3.org/2001/XMLSchema. The predefined types are automatically registered in any XDTO factory.

16.1.3.3. XDTO object type

Besides the Name and NamespaceURI properties, an XDTO object type includes the following properties:

  • BaseType. A base type for this type. This may be an XDTO object type only. Th base type in XDTO object hierarchy is the predefined anyType type from http://www.w3.org/2001/XMLSchema namespace. All XDTO object types are inherited from this type directly or indirectly.
  • Open. Indicates whether the XDTO object type is open. This property indicates whether an instance of an XDTO object can contain additional properties that are not defined in its type, meaning it implements the open content model. It corresponds to appearance of the following descriptions in the XML schema for this type: <anyAttribute> and <any>.
  • Abstract. Indicates whether the XDTO object type is abstract. It corresponds to appearance of the abstract="true" attribute item in the schema.
  • Ordered. Indicates whether the order of property value items matches the order of XDTO object type properties. If the xsd:all content model i set then the order of XML elements can be arbitrary. The acceptable order corresponds to the order of properties in the type. If the Ordered property is False, the sequence of XML elements is not controlled at the input and is determined by the property sequence at the output unless the Sequenced flag is True.
  • Sequenced. Indicates whether the instance of the respective XDTO object contains the XDTO sequence. This flag is True when the order of nested XML elements cannot be unambiguously defined by order of properties in the type (for example, in XML schema the content is set as <sequence … maxOccurs=10 … >) or the mixed="true" attribute is set for the XML type in the schema. The XDTO sequence allows you to explicitly define the sequence of the items as they appear in the XML document. For objects of types whose Sequenced property is set to False, the sequence of nested elements matches the sequence of properties.
  • Mixed. Indicates whether mixed content for this type is defined in the XML schema. If the Mixed property is True, then the Sequenced value must be True as you cannot model mixed content without using the XDTO sequence.
  • Properties. A list of properties defined for this XDTO object type. Each property is presented as an instance of the XDTOProperty object. The list includes all properties, including properties defined in the base type.

There is a predefined XDTO object type called anyType and http://www.w3.org/2001/XMLSchema namespace URI. This is a base type for each XDTO object type but it does not have a base type. It is open, not abstract. It implies that there is a sequence and has an blank property list.

This XDTO object type matches the anyType type defined in XML Schema Part 2: Datatypes.

16.1.3.4. XDTO property

A specific property of a specific XDTO object is described using the XDTOProperty object. This means that the same instance of the XDTOProperty object cannot be used to describe properties in different XDTO object types and two different properties of one XDTO object type.

The XDTOProperty object has the follwing properties:

  • Name. A property name. Within the XDTO object of the same type, property names must be unique.

    When generating the XDTO data model based on the XSD schema, the names of XDTO properties are based on the attributes and items names described in the schema. The model is built sequentially. At first, the list of values is created based on the attributes and then based on the items, in the order they are presented in the schema.

    The name is aligned to 1C:Enterprise language naming rules. Characters acceptable in an XML name (for example, a point "." or a hyphen "-") but unacceptable for 1C:Enterprise language are replaced with an underscore "_". In case of attribute and item name doubling, the duplicate is assigned with a name extended by the numeric suffix (starting with 1).

  • Type. A property type. It can be both an instance of the XDTOValueType object and an instance of the XDTOObjectType object.
  • UpperBound. An XDTO object type property can be defined as containing one or multiple values. A property is considered to contain one value if it equals one. If the UpperBound property is greater than one, it is considered that it can contain multiple values. Such property is modeled as a list in the object structure. Note that it is not a list in an XDTO value type description. The UpperBound property indicates the maximum number of property values. A value greater than one can be set only for properties that are presented as an XML element. The UpperBound property corresponds to the xsd:maxOccurs attribute in XML Schema. The ‑1 value corresponds to unbounded.
  • LowerBound. The minimum number of property values. The minimum number of property values can be less or equal to 0. The LowerBound value must be less than or equal to the UpperBound value, unless the UpperBound value is equal to ‑1.
  • Nillable. Indicates whether the property can have an undefined value. An undefined property value is presented in XML as an element that looks as follows: <elem xsi:nil="true" />. So, the Nillable property that is set to True can only be defined for properties with the Element presentation form. The Nillable property corresponds to the xsd:nillable attribute in the XML Schema. If the UpperBound property value is greater than one, an undefined value is valid for a property value list item.
  • DefaultValue. A default property value. The only possible default value is XDTODataValue. This property must be of the same type as the type of the property or of the inherited type. When creating an XDTO object, the property is set to the default value if it can have only one value. The IsSet() method of the XDTO object returns False for this property. For properties with multiple values, the list of values is initially empty, regardless of whether the default value is defined or not.
  • Fixed. Indicates whether the property value is fixed. If set to True, the fixed value itself can be retrieved through the DefaultValue property.
  • Form. A property presentation form in XML. Possible options: Text, Item, or Attribute. If the presentation form is Attribute or Text, the value of the UpperBound property cannot be greater than one. If the property is set to Text, the LowerBound property value must be equal to one as well. One type contains only one property that can have the Text presentation form. The other properties must have the Attribute presentation form.
  • LocalName. A local name of an attribute or an element used to present a property. For properties with the Text presentation form, it is an empty string.
  • NamespaceURI. A namespace URI for an attribute or an element used to present a property. It is an empty string if there is no namespace.

<< Prev   Next >>

Icon/Social/001 Icon/Social/006 Icon/Social/005 Icon/Social/004 Icon/Social/002