Hi David and Armin, I think this is the problem. Say a user wants to take control over what documents get resolved to by schemaLocation attributes. So she registers an EntityResolver with the parser she's using. In this situation, she'll expect Xerces to use her EntityResolver whether it's parsing an instance doc or a schema. To Xerces, one EntityResolver is as good as another; so we always use our default entityResolver unless the user tells us otherwise.
Now the DefaultEntityResolver doesn't know anything about anything; the world looks the same to it when it's called from an instance document as when called from a schema. It just looks at the system property user.dir (if no absolute URI is specified) and goes from there. So naturally its behaviour is the same when called from a schema as from an instance doc. So the right solution appears to be this: If xerces's default treatment is not to your liking, write your own EntityResolver and handle it yourself. IMHO, while making our DefaultEntityResolvre context sensitive--or invoking different default EntityResolvers in different places--might make us more compatible with XMLSpy, it would also make our default resolution less predictable. Hope that helps, Neil Neil Graham XML Parser Development IBM Toronto Lab Phone: 416-448-3519, T/L 778-3519 E-mail: [EMAIL PROTECTED] "NeSmith, David" <[EMAIL PROTECTED]> on 07/19/2001 11:28:01 AM Please respond to [EMAIL PROTECTED] To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]> cc: Subject: RE: Schema not found I guess what Armin and I were saying is that the included schema should be able to be referenced by the original schema by a relative path extending from the original schema. If you reference all schemas relative to your XML file, then when you open your original schema (which is in a seperate directory than your XML file) in say, XML Spy, then it can't find the included schema. Also, it doesn't appear to be the case that XERCES 1.4.1 is looking for the schema in the prog executing directory. Try to parse Armin's XML file in a seperate directory from your execution directory and you will get an error XSD not found in the XML file's directory. -David -----Original Message----- From: Etienne Roy [mailto:[EMAIL PROTECTED] Sent: Thursday, July 19, 2001 10:26 AM To: [EMAIL PROTECTED] Subject: Re: Schema not found Armin, Xerces look up the files relatively to the directory you're runnning your prog in, and not the one your first schema is: > > [Warning] :0:0: File "file:///home/dave/tmp/ML_primitive.xsd" not found. Your prog in running in home/dave/tmp/ where it's looking for ML_primitive, that is not here but in xsd/. If you change <include schemaLocation="ML_primitive.xsd"/> to <include schemaLocation="xsd/ML_primitive.xsd"/> in ML.xsd, that works. Same thing if you move both schemas in tmp/ and remove the relative path in your instance. > I have a schema which includes another schema. Xerces doesn't find the > included schema, if the schema files and the xml file are in different > directories. What can I do? I know I asked the same question a few days ago, > but there was no answer. I really need a solution to the problem. Cheers -- Etienne --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
