此XSD是否遵循威尼斯百叶窗的设计模式



我只是想知道这个XSD是否遵循Venetian Blind,以便所有复杂和简单类型都是全局的?根据我的理解,为了遵循威尼斯百叶窗的设计模式,元素必须单独声明,然后使用"类型"构建在一起。但由于我在这个文档中有这么多嵌套类型,我不知道如何确定它是否遵循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的结构是好是坏。这是由你和你的团队根据你需要做什么来定义的

最新更新