Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

same element multiple times with default values

 
Priti Shah
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • 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
 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic