Chapter 29 Controlling Mapping to XML Schema - List of Class Names

Chapter 29 Controlling Mapping to XML Schemas - List of Classname

List of Classname

This section shows part of the schema generated from a class that supports XML when the class contains properties defined as a list of class names. . For example, consider the following property definition:XML

Property PropName As list Of %Integer(XMLITEMNAME = "MyXmlItemName");

If this property is in an enabled class named Test.DemoList1, then the class's schema contains The following:XMLXML

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" 
targetNamespace="mytypes">
  <complexType name="DemoList1">
    <sequence>
      <element minOccurs="0" name="PropName" type="s01:ArrayOfMyXmlItemNameLong" xmlns:s01="mytypes"/>
    </sequence>
  </complexType>
  <complexType name="ArrayOfMyXmlItemNameLong">
    <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s:long"/>
    </sequence>
  </complexType>
...
</schema>

The name of the following rule management type:

  • For the PropName attribute, the corresponding type is named ArrayOfXMLItemNameType, where:

    • XMLItemName is the name of the item in the collection, as described in Controlling element and attribute names for list-type properties. For data type properties, the default item name is the name with Item appended to the end of the property name. (For object properties, the default item name is the short class name.)
    • Type is the type of XML that the attribute class maps to.
    <element minOccurs="0" name="PropName" type="s01:ArrayOfMyXmlItemNameLong" xmlns:s01="mytypes"/>
    

    Note: If XMLItemName is the same as Type, then for the PropName attribute the corresponding type will be named a>ArrayOfXMLItemName. That is, remove redundant array items from type names. To make the type name contain redundant names, specify the ( %XML.Schema instance) AllowRedundantArrayName attribute as 1. Likewise, in the Web service class, to include redundant array item names in the type WSDL , place (Web the service class)ALLOWREDUNDANTARRAYNAME parameter is specified as1.

  • Type ArrayOfXMLItemNameType is defined as another type <sequence> named XMLItemName:

      <complexType name="ArrayOfMyXmlItemNameLong">
    <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s:long"/>
    </sequence>
    </complexType>
    
  • The element XMLItemName is based on the XSD type corresponding to the data type class:

    <element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s:long"/>
    

When Classname refers to an object class, the same rules apply. For example, consider the following property definition:

Property PropName As list Of SimpleObject(XMLITEMNAME = "MyXmlItemName");

where Simple.Object contains two attributes: MyProp and AnotherProp. If this property is in an -enabled class named Test.DemoObjList, then the schema for that class contains the following: a>XMLXML

<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:s="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" 
targetNamespace="mytypes">
  <complexType name="DemoObjList">
    <sequence>
      <element minOccurs="0" name="PropName" type="s01:ArrayOfMyXmlItemNameSimpleObject" xmlns:s01="mytypes"/>
    </sequence>
  </complexType>
  <complexType name="ArrayOfMyXmlItemNameSimpleObject">
    <sequence>
      <element maxOccurs="unbounded" minOccurs="0" name="MyXmlItemName" nillable="true" type="s01:SimpleObject" xmlns:s01="mytypes"/>
    </sequence>
  </complexType>
  <complexType name="SimpleObject">
    <sequence>
      <element minOccurs="0" name="MyProp" type="s:string"/>
      <element minOccurs="0" name="AnotherProp" type="s:string"/>
    </sequence>
  </complexType>
...
</schema>

Guess you like

Origin blog.csdn.net/yaoxin521123/article/details/134890524