OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

 


 

   RE: [xml-dev] is it a bug,or i m wrong?

[ Lists Home | Date Index | Thread Index ]

The problem you are facing is a common misunderstanding that people face with dealing with derivation by restriction in W3C XML Schema. Your derivation breaks the following rule 


Schema Component Constraint: Particle Restriction OK (Elt:Elt -- NameAndTypeOK) 

For an element declaration particle to be a ·valid restriction· of another element declaration particle all of the following must be true:
1 The declarations' {name}s and {target namespace}s are the same. 

-- 
PITHY WORDS OF WISDOM 
If at first you don't succeed, imitate.                                             

This posting is provided "AS IS" with no warranties, and confers no rights. 

>  
>  
> -----Original Message-----
> From: fangc@bsoft.com.cn [mailto:fangc@bsoft.com.cn] 
> Sent: Wednesday, May 07, 2003 6:38 PM
> To: Henry S. Thompson
> Cc: xml-dev@lists.xml.org
> 
> Hi
> 
> I had a post in 2003-4-29, said I m could import a abstract 
> complex type and derived from that complex type. And thanks 
> Mr. Henry S. Thompson, he give me the advice that I use the 
> same target namespace in import file.
> Well, after I using the different target Namespace, the 
> problem still exists.
> I could not find any mistake I have made in the file. So I 
> think maybe it's the parser's bug,and I fix the MSXML 4.0 
> Service Pack 2,but the issue still occur.
> What could I do?
> This problem has tortured me for a whole week.
> Is it a bug? Or are these file correct?
> Could anyone help me?
> 
> Here is the file.
> main.xsd
> <xs:schema targetNamespace="http://www.test.com/"; 
> xmlns="http://www.test.com/";  
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> elementFormDefault="qualified">
> 	<xs:simpleType name="PowerEnum">
> 		<xs:restriction base="xs:string">
> 			<xs:enumeration value="1Pounds"/>
> 			<xs:enumeration value="2Pounds"/>
> 			<xs:enumeration value="300Pounds"/>
> 		</xs:restriction>
> 	</xs:simpleType>
> 	<xs:complexType name="Man" abstract="true">
> 		<xs:sequence>
> 			<xs:element name="Name" type="xs:string"/>
> 			<xs:element name="Power" type="PowerEnum"/>
> 		</xs:sequence>
> 	</xs:complexType>
> </xs:schema>
> 
> main_derive.xsd
> <xs:schema xmlns="http://www.test.com/ok"; 
> targetNamespace="http://www.test.com/ok"; 
> xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> xmlns:im="http://www.test.com/"; elementFormDefault="qualified">
> 	<xs:import namespace="http://www.test.com/"; 
> schemaLocation="main.xsd"/>
> 	<xs:complexType name="SuperMan">
> 		<xs:complexContent>
> 			<xs:restriction base="im:Man">
> 				<xs:sequence>
> 					<xs:element name="Name" 
> type="xs:string"/>
> 					<xs:element name="Power">
> 						<xs:simpleType>
> 							
> <xs:restriction base="im:PowerEnum">
> 								
> <xs:enumeration value="300Pounds"/>
> 							
> </xs:restriction>
> 						</xs:simpleType>
> 					</xs:element>
> 				</xs:sequence>
> 			</xs:restriction>
> 		</xs:complexContent>
> 	</xs:complexType>
> 	<xs:element name="test">
> 		<xs:complexType>
> 			<xs:sequence>
> 				<xs:element name="OneMan" 
> type="SuperMan"/>
> 				<xs:element name="ok" type="xs:string"/>
> 			</xs:sequence>
> 		</xs:complexType>
> 	</xs:element>
> </xs:schema>
> 
> what could I do?
> I check the file for hundreds of times. But no miracle 
> happened. How depress I was!
> Best Regards
> fbeyond
> -----邮件原件-----
> 发件人: Henry S. Thompson [mailto:ht@cogsci.ed.ac.uk]
> 发送时间: 2003年4月30日 17:40
> 收件人: fc_方超
> 抄送: xml-dev@lists.xml.org
> 主题: Re: [xml-dev] import problem
> 
> =?utf-8?B?ZmNf5pa56LaF?= <fangc@bsoft.com.cn> writes:
> 
> > Hi,I got a namespace problem.
> 
> You're using import for a schema document with the same 
> target namespace as the importing document -- you should be 
> using include.
> 
> See the W3C XML Schema Primer [1] for an example.
> 
> ht
> 
> [1] http://www.w3.org/TR/xmlschema-0/#SchemaInMultDocs
> --
>   Henry S. Thompson, HCRC Language Technology Group, 
> University of Edinburgh
>                       Half-time member of W3C Team
>      2 Buccleuch Place, Edinburgh EH8 9LW, SCOTLAND -- (44) 
> 131 650-4440
> 	    Fax: (44) 131 650-4587, e-mail: ht@cogsci.ed.ac.uk
> 		     URL: http://www.ltg.ed.ac.uk/~ht/  [mail 
> really from me _always_ has this .sig -- mail without it is 
> forged spam]
> 
> -----------------------------------------------------------------
> The xml-dev list is sponsored by XML.org 
> <http://www.xml.org>, an initiative of OASIS 
> <http://www.oasis-open.org>
> 
> The list archives are at http://lists.xml.org/archives/xml-dev/
> 
> To subscribe or unsubscribe from this list use the subscription
> manager: <http://lists.xml.org/ob/adm.pl>
> 
> 




 

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 2001 XML.org. This site is hosted by OASIS