Using xs:extension & xs:restriction together?

前端 未结 1 1819
情歌与酒
情歌与酒 2021-01-07 22:32

While writing an XML schema, I am attempting to do something like this


    
        &l         


        
相关标签:
1条回答
  • 2021-01-07 23:13

    You need to define the restriction on the double separatley

    <?xml version="1.0" encoding="utf-8" ?>
    <!--Created with Liquid XML Studio Developer Edition 8.1.4.2482 (http://www.liquid-technologies.com)-->
    <xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:simpleType name="RestrictedDouble">
            <xs:restriction base="xs:double">
                <xs:minInclusive value="0" />
                <xs:maxInclusive value="10" />
            </xs:restriction>
        </xs:simpleType>
        <xs:complexType name="ValueWithUnits">
            <xs:simpleContent>
                <xs:extension base="RestrictedDouble">
                    <xs:attribute name="uom" fixed="second" />
                </xs:extension>
            </xs:simpleContent>
        </xs:complexType>
    </xs:schema>
    
    0 讨论(0)
提交回复
热议问题