RE: Imports do not seem to have any effect in validators.

Thanks to everyone for your help, with your advices I've followed the way to solve the problem so now it validates against the schema I wanted.

Thanks again for your help.

-----Mensaje original-----
De: Michael Kay [mailto:mike@saxonica.com] 
Enviado el: martes, 09 de mayo de 2006 11:16
Para: Ortuzar San Vicente, Lander; 'Florent Georges'; xmlschema-dev@w3.org
CC: Palenzuela Roses, Oriol
Asunto: RE: Imports do not seem to have any effect in validators.

You seem to have misunderstood what xs:import does. Schema A only needs to
import schema B if it makes use of definitions in schema B. Your
EFDs_reduced schema doesn't reference any definitions in Headers_reduced, so
there's no point in importing it. Your two data documents are both in the
namespace of EFDs_reduced, so they are both validated against the
definitions in EFDs_reduced.

You say "the schema which defines the Header tag is imported in the main
one". The imported schema defines a complex type called Header in namespace
http://www.gal-gms-ete.esa.int. But no-one ever refers to that type, so it
might as well not be defined. There's certainly no magical association
between this complex type and the element definition with local name Header
and namespace http://www.gal-gms-ete.esa.int/EFD in the other schema
document. They would be unrelated even if the names matched.

Declaring a local element like this:

<xsd:element name="Header" minOccurs="1"/>

allows <Header> to have any content it likes. The only way to refine this
definition is to create a type that's derived by restriction from the
complex type in which this local element definition appears - however, in
this case you can't do that, because the complex type is anonymous. 

Michael Kay
http://www.saxonica.com/

> -----Original Message-----
> From: xmlschema-dev-request@w3.org 
> [mailto:xmlschema-dev-request@w3.org] On Behalf Of Ortuzar 
> San Vicente, Lander
> Sent: 09 May 2006 09:32
> To: Florent Georges; xmlschema-dev@w3.org
> Cc: Palenzuela Roses, Oriol
> Subject: RE: Imports do not seem to have any effect in validators.
> 
> Dear Florent,
> 
> I attach you 2 XML with 2 schemas. The main schema is 
> EFDs_reduced.xsd which imports Headers_reduced.xsd. One of 
> the XML is correctly formatted and it validates as it is 
> expected, but the other one misses one field in the Header, 
> and the validators do not complain about that fact (although 
> the schema which defines the Header tag is imported in the main one)
> 
> The xml files are:
> 000sz06037i52RDEFD00000001_reduced.xml --> Correct 
> 000sz06037i52RDEFD00000001_reduced_WRONG.xml --> Wrong (who 
> would have guessed? ;-) )
> 
> The schemas:
> EFDs_reduced.xsd  (main)
> Headers_reduced.xsd (imported by main)
> 
> The validators I've tried are:
> 
> Xmllint with the following syntax:
> 
> > xmllint -schema EFDs_reduced.xsd 
> 000sz06037i52RDEFD00000001_reduced.xml       
> 
> And Xsv with the following syntax:
> 
> > xsv 000sz06037i52RDEFD00000001_reduced.xml
> 
> Thanks in advance for your help,
> 
> Lander Ortuzar.
> 
> -----Mensaje original-----
> De: Florent Georges [mailto:darkman_spam@yahoo.fr] Enviado 
> el: lunes, 08 de mayo de 2006 23:33
> Para: Ortuzar San Vicente, Lander; xmlschema-dev@w3.org
> CC: Palenzuela Roses, Oriol
> Asunto: RE: Imports do not seem to have any effect in validators.
> 
> "Ortuzar San Vicente, Lander" wrote:
> 
> > It seems like I'm missing something important ;), so please 
> somebody 
> > help me, and tell me what to do to get those imports to 
> work properly.
> 
>   It's hard to help you without information.  Can you please 
> post a minimal schema + XML instance that reproduce the 
> problem, as well as the commands you use to validate ?
> 
>   Regards,
> 
> --drkm
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 	
> 
> 	
> 		
> ______________________________________________________________
> _____________
> Faites de Yahoo! votre page d'accueil sur le web pour 
> retrouver directement vos services préférés : vérifiez vos 
> nouveaux mails, lancez vos recherches et suivez l'actualité 
> en temps réel. 
> Rendez-vous sur http://fr.yahoo.com/set
> 

Received on Tuesday, 9 May 2006 10:13:56 UTC