共用方式為


Simple Content Format XSD Schema 

The following XSD schema defines the Simple Content Format:

<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="https://www.w3.org/2001/XMLSchema">
    <!-- General element related types -->
    <xsd:simpleType name="Alignment">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="l|r|c" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="ColorRGB">
        <xsd:restriction base="xsd:hexBinary">
            <xsd:minLength value="1" />
            <xsd:maxLength value="6" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="SelectAction">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="target|menuid" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Image element related types -->
    <xsd:simpleType name="ImageFit">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="native|width|screen|auto" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Text element related types -->
    <xsd:simpleType name="TextWrap">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:minInclusive value="0" />
            <xsd:maxInclusive value="1" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Button element related types -->
    <xsd:simpleType name="ButtonKey">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="enter|back|left|right" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Item element related types -->
    <xsd:simpleType name="MenuItemDefault">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:minInclusive value="0" />
            <xsd:maxInclusive value="1" />
        </xsd:restriction>
    </xsd:simpleType>
    <xsd:simpleType name="MenuItemEnabled">
        <xsd:restriction base="xsd:nonNegativeInteger">
            <xsd:minInclusive value="0" />
            <xsd:maxInclusive value="1" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Content element related types -->
    <xsd:simpleType name="ContentBackgroundFitMode">
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="s|t|c" />
        </xsd:restriction>
    </xsd:simpleType>
    <!-- Element groupings -->
    <xsd:group name="DialogChild">
        <xsd:choice>
            <xsd:element ref="txt" minOccurs="1" />
            <xsd:element ref="btn" minOccurs="1" />
        </xsd:choice>
    </xsd:group>
    <xsd:group name="MenuChild">
        <xsd:choice>
            <xsd:element ref="item" minOccurs="1" />
            <xsd:element ref="div" />
            <xsd:element ref="btn" />
        </xsd:choice>
    </xsd:group>
    <xsd:group name="ContentChild">
        <xsd:choice>
            <xsd:element ref="txt" />
            <xsd:element ref="br" />
            <xsd:element ref="img" />
            <xsd:element ref="btn" />
        </xsd:choice>
    </xsd:group>
    <xsd:group name="TopLevel">
        <xsd:choice>
            <xsd:element ref="content" />
            <xsd:element ref="menu" />
            <xsd:element ref="dialog" />
        </xsd:choice>
    </xsd:group>
    <!-- Schema elements -->
    <xsd:element name="body">
        <xsd:complexType>
            <xsd:group ref="TopLevel" />
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="img">
        <xsd:complexType>
            <xsd:attribute name="id" type="xsd:positiveInteger" use="required" />
            <xsd:attribute name="align" type="Alignment" use="optional" />
            <xsd:attribute name="fit" type="ImageFit" use="optional" />
            <xsd:attribute name="alt" type="xsd:string" use="optional" />
        </xsd:complexType>
    </xsd:element>
    <xsd:complexType name="EmphasisType" mixed="true">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element ref="clr" />
        </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="ColorType" mixed="true">
        <xsd:sequence minOccurs="0" maxOccurs="unbounded">
            <xsd:element ref="em" />
        </xsd:sequence>
        <xsd:attribute name="rgb" type="ColorRGB" use="required" />
    </xsd:complexType>
    <xsd:element name="em" type="EmphasisType" />
    <xsd:element name="clr" type="ColorType" />
    <xsd:group name="Text">
        <xsd:choice>
            <xsd:element ref="em" />
            <xsd:element ref="clr" />
            <xsd:element ref="br" />
        </xsd:choice>
    </xsd:group>
    <xsd:complexType name="TextType" mixed="true">
        <xsd:group ref="Text" minOccurs="0" maxOccurs="unbounded" />
        <xsd:attribute name="align" type="Alignment" use="optional" />
        <xsd:attribute name="wrap" type="TextWrap" use="optional" />
        <xsd:attribute name="rgb" type="ColorRGB" use="optional" />
    </xsd:complexType>
    <xsd:element name="txt" type="TextType" />
    <xsd:element name="br">
        <xsd:complexType />
    </xsd:element>
    <xsd:element name="div">
        <xsd:complexType />
    </xsd:element>
    <xsd:element name="btn">
        <xsd:complexType>
            <xsd:simpleContent>
                <xsd:extension base="xsd:string">
                    <xsd:attribute name="key" type="ButtonKey" use="required" />
                    <xsd:attribute name="target" type="xsd:positiveInteger" use="required" />
                </xsd:extension>
            </xsd:simpleContent>
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="content">
        <xsd:complexType>
            <xsd:group ref="ContentChild" maxOccurs="unbounded" />
            <xsd:attribute name="id" type="xsd:positiveInteger" use="required" />
            <xsd:attribute name="title" type="xsd:string" use="optional" />
            <xsd:attribute name="bg" type="xsd:positiveInteger" use="optional" />
            <xsd:attribute name="bgfit" type="ContentBackgroundFitMode" use="optional" />
            <xsd:attribute name="menuid" type="xsd:positiveInteger" use="optional" />
        </xsd:complexType>
        <xsd:unique name="UniqueButtonKeyContent">
            <xsd:selector xpath="./btn" />
            <xsd:field xpath="@key" />
        </xsd:unique>
    </xsd:element>
    <xsd:element name="item">
        <xsd:complexType name="ItemType" mixed="true">
            <xsd:sequence minOccurs="0" maxOccurs="1">
                <xsd:element ref="br" />
            </xsd:sequence>
            <xsd:attribute name="id" type="xsd:positiveInteger" use="optional" />
            <xsd:attribute name="target" type="xsd:positiveInteger" use="required" />
            <xsd:attribute name="imgid" type="xsd:positiveInteger" use="optional" />
            <xsd:attribute name="def" type="MenuItemDefault" use="optional" />
            <xsd:attribute name="enable" type="MenuItemEnabled" use="optional" />
            <xsd:attribute name="menuid" type="xsd:positiveInteger" use="optional" />
        </xsd:complexType>
        <xsd:unique name="UniqueId">
            <xsd:selector xpath="./item" />
            <xsd:field xpath="@id" />
        </xsd:unique>
    </xsd:element>
    <xsd:element name="menu">
        <xsd:complexType>
            <xsd:group ref="MenuChild" maxOccurs="unbounded" />
            <xsd:attribute name="id" type="xsd:positiveInteger" use="required" />
            <xsd:attribute name="title" type="xsd:string" use="optional" />
            <xsd:attribute name="selectaction" type="SelectAction" use="optional" />
        </xsd:complexType>
    </xsd:element>
    <xsd:element name="dialog">
        <xsd:complexType>
            <xsd:group ref="DialogChild" maxOccurs="unbounded" />
            <xsd:attribute name="id" type="xsd:positiveInteger" use="required" />
            <xsd:attribute name="title" type="xsd:string" use="optional" />
            <xsd:attribute name="imgid" type="xsd:positiveInteger" use="optional" />
        </xsd:complexType>
        <xsd:unique name="UniqueButtonKeyDialog">
            <xsd:selector xpath="./btn" />
            <xsd:field xpath="@key" />
        </xsd:unique>
    </xsd:element>
</xsd:schema>

See Also

Concepts

Simple Content Format Elements