The Emergence of ASN.1 As An XML Schema Notation
The Emergence of ASN.1 As An XML Schema Notation
1
as an XML Schema
Notation
What is ASN.1? (1)
Today, it is a notation for defining the
content and form of an XML document
That is, it is an XML schema notation
But originally it was a notation for
defining the content – the abstract syntax
of documents, supported by binary
encoding rules
Hence Abstract Syntax Notation One
What is ASN.1? (2)
Quite old – early 1980s.
Mature! But still developing.
ISO Standards and ITU-T Recommendations
Heavily used to define messages in many
industrial and commercial sectors
Until recently, all ASN.1-defined messages
were encoded in binary.
ASN.1 - lineage
ASN.1 was borne around 1982 ish
First ASN.1 Standard (CCITT X.409) in 1984
Borne from X.400 (mother with an early child,
and the e-mail standard the world *should* have
had!)
Fathered by X.500 (certified insane at birth, but
totally secure)
Grand-parents (OSI) died prematurely and are
not discussed in polite conversation today
Waving a magic wand
Without ASN.1-defined messages:
– The lights go out! X
– Portable phones don’t work! X
–
–
Parcels get lost!
X X
Traffic lights fail!
– Aircraft fall from the sky! X
– Your impending marriage suffers
as Net Meeting fails! X
On second thoughts – it might be a better
world?
A sample of ASN.1 notation
BBCard ::= SEQUENCE {
name IA5String,
team IA5String,
age INTEGER,
position IA5String,
handedness ENUMERATED {
left-handed,
right-handed,
ambidextrous },
batting-average REAL }
A sample of ASN.1 notation
with "facets"
(encouraged)
BBCard ::= SEQUENCE {
name IA5String (SIZE (1..60)),
team IA5String (SIZE (1..60)),
age INTEGER (1..100),
position IA5String (SIZE (1..60)),
handedness ENUMERATED {
left-handed,
right-handed,
ambidextrous },
batting-average REAL }
The C data-structure for the
base-ball card
typedef struct BBCard {
char name [61] ;
char team [61] ;
short age ;
char position [61] ;
enum {
left_handed = 0,
right_handed = 1,
ambidextrous = 2,
} handedness ;
float batting_average ;
} BBCard ;
A base-ball card value in XML
syntax
<BBCard>
<name>Jorge Posada</name>
<team>New York Yankees</team>
<age>29</age>
<position>C</position>
<handedness>right-handed</handedness>
<batting-average>0.277</batting-average>
</BBCard>
The Montagues and the
Capulets
(A shorter history of
contending philosophies)
A long and on-going civil dispute
Montagues =>
Binary-based specification
Capulets =>
Character-based specification
Understanding of protocol
specification techniques
1.5 billion seconds ago …..
Computers started to communicate
Major advances every 150 million seconds
There was a need for
– A means of syntax (data structure) specification
– Procedure (sequence) specification
– Test suite specification
– Validation
And tools to support rapid implementation!
The stone-age Montagues
Diagrams of bits and bytes - e.g. IPv4
(The earliest approach, simple and clear, but focusing
totally on the bits-on-the-line.)
<Employee>
<id>239</id>
<recruited>27-11-2002</recruited>
<salaries>
<salary>29876</salary>
<salary>54375</salary>
<salary>98435</salary>
</salaries>
</Employee>
With the coloring, we get:
<employee id = "239">
<recruited>27-11-2002</recruited>
<salaries>29876 54375 98435</salaries> </employee>
Cont
The XML encoding of an
Invoice (2)
Continuation
<Line-item>
<part-no>4793</part-no>
<quantity>74</quantity>
</Line-item>
</details>
<charge>397.65</charge>
<authenticator>
EFF8 E976 5403 629F
</authenticator>
</invoice>
Determinism, or "safety"
versus power!
See the supporting paper
BASIC-XER is totally "safe" – a total idiot can
produce a specification where the XML is never
ambiguous!
Everything is wrapped up
With EXTENDED-XER you can remove wrappers
(XML tags) round repetitions, choices and sequences
(that may have optional elements) using the
[UNTAGGED] encoding instruction
Caveat Emptor!
ASN.1 and RELAX NG (all on
one slide!)
Invoice ::= SEQUENCE {
number INTEGER,
name UTF8String,
details SEQUENCE OF
SEQUENCE { part-no INTEGER,
quantity INTEGER },
charge REAL,
authenticator BIT STRING}
element Invoice {
element number {integer},
element name {text},
element details { element part-no {integer},
element quantity {integer} } * ,
element charge {float},
element authenticator {bits} }
Pretty similar!
The importance of having
binary encodings available?
Re-opening the Montague and Capulet war!
Romeo and Juliet, happily married for a few years,
get divorced! Maybe not!
There are real merits in using the same schema
definition for both character and binary encodings
Work on binary XSD recognises that, but is
hampered because XSD basically defines allowed
syntax, not content. ASN.1 binary encodings are
very mature! (And have canonical variants.)
The next example can be taken quickly
A personnel-record defined (1)