Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

XML Schema questions

 
Samba Siva Rao Potla
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the some questions.
-> How can XML Schema author constrain element's text content as mandatory?
Element declaration: <xsd:element name="xyz">
Instance document can contain an empty element <xyz/> which I want to constrain
I guess this constrain can be achieved by specifying element is a key which makes the element as not nillable and also unique (don't needed). Is there any other way of doing this?
-> XML Schema specification Primer 0 says that if minOccurs exists and maxOccurs omitted then the value of minOccurs<=maxOccurs default value i.e 0 or 1.
Whereas Pro XML 2nd edition says that in this case maxOccurs value would be equals to the minOccurs value.
Please clear this confusion or am I wrong in understanding….
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
About your second question.
The specification says that the default value for minOccurs and maxOccurs is 1.
XML Spy supports it. When I tried minOccurs = 0, I could have only 0 or 1 instances of the element.
Cheers,
Dan
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic