I am trying to validate the following XML using a schema.
<?xml version="1.0" encoding="ISO-8859-1"?>
<Noticias xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="UXMLS-5.xsd">
<Noticia dia="12" mes="3" año="2004" seccion="Nacional">
<medio tipo="radio">Onda Cero</medio>
<periodista>Fermín Bocos</periodista>
<titular>Atentado bestial en Madrid</titular>
<resumen>Resumen de la noticia Atentado bestial en Madrid</resumen>
</Noticia>
</Noticias>
and I am stuck when validating the below line from the above:
<medio tipo="radio">Onda Cero</medio>
I am capable of validating "Noticia", which has attributes, as it isn't a final element with a type associated, I can't when it is the child element with content associated to it though.
I tried many approaches, with not luck so far, also I wasn't able to find a solution online. Any ideas? Am I missing something or is it just not possible doing it?
UPDATE: This is the XSD so far, keep in mind that the "medio" bit is wrong.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Noticias">
<xs:complexType>
<xs:sequence>
<xs:element name="Noticia" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="medio" type="xs:string">
<xs:attribute name="tipo" type="xs:string">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="radio"/>
<xs:enumeration value="prensa"/>
<xs:enumeration value="television"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:element>
<xs:element name="periodista" type="xs:string"/>
<xs:element name="titular" type="xs:string"/>
<xs:element name="resumen">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z0-9]{60}"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="dia" type="dia"/>
<xs:attribute name="mes" type="mes"/>
<xs:attribute name="año" type="xs:integer"/>
<xs:attribute name="seccion" type="xs:string"/>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name="dia">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="12"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="mes">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="31"/>
</xs:restriction>
</xs:simpleType>
</xs:schema>