• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML schema

 
Hemant Kamat
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My problem is this:
I have an element called <course> to describe a course. The problem is that the course can have a footnote ascribed to it in some cases only. How do I capture this in my schema?
What I have thought is this:
Have an optional attribute called footnote in <course> to determine if there is a footnote. If this is the case check for the <footnote> element in <course>
e.g <course footnote='yes'>
<!-- Then this is required -->
<footnote>
<symbol> </symbol>
<content> </content>
</footnote>
if <course>
<!-- then footnote element is optional -->
How do I implement this using a schema?
Any help will be appreciated.
 
Shashank Tanksali
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't really make the presence or absence of child elements dependent on the values of attributes using XML schema.

Hope this helps.
Shashank
 
Danl Thompson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try minOccurs=0 it defaults to 1. That will make it optional.
Dan'l
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic