• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to use xs:all with xs:extension?

 
rick collette
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • 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,
 
Hari Vignesh Padmanaban
Ranch Hand
Posts: 578
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
  • 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 !!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic