http://nagoya.apache.org/bugzilla/show_bug.cgi?id=2292

*** shadow/2292 Fri Jun 22 13:00:30 2001
--- shadow/2292.tmp.22294       Fri Jun 22 13:00:30 2001
***************
*** 0 ****
--- 1,115 ----
+ +============================================================================+
+ | Order of complexTypes in schema file causes error when extending complexTy |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2292                        Product: Xerces-J                |
+ |       Status: NEW                         Version: 1.4                     |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Windows NT/2K           |
+ |     Priority: Other                     Component: Schema-Structures       |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: [EMAIL PROTECTED]                                  |
+ |  Reported By: [EMAIL PROTECTED]                                             |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ When I run SAXCount on 'testWidget.xml' I get the following error:
+ 
+ >c:\jdk1.3\bin\java -classpath 
+ c:\dev\lib\xerces\xerces.jar;c:\dev\lib\xerces\xercesSamples.jar sax.SAXCount -
+ v testWidget.xml
+ [Error] testWidget.xml:5:21: Element type "widget:comment" must be declared.
+ testWidget.xml: 881 ms (3 elems, 4 attrs, 11 spaces, 6 chars)
+ 
+ To make this error go away I just have to reorder the complexType definitions 
+ in the 'widget.xsd' file so that the 'Widget' complexType comes before 
+ the 'Onething' complexType.  If 'Widget' is not the first complexType in the 
+ file, it will fail with the above error.  If 'Widget' is the first complexType 
+ in the file, it will work.  I am not aware of any restrictions on the order of 
+ complexType definitions, so this seems like a bug.
+ 
+ Attached are the files.  I have included a working and a non-working version of 
+ widget.xsd.
+ 
+ testWidget.xml
+ --------------
+ <test xmlns='http://www.foo.com/animalWidget'
+     xmlns:widget='http://www.foo.com/widget'
+     xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+     xsi:schemaLocation='http://www.foo.com/animalWidget file:animalWidget.xsd'>
+     <widget:comment>bar</widget:comment>
+     <name>foo</name>
+ </test>
+ 
+ widget.xsd (non-working)
+ ------------------------
+ <schema xmlns='http://www.w3.org/2001/XMLSchema'
+     targetNamespace='http://www.foo.com/widget'
+     xmlns:widget='http://www.foo.com/widget'
+     version='1.0'
+     elementFormDefault='qualified'
+     attributeFormDefault='unqualified'>
+ 
+     <complexType name='Onething'>
+         <sequence>
+             <element name='tag' type='string' minOccurs='1' 
+ maxOccurs='unbounded'/>
+         </sequence>
+     </complexType>
+ 
+     <complexType name='Widget'>
+         <sequence>
+             <element name='comment' type='string' minOccurs='1' maxOccurs='1'/>
+         </sequence>
+     </complexType>
+ </schema>
+ 
+ widget.xsd (working)
+ --------------------
+ <schema xmlns='http://www.w3.org/2001/XMLSchema'
+     targetNamespace='http://www.foo.com/widget'
+     xmlns:widget='http://www.foo.com/widget'
+     version='1.0'
+     elementFormDefault='qualified'
+     attributeFormDefault='unqualified'>
+ 
+     <complexType name='Widget'>
+         <sequence>
+             <element name='comment' type='string' minOccurs='1' maxOccurs='1'/>
+         </sequence>
+     </complexType>
+ 
+     <complexType name='Onething'>
+         <sequence>
+             <element name='tag' type='string' minOccurs='1' 
+ maxOccurs='unbounded'/>
+         </sequence>
+     </complexType>
+ </schema>
+ 
+ animalWidget.xsd
+ ----------------
+ <schema xmlns='http://www.w3.org/2001/XMLSchema'
+     targetNamespace='http://www.foo.com/animalWidget'
+     xmlns:widget='http://www.foo.com/widget'
+     version='1.0'
+     elementFormDefault='qualified'
+     attributeFormDefault='unqualified'>
+ 
+     <import namespace='http://www.foo.com/widget'
+         schemaLocation='file:widget.xsd'/>
+         
+     <element name='test' type='animalWidget:LemurWidget'/>
+     
+     <complexType name='LemurWidget'>
+        <complexContent>
+             <extension base='widget:Widget'>
+                 <sequence>
+                     <element name='name' type='string' minOccurs='0' 
+ maxOccurs='unbounded'/>
+                 </sequence>
+             </extension>
+         </complexContent>
+     </complexType>    
+ </schema>
\ No newline at end of file

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to