• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML Schema questions

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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….
 
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic