Añadidos elementos complejos

This commit is contained in:
Salatiel Genol 2022-12-03 10:03:21 +01:00
parent 40d5f0f811
commit 9ac329d995
1 changed files with 34 additions and 5 deletions

39
xsd.md
View File

@ -63,13 +63,34 @@ elementFormDefault="qualified">
### Estructura y elementos ### Estructura y elementos
#### Elementos simples #### Tipos de datos
Los elementos simples solo pueden contener texto. La diferencia entre fixed y default es que en que con fixed, el valor no se puede modificar, tiene que ser ese, y con default si es modificable. anyURI, base64Binary, boolean, date, dateTime, decimal, double, duration, float, hexBinary, gDay, gMonth, gMonthDay, gYear, gYearMonth, NOTATION, QName, string, and time
#### Elementos
##### Simples
Los elementos simples solo pueden contener texto.
```xml ```xml
<!-- Simple -->
<xs:element name="nombre_del_elemento" type="xs:tipo_de_dato"/> <xs:element name="nombre_del_elemento" type="xs:tipo_de_dato"/>
<xs:element name="nombre_del_elemento" type="xs:tipo_de_dato" {fixed|default}="cadena"/>
<!-- Con valor por defecto -->
<xs:element name="nombre_del_elemento" type="xs:tipo_de_dato" default="valor"/>
<!-- Con valor fijo -->
<xs:element name="nombre_del_elemento" type="xs:tipo_de_dato" fixed="valor"/>
<!-- Con faceta/restricciones -->
<xs:element>
<xs:simpleType>
<xs:restriction base="xs:tipo_de_dato">
<xs:tipo_restriccion value="valor"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
``` ```
#### Atributos #### Atributos
@ -89,7 +110,7 @@ Los elementos simples solo pueden contener texto. La diferencia entre fixed y de
<!-- Obligatorio (por defecto es opcional--> <!-- Obligatorio (por defecto es opcional-->
<xs:attribute name="nombre_del_atributo" type="xs:tipo_de_dato" use="required"/> <xs:attribute name="nombre_del_atributo" type="xs:tipo_de_dato" use="required"/>
<!-- Con faceta --> <!-- Con faceta/restricciones -->
<xs:attribute name="nombre_atributo"> <xs:attribute name="nombre_atributo">
<xs:simpleType> <xs:simpleType>
<xs:restriction base="xs:tipo_de_dato"> <xs:restriction base="xs:tipo_de_dato">
@ -120,7 +141,15 @@ Los elementos simples solo pueden contener texto. La diferencia entre fixed y de
</xs:element> </xs:element>
<!-- Elemento complejo con texto, y atributos --> <!-- Elemento complejo con texto, y atributos -->
<xs:element name="nombre_elemento">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:tipo_de_dato">
<xs:attribute name="nombre_atributo" type="xs:tipo_de_dato"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
<!-- Elemento complejo con elementos, texto, y atributos --> <!-- Elemento complejo con elementos, texto, y atributos -->
<xs:element name="nombre_elemento"> <xs:element name="nombre_elemento">