Purpose |
This element allows you to specify a server extension query function whose return value is used as the default value for an element or attribute in the schema. The function call is executed whenever a default value is needed, i.e. when validation encounters an optional attribute which is not present in the document but has such a default, or the analogous case for an element. However, these default values can be overwritten by the user. The function is only possible for simple elements with or without attributes. The function takes no parameters and returns a string value. |
Parent element | tsd:default |
Child elements |
None |
Attributes | None |
The following example shows the use of the tsd:function
element:
<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <tsd:schemaInfo name="person"> <tsd:collection name="person"></tsd:collection> <tsd:doctype name="person" /> </tsd:schemaInfo> </xs:appinfo> </xs:annotation> <xs:element name="person"> <xs:complexType> <xs:sequence> <xs:element name="name" type="xs:string"> <xs:annotation> <xs:appinfo> <tsd:elementInfo> <tsd:logical> <tsd:default> <tsd:function xmlns:company="http://www.company.com/functions" name="company:createDefaultString"/> </tsd:default> </tsd:logical> </tsd:elementInfo> </xs:appinfo> </xs:annotation> </xs:element> <xs:element name="first" type="xs:string"></xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema>