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]
