Array of Classname
Array of Classname
This section shows the part of an XML schema that is generated from an XML-enabled class, when that class includes a property that is defined as Array of Classname. For example, consider the following property definition:
Property PropName As array Of %Integer(XMLITEMNAME = "MyXmlItemName", XMLKEYNAME = "MyXmlKeyName");
If this property is in an XML-enabled class named Test.DemoArray1, the XML schema for this class contains the following:
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mytypes">
<complexType name="DemoArray1">
<sequence>
<element minOccurs="0" name="PropName" type="s01:ArrayOfMyXmlItemNamePairOfMyXmlKeyNameLong" xmlns:s01="mytypes"/>
</sequence>
</complexType>
<complexType name="ArrayOfMyXmlItemNamePairOfMyXmlKeyNameLong">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s01:PairOfMyXmlKeyNameLong" xmlns:s01="mytypes"/>
</sequence>
</complexType>
<complexType name="PairOfMyXmlKeyNameLong">
<simpleContent>
<extension base="s:long">
<attribute name="MyXmlKeyName" type="s:string" use="required"/>
</extension>
</simpleContent>
</complexType>
...
</schema>
The following rules govern the names of the types:
-
For the PropName property, the corresponding type is named ArrayOfXMLItemNamePairOfXMLKeyNameType, where:
-
XMLItemName is the name of items in the collection as described as in Controlling the Element and Attribute Names for Array-Type Properties. For a data type property, the default item name is the property name with Item appended to the end. (For a object property, the default item name is the short class name.)
-
XMLKeyName is the name of the key for the collection as described in Controlling the Element and Attribute Names for Array-Type Properties. The default is the property name with Key concatenated to the end
-
Type is the XML type to which the property class is projected.
<element minOccurs="0" name="PropName" type="s01:ArrayOfMyXmlItemNamePairOfMyXmlKeyNameLong" xmlns:s01="mytypes"/>
Note:If XMLKeyName is identical to Type, then for the PropName property, the corresponding type is named ArrayOfXMLItemNamePairOfXMLKeyName. That is, the redundant array item is removed from the type name. To cause the type name to include the redundant name, specify the AllowRedundantArrayName property (of your instance of %XML.SchemaOpens in a new tab) as 1. Similarly, in a web service class, to include the redundant array item name in the type in the WSDL, specify the ALLOWREDUNDANTARRAYNAME parameter (of the web service class) as 1.
-
-
The type ArrayOfXMLItemNamePairOfXMLKeyNameType is defined as a <sequence> of another type, named PairOfXMLKeyNameType:
<complexType name="ArrayOfMyXmlItemNamePairOfMyXmlKeyNameLong"> <sequence> <element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s01:PairOfMyXmlKeyNameLong" xmlns:s01="mytypes"/> </sequence> </complexType>
-
The type PairOfXMLKeyNameType is an extension of the given XSD type. This extension adds an attribute named XMLKeyName:
<complexType name="PairOfMyXmlKeyNameLong"> <simpleContent> <extension base="s:long"> <attribute name="MyXmlKeyName" type="s:string" use="required"/> </extension> </simpleContent> </complexType>
The same rules apply when Classname refers to an object class. For example, consider the following property definition:
Property PropName As %ArrayOfObjects(XMLITEMNAME = "MyXmlItemName", XMLKEYNAME = "MyXmlKeyName");
Where Simple.Object contains two properties, MyProp and AnotherProp. If this property is in an XML-enabled class named Test.DemoObjArray, the XML schema for this class contains the following:
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
targetNamespace="mytypes">
<complexType name="DemoObjArray">
<sequence>
<element minOccurs="0" name="PropName" type="s01:ArrayOfMyXmlItemNamePairOfMyXmlKeyNameSimpleObject" xmlns:s01="mytypes"/>
</sequence>
</complexType>
<complexType name="ArrayOfMyXmlItemNamePairOfMyXmlKeyNameSimpleObject">
<sequence>
<element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s01:PairOfMyXmlKeyNameSimpleObject" xmlns:s01="mytypes"/>
</sequence>
</complexType>
<complexType name="PairOfMyXmlKeyNameSimpleObject">
<complexContent>
<extension base="s01:SimpleObject" xmlns:s01="mytypes">
<attribute name="MyXmlKeyName" type="s:string" use="required"/>
</extension>
</complexContent>
</complexType>
<complexType name="SimpleObject">
<sequence>
<element minOccurs="0" name="MyProp" type="s:string"/>
<element minOccurs="0" name="AnotherProp" type="s:string"/>
</sequence>
</complexType>
</schema>