Type: CHOICE
Description: Used to select one
item from collection of items.
Example
Motorcar ::= SEQUENCE { carRegNumber VisibleString } Bicycle ::= SEQUENCE { bicycleColor VisibleString, bicycleModel VisibleString } Boat ::= SEQUENCE { boatRegNumber VisibleString } PreferredVehicle ::= CHOICE { car Motorcar, bicycle Bicycle, boat Boat }
Example Schema
Motorcar ::= SEQUENCE { carRegNumber VisibleString } Bicycle ::= SEQUENCE { bicycleColor VisibleString, bicycleModel VisibleString } Boat ::= SEQUENCE { boatRegNumber VisibleString } PreferredVehicle ::= CHOICE { car Motorcar, bicycle Bicycle, boat Boat } Person ::= SEQUENCE { name VisibleString, id VisibleString, preferredVehicle PreferredVehicle }
Sample data for above
schema
XML encoding of above data
person Person ::= { name "Rama Krishna", id "I123456", preferredVehicle bicycle: { bicycleColor "Blue", bicycleModel "Hero 42M" } }
XML encoding of above data
<?xml version="1.0" encoding="UTF-8"?> <Person> <name>Rama Krishna</name> <id>I123456</id> <preferredVehicle> <bicycle> <bicycleColor>Blue</bicycleColor> <bicycleModel>Hero 42M</bicycleModel> </bicycle> </preferredVehicle> </Person>
No comments:
Post a Comment