import schema problem

Hello all, i have a schema A with namespace “http://www.test.com/a”, which import a schema B with namespace"http://www.test.com/b". They are in the same collection. In schema B, i have define the common types, which i want to use in schema A. see → <xs:schema targetNamespace = “http://www.test.com/a” xmlns = “http://www.test.com/a” xmlns:b = “http://www.test.com/b” xmlns:tsd = “http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition” xmlns:xs = “XML Schema”> <xs:import namespace = “http://www.test.com/b” schemaLocation = “b.tsd”></xs:import> <xs:element name = “test”> xs:complexType xs:sequence <xs:element name = “testId” type = “xs:string”></xs:element> <xs:element name=“last” type=“b:lastmodificationType”> </xs:element> </xs:sequence> </xs:complexType> </xs:element> … I’got a error: invalid import element. schema reference could not be resolved. Can somebody tell me what’s wrong with my code? thanks, chacha

i think the problem is the schemalocation. Although the both schema are in the same collection, the collection name must be included in the path. Now tamino accept my schema.

Hi Tamino accepts three variants of the schemaLocation attribute: (1) (2) ./ (3) …// where (1) and (2) are equivalent. (3) is needed if the imported / included schema is located in a different collection, but may also be used if the of the imported / included schema is the same as the one of the importing / including schema. and are the values of the name attribute in tsd:collection and tsd:schemaInfo, respectively. Regards Uli

Hi Uli, Thank you for your explanation. Unfortunately it doesn’t work with include. Hier is my test code: ----includingSchema-------

<?xml version = "1.0" encoding = "UTF-8"?> <xs:schema targetNamespace = "http://www.ah.de/include" attributeFormDefault = "qualified" elementFormDefault = "qualified" xmlns = "http://www.ah.de/include" xmlns:tsd = "http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition" xmlns:xs = "http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <tsd:schemaInfo name = "includingSchema"> <tsd:collection name = "includeTest"></tsd:collection> <tsd:doctype name = "including"> <tsd:logical> <tsd:content>closed</tsd:content> </tsd:logical> </tsd:doctype> </tsd:schemaInfo> </xs:appinfo> </xs:annotation> <xs:include schemaLocation = "../includeTest/includedSchema.tsd"></xs:include> <xs:element name = "including"> <xs:complexType> <xs:sequence> <xs:element name = "organisation" type = "xs:string"></xs:element> <xs:element name = "person" type = "personType"></xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 

----includedSchema-----

<xs:schema xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <tsd:schemaInfo name="includedSchema"> <tsd:collection name="includeTest"/> <tsd:adminInfo> <tsd:server>4.2.1.1</tsd:server> <tsd:modified>2006-07-20T13:10:04.879+01:00</tsd:modified> <tsd:created>2006-07-20T13:10:04.879+01:00</tsd:created> <tsd:version>TSD4.2</tsd:version> </tsd:adminInfo> </tsd:schemaInfo> </xs:appinfo> </xs:annotation> <xs:complexType name="personType"> <xs:sequence> <xs:element name="name" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema>

I have tried with the 3 variants of the path exprssion. I became always the same message: invalid import element. schema reference could not be resolved please give me a sample usage of xs:include in tamino schema, which works. best regards, chacha

Hi include is only valid if both schemas have same targetNamespace Cheers Uli

in the book “definitve xml Schema” from priscilla walmsley there are following sentences: "when you use includes, one of the following must be true:

  • Both schema documents have the same target namespace
  • Neither schema document hast a target namespace
  • the including schema document has a target namespace, and the included schema document does not have a target namespace

I think in a normal case they have the same targetnamespace. I use the 3th. variant because i have a couple of schemata, each of the has it’s own namespace and the included schema should be included in them. Furthermore after that i inserted the same targetnamespace in included schema, i became the error message again. I’m frustrated. chacha

Hi Chacha sorry for you being frustrated. - The 3rd variant (so called “chameleon include”) is not supported by Tamino. - Which error message do yuo obtain when using identical targetNamespace in both schemas? Cheers Uli

b Invalid include element. Schema reference could not be resolved. <INODE7931,INOXDE7580> [/b] INODE7931-> An error occurred while processing a schema document INOXDE7580-> indicate the line where an error appeares. This is the line of xs:include

Please provide both schemas

—includedSchema----

<?xml version="1.0" encoding="UTF-8"?> <xs:schema targetNamespace="http://www.test.de/include" xmlns="http://www.test.de/include" xmlns:tsd="http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <tsd:schemaInfo name="includedSchema"> <tsd:collection name="includeTest"/> <tsd:adminInfo> <tsd:server>4.2.1.1</tsd:server> <tsd:modified>2006-07-21T11:23:18.098+01:00</tsd:modified> <tsd:created>2006-07-21T11:23:18.098+01:00</tsd:created> <tsd:version>TSD4.2</tsd:version> </tsd:adminInfo> </tsd:schemaInfo> </xs:appinfo> </xs:annotation> <xs:complexType name="personType"> <xs:sequence> <xs:element name="name" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:schema> 

–includingSchema----

<?xml version = "1.0" encoding = "UTF-8"?> <xs:schema targetNamespace = "http://www.test.de/include" elementFormDefault = "qualified" xmlns = "http://www.test.de/include" xmlns:tsd = "http://namespaces.softwareag.com/tamino/TaminoSchemaDefinition" xmlns:xs = "http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <tsd:schemaInfo name = "includingSchema"> <tsd:collection name = "includeTest"></tsd:collection> <tsd:doctype name = "including"> <tsd:logical> <tsd:content>closed</tsd:content> </tsd:logical> </tsd:doctype> </tsd:schemaInfo> </xs:appinfo> </xs:annotation> <xs:include schemaLocation = "../includeTest/includedSchema.tsd"></xs:include> <xs:element name = "including"> <xs:complexType> <xs:sequence> <xs:element name = "organisation" type = "xs:string"></xs:element> <xs:element name = "person" type = "personType"></xs:element> </xs:sequence> </xs:complexType> </xs:element> </xs:schema> 

Hi if you have in included schema <tsd:schemaInfo name=“includedSchema”> <tsd:collection name=“includeTest”/> you have to use schemaLocation = “…/includeTest/includedSchema” in the including schema, i.e. without the “.tsd”. You may also use schemaLocation = “includedSchema” as the collection name is identical in both schemas. Regards Uli

Oh je, thank you for your help. I didn’t read your first message carefully. In Tamino the schemaLocation is without suffix ‘.tsd’! I am an idiot. But i wonder that tamino accepted my schemaLocation with suffix ‘.tsd’ in xs:import Best regards, chacha

Hi you may have a schemaLocation ending with “.tsd” - but then you should also have <tsd:schemInfo name=“… .tsd”/> Regards Uli