Hi Peter, One of the things I suspect might be confusing you is that the schemaLocation attribute that you use in instance documents comes from the http://www.w3.org/2001/XMLSchema-instance namespace, while the schemaLocation attribute that lives within <import> schema information items does not have a namespace. So they're really unrelated attributes--though they serve the same function and look syntactically similar.
As to your second question, no I don't believe there's any way to get at the namespace from your EntityResolver. Maybe that's something we should think about for Xerces-2. Cheers, Neil Neil Graham XML Parser Development IBM Toronto Lab Phone: 416-448-3519, T/L 778-3519 E-mail: [EMAIL PROTECTED] Peter Tornberg <[EMAIL PROTECTED]> on 06/06/2001 08:51:35 AM Please respond to [EMAIL PROTECTED] To: [EMAIL PROTECTED] cc: Subject: Re: Import does not work! Thanks Elena! At first I was unable to get the systemId in the EntityResolver, but after replacing the xsi:schemaLocation with schemaLocation the systemId imp.xsd was given to the resolver. (Does this mean that the http://www.w3.org/2001/XMLSchema-instance uses unqualified attributes?) question: Is there any way to get the targetNamespace associated with the imported schema handed to the resolver? I think it would be nice to be handed both namespace and the location-hint to the resolver. In XMLValidator.java method bindNamespacesToElementAndAttributes i found commented code that did just this for regular schema validation. /***** for (int i=0; i< schemaCandidateURIs.size(); i++) { String uri = (String) schemaCandidateURIs.elementAt(i); resolveSchemaGrammar(uri); } /*****/ I suppose this is the case for imported schemas as well!? Thanks! /Peter At 08:10 2001-06-06 -0400, you wrote: >Hi, Peter, > >This is how you should use it: ><import namespace="_targetNamespace_of_imported schema" >schemaLocation="schema_file_name.xsd"/> > > >From the spec [http://www.w3.org/TR/xmlschema-1/#element-import]: >"When a schemaLocation is present, it must contain a single URI >reference which the schema author warrants will resolve to a >serialization of a �schema document� containing the component(s) in the ><import>ed namespace referred to elsewhere in the containing schema >document" >It looks like you are using "" string for schemaLocation. Namespace >attribute can be omitted if the imported schema does not have any >targetNamespace. > >Examples: ><xs:import namespace="http://www.example.org/NS_imp" >schemaLocation="NSSchema_Imp.xsd"/> ><xs:import schemaLocation="noNSSchema_Imp.xsd"/> > >Hope it helps, >Elena > >Peter Tornberg wrote: > > > > Hi all, > > > > I've been looking at the import mechanism, but been unable to get it to > > work. When I set SchemaLocation inside the import element I get: > > [Error] Schema error: Attribute 'SchemaLocation' cannot appear in 'import'. > > > > In the XML Schema Primer 1 import is defined as: > > <import > > id = ID > > namespace = anyURI > > schemaLocation = anyURI > > {any attributes with non-schema namespace . . .}> > > Content: (annotation?) > > </import> > > > > How much support for import is built into Xerces. I can't find any info on > > the Xerces website saying that it does not support import. > > > > Thanks! > > > > /Peter > > > > --------------------------------------------------------------------- > > 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
