[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: is it a bug,or i m wrong?

  • To: "fc_??" <fangc@b...>,"Henry S. Thompson" <ht@c...>
  • Subject: RE: is it a bug,or i m wrong?
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Wed, 7 May 2003 20:13:36 -0700
  • Cc: <xml-dev@l...>
  • Thread-index: AcMO/LK53ftVR0M+S9ihedmwQ6hZMQF/+gtAAASFhjA=
  • Thread-topic: is it a bug,or i m wrong?

nameandtypeok
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@b... [mailto:fangc@b...] 
> Sent: Wednesday, May 07, 2003 6:38 PM
> To: Henry S. Thompson
> Cc: xml-dev@l...
> 
> 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@c...]
> ·¢ËÍʱ¼ä: 2003Äê4ÔÂ30ÈÕ 17:40
> ÊÕ¼þÈË: fc_·½³¬
> ³­ËÍ: xml-dev@l...
> Ö÷Ìâ: Re:  import problem
> 
> =?utf-8?B?ZmNf5pa56LaF?= <fangc@b...> 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@c...
> 		     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>
> 
> 

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.