Hi, I'm doing an exercise to pass xlm to xsd. The xsd validates correctly, it only gives an error in the attribute and I don't know why it is wrong. And my notes are quite poor. This is the error
Referenced entity at "nbres:/org/netbeans/modules/xml/catalog/resources/datatypes.dtd".
cvc-complex-type.2.4.a: Se ha encontrado contenido no válido a partir del elemento 'atribute'. Se esperaba uno de '{"http://www.w3.org/2001/XMLSchema":simpleType, "http://www.w3.org/2001/XMLSchema":complexType, "http://www.w3.org/2001/XMLSchema":group, "http://www.w3.org/2001/XMLSchema":attributeGroup, "http://www.w3.org/2001/XMLSchema":element, "http://www.w3.org/2001/XMLSchema":attribute, "http://www.w3.org/2001/XMLSchema":notation, "http://www.w3.org/2001/XMLSchema":annotation}'. [31]
cvc-complex-type.4: El atributo 'name' debe aparecer en el elemento 'xs:simpleType'. [32]
XML validation finished.
this is the xsd
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="alumno">
<xs:complexType>
<xs:sequence>
<xs:element name="nombre" type="xs:string"/>
<xs:element name="direccion" type="tdireccion" minOccurs="1" maxOccurs="2"/>
<xs:element name="telefono" type="xs:integer" minOccurs="0" maxOccurs="5"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexType name="tdireccion">
<xs:sequence>
<xs:element name="calle" type="xs:string"/>
<xs:element name="numero" type="infonumero"/>
<xs:element name="ciudad" type="xs:string"/>
<xs:element name="provincia" type="infoprovincia"/>
</xs:sequence>
</xs:complexType>
<xs:simpleType name="infonumero">
<xs:restriction base="xs:integer">
<xs:minInclusive value="1"/>
<xs:maxInclusive value="500"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="infoprovincia">
<xs:restriction base="xs:string">
<xs:pattern value="caceres|badajoz"/>
</xs:restriction>
</xs:simpleType>
<atribute name="dni">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="[0-9]{8}[A-Z]" />
</xs:restriction>
</xs:simpleType>
</atribute>
</xs:schema>
Let's see if you can tell me the reason for the error, I don't put xlm for space problems because it will tell me that I have too much code.
!Good!
In the absence of the XML , I have tried to look at the XSD you have, and I have seen a couple of errors.
First
Second
Your code would look like this:
Try the XSD now and let me know.