Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

how to use xs:all with xs:extension?

 
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I try to use <xs:all> with <xs:extension> since I need to extend an element, and also make sure
child elements can be used in any order:
<xs:complexType name="parent">
<xs:complexContent>
<xs:extension base="grandParent">
<xs:all>
<xs:element name="name" type="xs:string"/>
<xs:element name="id" type="xs:string"/>
</xs:all>
</xs:extension>
</xs:complexContent>
</xs:complexType>
I got the following error:
An all group is only allowed at the top level of the content model
How can I achieve this?
regards,
 
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just tested by wriiting something similar in XMLSpy and it works !!!
wondering Why you got the error !!!
what is teh structiure of your base ? grandparent?
I think the errror is an indication taht something is wrong in the base type !!! Not sure though !!!
here is my code

[ February 16, 2004: Message edited by: Hari Vignesh Padmanaban ]
 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply.
So it works on XMLSpy. I am using Exerces. It says in "Professional XML
Schemas": an all group must appar as the sole child at the top of a content model. Don't know why.

I just need to find a way around to use both all and extension.
Any other way to do it?
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this out !!! dosent look very neat !!!

hope this helps :-)..if u find a more efficient way. please do let me know !!!
good luck !!
 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you very much. It looks nice. I will try it out.

Originally posted by Hari Vignesh Padmanaban:
Try this out !!! dosent look very neat !!!

hope this helps :-)..if u find a more efficient way. please do let me know !!!
good luck !!

 
reply
    Bookmark Topic Watch Topic
  • New Topic