Sunday 15 April 2018

ANS.1: ENUMERATED: Model list of items

Type: ENUMERATED

Description: ENUMERATED is used to model constants. If you have list of items, you can model them using ENUMERATED type.     

Example
FavoriteColors ::= ENUMERATED {black, green, red, yellow, white}

Example Schema
FavoriteColors ::= ENUMERATED {black, green, red, yellow, white}

Person ::= SEQUENCE {
    name VisibleString,
    favoriteColor FavoriteColors
}


Sample data for above schema
personOne Person ::={
 name "Rama Krishna",
 favoriteColor green
}

XML encoding of above data
<?xml version="1.0" encoding="UTF-8"?>
<Person>
  <name>Rama Krishna</name>
  <favoriteColor><green/></favoriteColor>
</Person>




Previous                                                 Next                                                 Home

No comments:

Post a Comment