Altova Mailing List Archives>Archive Index >xmlschema-dev Archive Home >Recent entries >Thread Prev - Composition by extension in namespaced schema >Thread Next - RE: Composition by extension in namespaced schema RE: Composition by extension in namespaced schemaTo: "'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. | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
