这个XSD是否遵循百叶窗设计模式?
Does this XSD follow the Venetian Blind design pattern?
我只是想知道这个 XSD 是否遵循百叶窗以便所有复杂和简单类型都是全局的?根据我的理解,为了遵循百叶窗设计模式,元素必须单独声明,然后使用 'types' 一起构建。但是由于我在这个文档中有很多嵌套类型,我不确定如何确定它是否遵循 VB。我如何确定所有类型是否都是全局类型,如果不是,最好的转换方法是什么?
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:presentations="http://www.example.com/presentations" xmlns:topics="http://www.example.com/topics" targetNamespace="http://www.example.com/presentations" elementFormDefault="qualified">
<import namespace="http://www.example.com/topics" schemaLocation="topics.xsd"/>
<attributeGroup name="PresentationAttributes">
<attribute name="date" type="date" use="required"/>
<attribute name="length" type="duration" use="required"/>
</attributeGroup>
<element name="presentations">
<complexType>
<sequence>
<element name="presentation" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="topic" type="topics:TopicsType"/>
<element name="presenters" type="presentations:PresentersType"/>
</sequence>
<attributeGroup ref="presentations:PresentationAttributes"/>
</complexType>
</element>
</sequence>
</complexType>
</element>
<complexType name="PresentersType">
<sequence>
<element name="name" minOccurs="1" maxOccurs="unbounded">
<complexType>
<group ref="presentations:NameGroup"/>
<attribute name="id">
<simpleType>
<restriction base="ID">
<pattern value="[XY][0-9][0-9][0-9]"/>
</restriction>
</simpleType>
</attribute>
<attribute name="title">
<simpleType>
<restriction base="string">
<enumeration value="Mr."/>
<enumeration value="Mrs."/>
<enumeration value="Ms."/>
<enumeration value="Miss"/>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
</sequence>
</complexType>
<group name="NameGroup">
<sequence>
<element name="first" type="string" minOccurs="1" maxOccurs="unbounded"/>
<element name="middle" type="string" minOccurs="0" maxOccurs="1"/>
<element name="last" type="string"/>
</sequence>
</group>
</schema>
一如既往,答案取决于您如何定义 'Venetian Blind' 模式。
您自己的定义是 XSD follows Venetian Blind so that all complex and simple types are global
。您的 XSD 中有本地类型定义,因此它不符合该定义。
我不是在说你XSD的结构是好是坏。这是由你和你的团队根据你需要用它做什么来定义的。
我只是想知道这个 XSD 是否遵循百叶窗以便所有复杂和简单类型都是全局的?根据我的理解,为了遵循百叶窗设计模式,元素必须单独声明,然后使用 'types' 一起构建。但是由于我在这个文档中有很多嵌套类型,我不确定如何确定它是否遵循 VB。我如何确定所有类型是否都是全局类型,如果不是,最好的转换方法是什么?
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:presentations="http://www.example.com/presentations" xmlns:topics="http://www.example.com/topics" targetNamespace="http://www.example.com/presentations" elementFormDefault="qualified">
<import namespace="http://www.example.com/topics" schemaLocation="topics.xsd"/>
<attributeGroup name="PresentationAttributes">
<attribute name="date" type="date" use="required"/>
<attribute name="length" type="duration" use="required"/>
</attributeGroup>
<element name="presentations">
<complexType>
<sequence>
<element name="presentation" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="topic" type="topics:TopicsType"/>
<element name="presenters" type="presentations:PresentersType"/>
</sequence>
<attributeGroup ref="presentations:PresentationAttributes"/>
</complexType>
</element>
</sequence>
</complexType>
</element>
<complexType name="PresentersType">
<sequence>
<element name="name" minOccurs="1" maxOccurs="unbounded">
<complexType>
<group ref="presentations:NameGroup"/>
<attribute name="id">
<simpleType>
<restriction base="ID">
<pattern value="[XY][0-9][0-9][0-9]"/>
</restriction>
</simpleType>
</attribute>
<attribute name="title">
<simpleType>
<restriction base="string">
<enumeration value="Mr."/>
<enumeration value="Mrs."/>
<enumeration value="Ms."/>
<enumeration value="Miss"/>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
</sequence>
</complexType>
<group name="NameGroup">
<sequence>
<element name="first" type="string" minOccurs="1" maxOccurs="unbounded"/>
<element name="middle" type="string" minOccurs="0" maxOccurs="1"/>
<element name="last" type="string"/>
</sequence>
</group>
</schema>
一如既往,答案取决于您如何定义 'Venetian Blind' 模式。
您自己的定义是 XSD follows Venetian Blind so that all complex and simple types are global
。您的 XSD 中有本地类型定义,因此它不符合该定义。
我不是在说你XSD的结构是好是坏。这是由你和你的团队根据你需要用它做什么来定义的。