feat(ch 4): added

This commit is contained in:
Rafa Muñoz
2024-09-27 14:28:05 +02:00
parent d622608575
commit 3f7e83baae
97 changed files with 1250 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<marvel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-01.xsd">
un montón de superhéroes
</marvel>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="marvel" />
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<marvel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-02.xsd">un montón de superhéroes</marvel>

View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="marvel" type="xs:string"
fixed="un montón de superhéroes" />
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-03.xsd" nombre="Hulk" edad="46"/>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="tipoComplejo">
</xs:element>
<xs:complexType name="tipoComplejo">
<xs:attribute name="nombre" type="xs:string" use="required"/>
<xs:attribute name="edad" type="xs:integer" use="optional"/>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-04.xsd">Hulk</superheroe>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="nombreSuperheroe"/>
<xs:simpleType name="nombreSuperheroe">
<xs:restriction base="xs:string">
<xs:minLength value="1" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-05-exp-reg.xsd">rafa@rafa.com</superheroe>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="nombreSuperheroe"/>
<xs:simpleType name="nombreSuperheroe">
<xs:restriction base="xs:string">
<xs:pattern value="\w+@\w+[.]\w+" />
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<tallaSuperheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-06-union.xsd">x</tallaSuperheroe>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="tallaSuperheroe" type="lista-tallas"/>
<xs:simpleType name="lista-tallas">
<xs:list itemType="talla"/>
</xs:simpleType>
<xs:simpleType name="talla">
<xs:union memberTypes="talla-texto talla-numero" />
</xs:simpleType>
<xs:simpleType name="talla-texto">
<xs:restriction base="xs:string">
<xs:enumeration value="s" />
<xs:enumeration value="m" />
<xs:enumeration value="x" />
<xs:enumeration value="xl" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="talla-numero">
<xs:restriction base="xs:positiveInteger">
<xs:enumeration value="38"/>
<xs:enumeration value="40"/>
<xs:enumeration value="42"/>
<xs:enumeration value="44"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<numeros xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-07-list.xsd">11 23</numeros>

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="numeros" type="listaNumeros"/>
<xs:simpleType name="listaNumeros">
<xs:list itemType="listaNumerosRestringida" />
</xs:simpleType>
<xs:simpleType name="listaNumerosRestringida">
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="10"/>
<xs:maxExclusive value="51"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<NumeroDelimitado xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-08-ejemplo-Derivacion_de_tipos.xsd">51</NumeroDelimitado>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="NumeroDelimitado" type="numero-50-60"/>
<xs:simpleType name="numero-50-60">
<xs:restriction base="numero-10-100">
<xs:minInclusive value="50" />
<xs:maxInclusive value="60" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="numero-10-100">
<xs:restriction base="xs:positiveInteger">
<xs:minInclusive value="10"/>
<xs:maxInclusive value="100"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-09-sequence.xsd" nombreReal="Bruce Banner">
<edad>86</edad>
<bando>Buenos</bando>
</superheroe>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="caracSuperheroe"/>
<xs:complexType name="caracSuperheroe">
<xs:sequence>
<xs:element name="nombre" minOccurs="0" maxOccurs="3" type="minimoUnCaracter" />
<xs:element name="edad" type="xs:string" />
<xs:element name="bando" type="xs:string" />
</xs:sequence>
<xs:attribute name="nombreReal" type="minimoUnCaracter"/>
</xs:complexType>
<xs:simpleType name="minimoUnCaracter">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-10-choice.xsd">
<nombre>Hulk</nombre>
<!-- <edad>86</edad>
<bando>Buenos</bando> -->
</superheroe>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="caracSuperheroe"/>
<xs:complexType name="caracSuperheroe">
<xs:choice>
<xs:element name="nombre" minOccurs="0" maxOccurs="unbounded" type="xs:string" />
<xs:element name="edad" type="xs:string" />
<xs:element name="bando" type="xs:string" />
</xs:choice>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-11-all.xsd">
<bando>Buenos</bando>
<nombre>Hulk</nombre>
<edad>86</edad>
</superheroe>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="caracSuperheroe"/>
<xs:complexType name="caracSuperheroe">
<xs:all>
<xs:element name="nombre" type="xs:string" />
<xs:element name="edad" type="xs:string" />
<xs:element name="bando" type="xs:string" />
</xs:all>
</xs:complexType>
</xs:schema>

View File

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-12-elemento-vacio.xsd"></superheroe>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType />
</xs:element>
</xs:schema>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-13-elemento-contenido-texto-y-atributos.xsd"
nombre="Hulk" edad="86">Buen superheroe</superheroe>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType>
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="nombre" type="xs:string" />
<xs:attribute name="edad" type="xs:positiveInteger" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-13-elemento-vacio-con-atributos.xsd"
nombre="Hulk" edad="86"></superheroe>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType>
<xs:attribute name="nombre" type="xs:string" />
<xs:attribute name="edad" type="xs:positiveInteger" />
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-14-elemento-contenido-texto-y-atributos.xsd"
nombre="Hulk" edad="86">Buen</superheroe>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="mixtoConValidacion"/>
<xs:complexType name="mixtoConValidacion">
<xs:simpleContent>
<xs:extension base="minimo4Caracteres">
<xs:attribute name="nombre" type="xs:string" />
<xs:attribute name="edad" type="xs:positiveInteger" />
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:simpleType name="minimo4Caracteres">
<xs:restriction base="xs:string">
<xs:minLength value="4"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType>
<xs:sequence>
<xs:element name="nombre" type="xs:string"/>
<xs:element name="amigo" type="amigosSuperheroe" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="amigosSuperheroe">
<xs:sequence>
<xs:element name="amigoDeSuperheroe" type="textoNoVacio"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="textoNoVacio">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-15-elemento-con-descendientes.xsd">
<nombre>Hulk</nombre>
<amigo>
<amigoDeSuperheroe>Thor</amigoDeSuperheroe>
</amigo>
<amigo>
<amigoDeSuperheroe>Hulk</amigoDeSuperheroe>
</amigo>
<amigo>
<amigoDeSuperheroe>Bulleye</amigoDeSuperheroe>
</amigo>
</superheroe>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType>
<xs:all>
<xs:element name="nombre" type="xs:string"/>
<xs:element name="amigo" type="textoNoVacio" minOccurs="0" maxOccurs="1"/>
</xs:all>
<xs:attribute name="edad" type="textoNoVacio"/>
<xs:attribute name="color" type="color"/>
</xs:complexType>
</xs:element>
<xs:simpleType name="textoNoVacio">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="color">
<xs:restriction base="xs:string">
<xs:enumeration value="rojo"/>
<xs:enumeration value="verde"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-16-elemento-atributos-y-descendientes.xsd"
edad="86" color="verde">
<nombre>Hulk</nombre>
<amigo>Thor</amigo>
</superheroe>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-17-elemento-contenido-mixto.xsd">
Este texto no se podría poner sin especificar contenido mixto
<!-- <nombre>Hulk</nombre> -->
<amigo>Thor</amigo>
<amigo>Iron Man</amigo>
<amigo>Bulleye</amigo>
</superheroe>

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType mixed="true">
<xs:choice>
<xs:element name="nombre" type="xs:string"/>
<xs:element name="amigo" type="textoNoVacio" minOccurs="2" maxOccurs="unbounded"/>
</xs:choice>
</xs:complexType>
</xs:element>
<xs:simpleType name="textoNoVacio">
<xs:restriction base="xs:string">
<xs:minLength value="1"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-18-elemento-con-atributos-y-contenido-mixto.xsd"
edad="86" color="verde">Este texto no se podría poner sin especificar contenido mixto
<!-- <nombre>Hulk</nombre> -->
<amigo>Thor</amigo>
<amigo>Iron Man</amigo>
<amigo>Bulleye</amigo>
</superheroe>

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe">
<xs:complexType mixed="true">
<xs:choice>
<xs:element name="nombre" type="xs:string"/>
<xs:element name="amigo" type="xs:string" minOccurs="2" maxOccurs="unbounded"/>
</xs:choice>
<xs:attribute name="edad" type="xs:string"/>
<xs:attribute name="color" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:schema>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<superheroe xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xml-xsd-19-derivacion-tipos-complejos.xsd"
edad="86" color="verde">
Este texto no se podría poner sin especificar contenido mixto
<nombre>Hulk</nombre>
<amigo>Thor</amigo>
<poderPrincipal>Fuerza</poderPrincipal>
</superheroe>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="superheroe" type="superheroeDerivado">
</xs:element>
<xs:complexType mixed="true" name="superheroePrimitivo">
<xs:sequence>
<xs:element name="nombre" type="xs:string"/>
<xs:element name="amigo" type="xs:string"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="superheroeDerivado">
<xs:complexContent mixed="true">
<xs:extension base="superheroePrimitivo">
<xs:sequence>
<xs:element name="poderPrincipal" type="xs:string" />
</xs:sequence>
<xs:attribute name="edad" type="xs:string"/>
<xs:attribute name="color" type="xs:string"/>
</xs:extension>
</xs:complexContent>
</xs:complexType>
</xs:schema>