File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes [schema] Allow an element to have any content Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "[schema] Allow an element to have any content" Watch "[schema] Allow an element to have any content" New topic
Author

[schema] Allow an element to have any content

Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
I'm having trouble creating a schema where one element can have any content, i.e. within my xml, I have an element that can consist of any sub-elements. For example:


How can I define <sub1> in my schema to allow any sub-elements?
I tried playing with <xs:any>, but the validation fails on anything under <sub1>, complaining about 'unexpected element'.


Blake Minghelli<br />SCWCD<br /> <br />"I'd put a quote here but I'm a non-conformist"
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
This should work:


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Originally posted by Lasse Koskela:
This should work:
That's exactly what I tried. Unfortunately XMLSpy still reports the error: "Element 'sub1' not defined in DTD/Schema"
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Blake!.. Could you please post your complete schema snippet using UBB code tags?


Spritle Software Blogs
Blake Minghelli
Ranch Hand

Joined: Sep 13, 2002
Posts: 331
Originally posted by Balaji Loganathan:
Blake!.. Could you please post your complete schema snippet using UBB code tags?
Here is the entire schema. The content under the "CCI_Server_Interface" is what I am trying to set up to allow any content.
Any suggestions? Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: [schema] Allow an element to have any content