Created
January 9, 2016 00:52
-
-
Save labra/e56cf21e26a2e822485e to your computer and use it in GitHub Desktop.
Ejemplo XSD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> | |
<xs:element name="pedido"> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element name="producto" minOccurs="1" maxOccurs="3" | |
type="TipoProducto"/> | |
</xs:sequence> | |
<xs:attribute name="fecha" type="TipoFecha"/> | |
</xs:complexType> | |
</xs:element> | |
<xs:complexType name="TipoProducto"> | |
<xs:sequence> | |
<xs:element name="nombre" type="xs:string"/> | |
<xs:element name="cantidad" type="xs:integer"/> | |
<xs:element name="comentarios" type="xs:string" minOccurs="0"/> | |
<xs:element name="precio" type="TipoPrecio" minOccurs="0"/> | |
</xs:sequence> | |
<xs:attribute name="codigo" type="xs:string"/> | |
</xs:complexType> | |
<xs:complexType name="TipoPrecio"> | |
<xs:simpleContent> | |
<xs:extension base="xs:decimal"> | |
<xs:attribute name="moneda" type="xs:string" /> | |
</xs:extension> | |
</xs:simpleContent> | |
</xs:complexType> | |
<xs:simpleType name="TipoFecha"> | |
<xs:restriction base="xs:token"> | |
<xs:pattern value="\d{1,2}/\d{2}/\d{4}" /> | |
</xs:restriction> | |
</xs:simpleType> | |
</xs:schema> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment