Understanding the ECLASS Advanced Filtering XML Schema

This topic provides a detailed explanation of the XML Schema Definition (XSD) file used for defining filters in the ECLASS Advanced filtering mechanism. This XSD file is a blueprint that describes how the XML document (filter definition) should be structured, including the elements and attributes that can be used, their data types, and the order in which they should appear.

Below is a brief description of the main elements in the XSD file used for defining filters in the ECLASS Advanced filtering mechanism:

  • xs:schema: This is the root element of the XML Schema document. It defines the form of the elements and attributes in an XML document.

  • xs:annotation and xs:documentation: These tags are used to add comments and notes within the schema. They don’t affect the structure or validation of the XML documents that the schema describes.

  • xs:element: This defines an element that can appear in the XML document. The example schema below uses this to define the name as 'EclassFilter.'

  • xs:complexType: This defines a complex type that groups a set of element and attribute declarations. Complex types like 'Header,' 'Name,' 'Application,' and others are defined in the example schema below.

  • xs:sequence: This specifies that the child elements must appear in a sequence. Each child element can occur from zero to any number of times.

  • xs:attribute: This defines an attribute for an element. The attribute can be used in the start tag of an element. Attributes like 'id,' 'irdi,' 'orderNumber,' and others are defined in the example schema below.

  • xs:simpleType and xs:restriction: These define a simple type and its restrictions. For example, the 'StepID' simple type is a string with a maximum length of 40 is defined in the example schema below.

  • xs:choice: This allows only one out of several possible elements to be present. In the example schema below, the 'Application' complex type is defined with a choice between 'Property,' 'Block,' and 'Aspect' elements.

Each of these elements and attributes has a specific purpose and rules that it must follow. The annotations in the schema provide additional information about the purpose of each element and attribute. For example, the 'EclassFilter' element is the root element for ECLASS application filters, and its 'id' attribute specifies the ID of the ECLASS application filters.

Below is an example XSD file:

Copy
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://www.stibosystems.com/eclass_filter"
           xmlns="http://www.stibosystems.com/eclass_filter"
           elementFormDefault="qualified" attributeFormDefault="unqualified">

    <xs:annotation>
        <xs:documentation>
            This XML schema definition describes a valid definition of the filters used in ECLASS Advanced filtering
            mechanism.
        </xs:documentation>
    </xs:annotation>

    <xs:element name="EclassFilter">
        <xs:complexType>
            <xs:annotation>
                <xs:documentation>
                    Root element for ECLASS Advanced application filters.
                </xs:documentation>
            </xs:annotation>
            <xs:sequence>
                <xs:element name="Header" type="Header" minOccurs="0" maxOccurs="1"/>
                <xs:element name="Application" type="Application" minOccurs="0" maxOccurs="unbounded"/>
            </xs:sequence>
            <xs:attribute name="id" type="StepID" use="required">
                <xs:annotation>
                    <xs:documentation>
                        Specifies the ID of the ECLASS Advanced application filters, but is not used in ECLASS Advanced editor.
                        The filter ID is taken from XML asset id (filter definition).
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:complexType name="Header">
        <xs:annotation>
            <xs:documentation>
                Optional filter information not used in ECLASS Advanced editor.
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="Name" type="Name" minOccurs="1" maxOccurs="unbounded"/>
            <xs:element name="CreationDate" type="xs:dateTime" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                    <xs:documentation>
                        Specifies optional creation date.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="ModificationDate" type="xs:dateTime" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                    <xs:documentation>
                        Specifies optional last modification date.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
            <xs:element name="Creator" type="xs:string" minOccurs="0" maxOccurs="1">
                <xs:annotation>
                    <xs:documentation>
                        Specifies optional name of creator.
                    </xs:documentation>
                </xs:annotation>
            </xs:element>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Name">
        <xs:annotation>
            <xs:documentation>
                Describes the name of the application filters, but is not used in ECLASS Advanced editor.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="lang" type="Lang" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies optional language code of the name. Not used in ECLASS Advanced editor.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:simpleType name="StepID">
        <xs:annotation>
            <xs:documentation>
                STEP ID value
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:maxLength value="40"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="Application">
        <xs:annotation>
            <xs:documentation>
                Describes application class from a particular ECLASS Advanced version that the current XML asset (filter definition) is valid to. If this tag does not include any child tags like:
                Property, Block, or Aspect, then all nested data (aspects, blocks, properties) belonging to that application class will be displayed without any filtering.
            </xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Property" type="Property" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Block" type="Block" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Aspect" type="Aspect" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="irdi" type="IRDI" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the reference to the application IRDI id, required value.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="Property">
        <xs:annotation>
            <xs:documentation>
                Describes the property that requires to be filtered. If this tag does not include any Value tags then all value tags is considered for display by default (no further filtering of values). 
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="Context" type="Context" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Value" type="Value" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="irdi" type="IRDI" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the reference to the property IRDI id, required value.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="orderNumber" type="OrderNumber" use="optional"/>
        <xs:attribute name="isRequired" type="xs:boolean" use="optional" default="false">
            <xs:annotation>
                <xs:documentation>
                    Specifies that the property value is required. If provided, then in ECLASS Advanced editor the
                    field is marked as a required field.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:complexType name="Value">
        <xs:annotation>
            <xs:documentation>
                Restricted value for the property for filtering values in the property by STEP LOV id or IRDI id. One of
                attributes has to be provided: IRDI id or STEP LOV id.
            </xs:documentation>
        </xs:annotation>
        <xs:simpleContent>
            <xs:extension base="xs:string">
                <xs:attribute name="irdi" type="IRDI" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the reference to the value IRDI id (full number).
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="id" type="StepID" use="optional">
                    <xs:annotation>
                        <xs:documentation>
                            Specifies the reference to the STEP LOV id.
                        </xs:documentation>
                    </xs:annotation>
                </xs:attribute>
                <xs:attribute name="orderNumber" type="OrderNumber" use="optional"/>
            </xs:extension>
        </xs:simpleContent>
    </xs:complexType>

    <xs:complexType name="Block">
        <xs:annotation>
            <xs:documentation>
                This tag outlines the block definition. In the absence of any child tags such as Property or Block, all the nested data, including blocks and properties associated with that block, will be presented without any filtration.
            </xs:documentation>
            </xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Context" type="Context" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Property" type="Property" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Block" type="Block" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="irdi" type="IRDI" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the reference to the block IRDI id, required value.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="orderNumber" type="OrderNumber" use="optional"/>
    </xs:complexType>

    <xs:complexType name="Aspect">
        <xs:annotation>
            <xs:documentation>
                  This tag outlines the aspect definition. In the absence of any child tags such as Property or Block, all the nested data, including blocks and properties associated with that aspect, will be presented without any filtration.
            </xs:documentation>
        </xs:annotation>
        <xs:choice minOccurs="0" maxOccurs="unbounded">
            <xs:element name="Context" type="Context" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Property" type="Property" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element name="Block" type="Block" minOccurs="0" maxOccurs="unbounded"/>
        </xs:choice>
        <xs:attribute name="irdi" type="IRDI" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the reference to the aspect IRDI id, required value.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="orderNumber" type="OrderNumber" use="optional"/>
    </xs:complexType>

    <xs:complexType name="Context">
        <xs:annotation>
            <xs:documentation>
                Describes context path. The filter structure can be written as a tree structure as defined below:

                application (app)
                    property 1
                    property 2
                    block 3
                        block 3.1
                        block 3.2
                            property 3.2.1
                            property 3.2.2
                        block 3.3
                        
                However, it also can be written as a flat structure as shown below:
                
                application (app)
                    property 1
                    property 2
                    block 3
                    block 3.1
                    block 3.2
                    property 3.2.1
                    property 3.2.2
                    block 3.3

                In a tree structure, the relationship between nodes is determined by nested tags. Conversely, in a flat structure, the connection between nodes is established through the context of the elements.

                In context, tag are list of elements defining path to the parent object. If context is not
                provided, then the parent object is obtained from the parent tag.

                For the above given example, in order to define the tree structure, nested blocks and properties have to contain
                context tag with proper elements as shown below:

                application (app)
                    property 1
                    property 2
                    block 3
                    block 3.1
                        context
                            element: ref="app"
                            element: ref="3"
                    block 3.2
                        context
                            element: ref="app"
                            element: ref="3"
                    property 3.2.1
                        context
                            element: ref="app"
                            element: ref="3"
                            element: ref="3.2"
                    property 3.2.2
                        context
                            element: ref="app"
                            element: ref="3"
                            element: ref="3.2"
                    block 3.3
                        context
                            element: ref="app"
                            element: ref="3"
            </xs:documentation>
        </xs:annotation>
        <xs:sequence>
            <xs:element name="Element" type="Element" minOccurs="1" maxOccurs="unbounded"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="Element">
        <xs:annotation>
            <xs:documentation>
                Describes element path. The element defines the parent element of the node. The order of elements
                should be aligned from application to final element.
            </xs:documentation>
        </xs:annotation>
        <xs:attribute name="ref" type="IRDI" use="required">
            <xs:annotation>
                <xs:documentation>
                    Specifies the reference parent element IRDI
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>

    <xs:simpleType name="IRDI">
        <xs:annotation>
            <xs:documentation>
                Describes IRDI "International Registration Data Identifier". It is a unique identifier used within
                the International Registration Data Identifier (IRDI) system, which is a part of the International
                Registration Data Access Protocol (IRDAP).
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:maxLength value="40"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="Lang">
        <xs:annotation>
            <xs:documentation>
                Lanugage represented by ISO 639-2 alpha-3 code.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:maxLength value="3"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:simpleType name="OrderNumber">
        <xs:annotation>
            <xs:documentation>
                It specifies the order number of an element. If the OrderNumber is used, it supersedes the existing ECLASS specification order and utilizes the number for arranging from minimum to maximum values.
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:integer">
            <xs:minInclusive value="0"/>
        </xs:restriction>
    </xs:simpleType>

</xs:schema>

The following is a sample of a filter definition XML file, which is composed according to the previously mentioned XML Schema Definition:

Copy
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<EclassFilter id="FilterID" xmlns="http://www.stibosystems.com/eclass_filter">
    <Header>
        <Name>Information</Name>
    </Header>
    <Application irdi="0173-1---ADVANCED_1_1#01-ADO120#007">
        <Property irdi="0173-1#01-ADN329#000"/>
        <Property irdi="0173-1#01-ADN329#001"/>
        <Aspect irdi="0173-1#01-ADN329#002">
            <Property irdi="0173-1#01-ADN329#001"/>
            <Block irdi="0173-1#01-ADN334#001">
                <Property irdi="0173-1#01-ADN330#001"/>
                <Property irdi="0173-1#01-ADN330#002"/>
                <Property irdi="0173-1#01-ADN330#003"/>
            </Block>
        </Aspect>
    </Application>
    <Application irdi="0173-1---ADVANCED_1_1#01-ADO120#006">
        <Aspect irdi="0173-1#01-ADN329#002"/>
    </Application>
</EclassFilter>