第二十五章 控制到 XML 模式的映射 - 将文字属性映射到 XML 模式

第二十五章 控制到 XML 模式的映射 - 将文字属性映射到 XML 模式

将文字属性映射到 XML 模式

本节讨论如何将文字(非集合)属性投影到 XML 类型,以及影响 XML 架构的选项。它讨论了以下内容:

  • 数据类型类的默认 XSD 类型
  • 影响架构的编译器关键字
  • 影响架构的参数

IRIS 数据类型类的默认 XSD 类型

如果类或类属性基于常见 IRIS 数据类型类之一,则将根据下表自动设置 XML 类型。 %xsd 包中的类直接映射到 XML 类型,如表中所示。

%Library%xsd 包中 IRIS 数据类型的 XM 类型

IRIS Class in the %xsd Package IRIS Class in the %Library Package XSD Type Used in Projections to XML
%xsd.anyURI anyURI
%xsd.base64Binary %Binary%Status base64Binary
%xsd.boolean %Boolean boolean
%xsd.byte %TinyInt byte
%xsd.date %Date date
%xsd.dateTime %PosixTime%StringTimeStamp%TimeStamp dateTime
%xsd.decimal %Currency%Decimal%Numeric decimal
%xsd.double %Double double
%xsd.float float
%xsd.hexBinary hexBinary
%xsd.int int
%xsd.integer integer
%xsd.long %BigIn%Integer long
%xsd.negativeInteger negativeInteger
%xsd.nonNegativeInteger nonNegativeInteger
%xsd.nonPositiveInteger nonPositiveInteger
%xsd.positiveInteger positiveInteger
%xsd.short %SmallInt short
%xsd.string %Name%String%List string
%xsd.time %Time time
%xsd.unsignedByte unsignedByte
%xsd.unsignedInt unsignedInt
%xsd.unsignedLong unsignedLong
%xsd.unsignedShort unsignedShort

有关 XML 数据类型的信息,请参阅 https://www.w3.org/TR/xmlschema-2/。

例如,考虑以下类:

Class Schema.DataTypesDemo Extends (%RegisteredObject, %XML.Adaptor)
{
    
    

Parameter XMLTYPENAMESPACE="mytypes";

Property binaryprop As %xsd.base64Binary;

Property booleanprop As %Boolean;

Property dateprop As %Date;

Property datetimeprop As %TimeStamp;

Property decimalprop As %Numeric;

Property integerprop As %Integer;

Property stringprop As %String;

Property timeprop As %Time;

}

该类的架构如下:

<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:s="http://www.w3.org/2001/XMLSchema" 
elementFormDefault="qualified" targetNamespace="mytypes">
  <complexType name="DataTypesDemo">
    <sequence>
      <element minOccurs="0" name="binaryprop" type="s:base64Binary"/>
      <element minOccurs="0" name="booleanprop" type="s:boolean"/>
      <element minOccurs="0" name="dateprop" type="s:date"/>
      <element minOccurs="0" name="datetimeprop" type="s:dateTime"/>
      <element minOccurs="0" name="decimalprop" type="s:decimal"/>
      <element minOccurs="0" name="integerprop" type="s:long"/>
      <element minOccurs="0" name="stringprop" type="s:string"/>
      <element minOccurs="0" name="timeprop" type="s:time"/>
    </sequence>
  </complexType>
</schema>

猜你喜欢

转载自blog.csdn.net/yaoxin521123/article/details/134798029