长期读者,第一次海报。是时候挖掘这个网站的所有知识了!
我正在尝试设置一个 xml 架构并在 excel 中填充数据。我为一些 complexTypes 做了一些定义,因为它们会经常被重用。如果我引用类型,例如 3 次,在 excel 中它只映射一次类型。
我对模式很陌生,但我的老板希望我使用它们。任何其他批评将不胜感激。
XML 架构:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- Type Definitions (DoorStyle, Colour, Accessory and TamarackModel) -->
<xsd:complexType name="DoorStyle">
<xsd:sequence>
<xsd:element name="style" type="xsd:string"/>
<xsd:element name="wood" type="xsd:string"/>
<xsd:element name="colour" type="xsd:string"/>
<xsd:element name="imgsrc" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Colour">
<xsd:sequence>
<xsd:element name="colour" type="xsd:string"/>
<xsd:element name="wood" type="xsd:string"/>
<xsd:element name="imgsrc" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Accessory">
<xsd:sequence>
<xsd:element name="pdf" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="TamarackModel">
<xsd:sequence>
<xsd:element name="drawing" type="xsd:string"/>
<xsd:element name="reverseDrawing" type="xsd:string"/>
<xsd:element name="priceSheet" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<!-- Group Definitions (DoorStyles, Colours, Accessories and TamarackModels) -->
<xsd:element name="DoorStyles">
<xsd:complexType>
<!-- <xsd:attribute name="url" type="xsd:string" fixed="http://www.muskokacabco.com/muskoka-kitchens-gallery-door-styles.html"/> -->
<xsd:sequence>
<xsd:element name="DoorStyle" type="DoorStyle"/>
<xsd:element name="DoorStyle" type="DoorStyle"/>
<xsd:element name="DoorStyle" type="DoorStyle"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Colours">
<xsd:complexType>
<!-- xsd:attribute name="url" type="xsd:string" fixed="http://www.muskokacabco.com/muskoka-kitchens-gallery-stain-colours.html"/> -->
<xsd:sequence>
<xsd:element name="Colour" type="Colour"/>
<xsd:element name="Colour" type="Colour"/>
<xsd:element name="Colour" type="Colour"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Accessories">
<xsd:complexType>
<!-- <xsd:attribute name="url" type="xsd:string" fixed="http://www.muskokacabco.com/muskoka-kitchens-accessories.html"/> -->
<xsd:sequence>
<xsd:element name="Accessory" type="Accessory"/>
<xsd:element name="Accessory" type="Accessory"/>
<xsd:element name="Accessory" type="Accessory"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="TamarackModels">
<xsd:complexType>
<!-- <xsd:attribute name="url" type="xsd:string" fixed="http://www.muskokacabco.com/muskoka-kitchens-tamarack-models.html"/> -->
<xsd:sequence>
<xsd:element name="TamarackModel" type="TamarackModel"/>
<xsd:element name="TamarackModel" type="TamarackModel"/>
<xsd:element name="TamarackModel" type="TamarackModel"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<!-- Overall Structure -->
<xsd:element name="MuskokaSite">
<!-- <xsd:attribute name="url" type="xsd:string" fixed="http://www.muskokacabco.com"/> -->
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="DoorStyles"/>
<xsd:element ref="Colours"/>
<xsd:element ref="Accessories"/>
<xsd:element ref="TamarackModels"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
所以我引用每种类型大约 3 次,但在 excel 中,如果我选择作为 root,它只允许我映射每种类型一次。我很想包括一个截图,但显然新用户不能这样做......