Tuesday, 17 April 2018

ASN.1: SEQUENCE OF : Define collection of items of same type

Type: SEQUENCE OF

Description: Used to define collection of items of same type. It is similar to arrays in programming languages.

Example
favoriteColors SEQUENCE OF VisibleString

In the above example, favoriteColors is a variable that can store collection of variables of type VisibleString.

Example Schema
Person ::= SEQUENCE {
    name VisibleString,
    favoriteColors SEQUENCE OF VisibleString
}

Sample data for above schema
person Person ::= {
    name "Rama krishna",
    favoriteColors {"green", "white", "dark blue"}
}

XML encoding of above data
<?xml version="1.0" encoding="UTF-8"?>
<Person>
  <name>Rama krishna</name>
  <favoriteColors>
    <VisibleString>green</VisibleString>
    <VisibleString>white</VisibleString>
    <VisibleString>dark blue</VisibleString>
  </favoriteColors>
</Person>





Previous                                                 Next                                                 Home

No comments:

Post a Comment