mardi 28 juillet 2020

Does this XSD follow the Venetian Blind design pattern?

I'm just wondering if this XSD follows Venetian Blind so that all complex and simple types are global? From my understanding, in order to follow Venetian Blind design pattern, elements must be declared separately and then built together using 'types'. But since I have so many nested types in this doc, I'm not sure how to figure out if it follows VB. How do I determine if all the types are global and if they are not, what would be the best way to convert it?

<?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>

Aucun commentaire:

Enregistrer un commentaire