Ciao a tutti.
Sto iniziando ad utilizzare seriamente XML all'interno dei miei progetti e vorrei aggiungere gli XSD schema per rendere più serio tutto quanto.
Utilizzando NetBeans per la validazione mi sono trovato di fronte a questo problema:
Il seguente XML
Ha il seguente XSD (chatSchema.xsd):codice:<?xml version="1.0" encoding="UTF-8"?> <chat xmlns="http://www.chat.simovinci.it/schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:schemaLocation="http://www.chat.simovinci.it/schema chatSchema.xsd"> <utente>Gianfredo</utente> </chat>
Non risulta valido con il seguente errore:codice:<?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.chat.simovinci.it/schema" xmlns="http://www.chat.simovinci.it/schema"> <xs:element name="chat" type="tipoChat"/> <xs:complexType name="tipoChat"> <xs:sequence> <xs:element name="utente" type="xs:string" maxOccurs="unbounded" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:schema>
cvc-complex-type.2.4.a: Invalid content was found starting with element 'utente'. One of '{utente}' is expected. [6]
Mentre se tolgo il tag 'utente' lasciandolo così:
Risulta validato...codice:<?xml version="1.0" encoding="UTF-8"?> <chat xmlns="http://www.chat.simovinci.it/schema" xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" xsd:schemaLocation="http://www.chat.simovinci.it/schema chatSchema.xsd"> </chat>
PERCHE'?? Lo schema sembra corretto... :master:

Rispondi quotando