MPEGGroup / DASHSchema

The XML schema and example XML files for DASH (ISO/IEC 23009-1)
Other
11 stars 16 forks source link

Schema now uses ENTITY definitions for readability and maintainability #99

Open paulhiggs opened 3 years ago

paulhiggs commented 3 years ago

The 5th edition schema introduced an entity definition block to make regular expressions easir to read. XML entities function in a similar manner to C/C+ MACROs - the provide an inline replacement of the label for the value, thus

<xs:simpleType name="CodecsType">
    <xs:restriction base="xs:string">
        <xs:pattern value="[a-zA-Z\-]+'[a-zA-Z]{1,8}(=[a-zA-Z]{1,8})*'(%[0-9A-F]{2}|[a-zA-Z0-9!#\\$\^_\-\+\{\}\|\.`~&#038;])+(.(%[0-9A-F]{2}|[a-zA-Z0-9!#\\$\^_\-\+\{\}\|\.`~&#038;])+)*(,(%[0-9A-F]{2}|[a-zA-Z0-9!#\\$\^_\-\+\{\}\|\.`~&#038;])+(.(%[0-9A-F]{2}|[a-zA-Z0-9!#\\$\^_\-\+\{\}\|\.`~&#038;])+)*)*">
            <xs:annotation>
                <xs:documentation>RFC6381 fancy-list</xs:documentation>
            </xs:annotation>
        </xs:pattern>
        <xs:pattern value="[a-zA-Z0-9!#\\$%\^\*_\-\+\{\}\|'\.`~&#038;]+(,[a-zA-Z0-9!#\\$%\^\*_\-\+\{\}\|'\.`~&#038;]+)*">
            <xs:annotation>
                <xs:documentation>RFC6381 simp-list</xs:documentation>
            </xs:annotation>
        </xs:pattern>
    </xs:restriction>
</xs:simpleType>

becomes

    <xs:simpleType name="CodecsType">
        <xs:restriction base="xs:string">
            <xs:pattern value="&charset;&squote;&language;&squote;&id_list;">
                <xs:annotation>
                    <xs:documentation>RFC6381 fancy-list without enclosing double quotes</xs:documentation>
                </xs:annotation>
            </xs:pattern>
            <xs:pattern value="&id_simple;(,&id_simple;)*">
                <xs:annotation>
                    <xs:documentation>RFC6381 simp-list without enclosing double quotes</xs:documentation>
                </xs:annotation>
            </xs:pattern>
        </xs:restriction>
    </xs:simpleType>

We should look (perhaps for 6th edition) to document entity values in an annex for use throughout the specification