• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

same element multiple times with default values

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have xml file some thing like this

<classes>
<class id='class1' number='1'></class>
<class id='class2' number='2'></class>
<class id='class3' number='3'></class>
<class id='class4' number='4'></class>
</classes>

I want to write schema for this. Constraint is 'class1' can only have number value '1', 'class2' can only have number values '2' so on...

So i can not use enumeration here because some how i want to keep fix values of both the attributes.

One way of doing this is I can define static elements in schema with predefined values but problem doing this is that it rejects to have element with same name more than once.

Any idea how can it be done ?

Any help is appreciated.
Thanks
 
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The constructs you are looking for are



or should I just write a text file, since everything seems to be fixed.

I would recommend Definetive XML Schema.

- m
 
Priti Shah
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My main concern here is all elements are of same type 'class'. So can you write above snippet in little bit more detail which includes multiple class elements ?

Thanks
 
reply
    Bookmark Topic Watch Topic
  • New Topic