Skip to main content

Compiler Keywords That Affect the Schema

Compiler Keywords That Affect the Schema

The Required keyword affects the XML schema, by removing the minOccurs="0" attribute. For example, consider the following class:

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

Parameter XMLTYPENAMESPACE="mytypes";

Property Property1 As %String;

Property Property2 As %String [ Required ];

}

If we generate a schema for the namespace used here, we see the following:

<?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="test">
  <complexType name="PropKeywords">
    <sequence>
      <element minOccurs="0" name="Property1" type="s:string"/>
      <element name="Property2" type="s:string"/>
    </sequence>
  </complexType>
</schema>

Note that the default for minOccurs is 1; that is, Property2 is required.

Note:

For compatibility reasons, %XML.ReaderOpens in a new tab does not check for required properties by default, but you can cause it to do so; see Checking for Required Elements and Attributes. Also by default, an InterSystems IRIS web service does not check for required properties, but you can cause it to do so; see Checking for Required Elements and Attributes.

No other property keywords affect the schema for data type classes.

FeedbackOpens in a new tab