Convert schema file to schema object saved in repository

Last modified 31 Mar 2026 21:35 +02:00

Since midPoint 4.9, the schema extension is stored in the database. Version before midPoint 4.9 use the schema extension as XSD files in the midPoint home directory.

This article describes a procedure to convert the schema from the XSD file to the SchemaType object. This procedure is a very simple shortcut—just paste the schema from the XSD file into the attribute definition that contains the SchemaType. Afterwards, import the new SchemaType object into midPoint.

Example

The following example shows a schema extension for user that adds one new attributes. Example is in the XSD file format.

Schema from file
<xsd:schema elementFormDefault="qualified"
        targetNamespace="http://example.com/xml/ns/mySchema"
	    xmlns:tns="http://example.com/xml/ns/mySchema"
	    xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
	    xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
	    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
	<xsd:complexType name="UserExtensionType">
		<xsd:annotation>
			<xsd:appinfo>
				<a:extension ref="c:UserType"/>
			</xsd:appinfo>
		</xsd:annotation>
		<xsd:sequence>
			<xsd:element name="officeNumber" type="xsd:string" minOccurs="0" maxOccurs="1">
				<xsd:annotation>
					<xsd:appinfo>
						<a:indexed>true</a:indexed>
						<a:displayName>office number</a:displayName>
						<a:displayOrder>120</a:displayOrder>
					</xsd:appinfo>
				</xsd:annotation>
			</xsd:element>
		</xsd:sequence>
	</xsd:complexType>
</xsd:schema>

New SchemaType object prepared for import into midPoint.

Schema from file
<schema>
    <name>UserExtension</name>
    <definition>
        <xsd:schema elementFormDefault="qualified"
                targetNamespace="http://example.com/xml/ns/mySchema"
                xmlns:tns="http://example.com/xml/ns/mySchema"
                xmlns:a="http://prism.evolveum.com/xml/ns/public/annotation-3"
                xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">

            <xsd:complexType name="UserExtensionType">
                <xsd:annotation>
                    <xsd:appinfo>
                        <a:extension ref="c:UserType"/>
                    </xsd:appinfo>
                </xsd:annotation>
                <xsd:sequence>
                    <xsd:element name="officeNumber" type="xsd:string" minOccurs="0" maxOccurs="1">
                        <xsd:annotation>
                            <xsd:appinfo>
                                <a:indexed>true</a:indexed>
                                <a:displayName>office number</a:displayName>
                                <a:displayOrder>120</a:displayOrder>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>
    </definition>
</schema>

For information about schema extensions, see Schema Extension.

Was this page helpful?
YES NO
Thanks for your feedback