aspose file tools*
The moose likes XML and Related Technologies and the fly likes how to use xs:all with xs:extension? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "how to use xs:all with xs:extension?" Watch "how to use xs:all with xs:extension?" New topic
Author

how to use xs:all with xs:extension?

rick collette
Ranch Hand

Joined: Mar 22, 2002
Posts: 208
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

Joined: Oct 07, 2003
Posts: 578
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

Joined: Mar 22, 2002
Posts: 208
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

Joined: Oct 07, 2003
Posts: 578
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

Joined: Mar 22, 2002
Posts: 208
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 !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to use xs:all with xs:extension?