• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

[schema] Allow an element to have any content

 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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'.
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should work:
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Blake!.. Could you please post your complete schema snippet using UBB code tags?
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic