xsd – 具有固定属性的固定元素的XML Schema?
发布时间:2020-12-16 23:48:33 所属栏目:百科 来源:网络整理
导读:什么是正确的 XML Schema 1.0声明 notice xml:lang="en"Banana banana banana/notice 哪里: xml:lang属性是强制性的 值“en”是固定的和强制性的 通知内容是简单的文字. 通知的内容是固定的(如上所述)和强制性的? 我最好的(但错误的)努力是以下片段: xs:
什么是正确的
XML Schema 1.0声明
<notice xml:lang="en">Banana banana banana</notice> 哪里: > xml:lang属性是强制性的 我最好的(但错误的)努力是以下片段: <xs:element name="notice" use="required" fixed="Banana banana banana"> <xs:complexType> <xs:simpleContent> <xs:extension> <xs:attribute ref="xml:lang" use="required" fixed="en"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <?xml version="1.0" encoding="utf-8"?> <xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:import namespace="http://www.w3.org/XML/1998/namespace" /> <xs:element name="notice" type="notice"/> <xs:complexType name="notice"> <xs:simpleContent> <xs:extension base="CONTENT"> <xs:attribute ref="xml:lang" use="required" fixed="en"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:simpleType name="CONTENT"> <xs:restriction base="xs:string"> <xs:enumeration value="Banana banana banana"/> </xs:restriction> </xs:simpleType> </xs:schema> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |