Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


RE: Composition by extension in namespaced schema

From: "Michael Kay" <mike@--------.--->
To: "'Gavin Kistner'" <phrogz@---.--->, <xmlschema-dev@--.--->
Date: 3/14/2008 7:22:00 PM
> I need to use a targetNamespace (or is it an xmlns?) in my 
> schema so that I can validate other files without having to 
> add noNamespaceSchemaLocation to those files. Can someone 
> help me understand the core issue here, and (especially) how 
> to modify the file to accomplish the goal?
> 
> Thanks! Test case follows:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> targetNamespace="http://www.foo.com/">
>   <xs:complexType name="mammal" />
>   <xs:element name="dog">
>     <xs:complexType><xs:complexContent>
>     	<xs:extension base="mammal" />
>     </xs:complexContent></xs:complexType>
>   </xs:element>
> </xs:schema>
> 

The type is in a namespace, so the reference to it needs to be prefixed:

> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" 
> targetNamespace="http://www.foo.com/"
  xmlns:tgt="http://www.foo.com/">
>   <xs:complexType name="mammal" />
>   <xs:element name="dog">
>     <xs:complexType><xs:complexContent>
>     	<xs:extension base="tgt:mammal" />
>     </xs:complexContent></xs:complexType>
>   </xs:element>
> </xs:schema>

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


From phrogz@m... Fri Mar 14 20:35:29 2008
Received: from aji.w3.org ([133.27.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent