4.4 Simple BinXml Example
The following is an example of a simple BinXml fragment (without use of templates):
-
<Event> <Element1>abc</Element1> <Element2> def &< ghi </Element2> <Element3 AttrA='abc' AttrB='def&<ghi'/> </Event> 00 : 0f 01 01 00 01 f2 00 00-00 ba 0c 05 00 45 00 76 <Event> 10 : 00 65 00 6e 00 74 00 00-00 02 01 22 00 00 00 b5 20 : 79 08 00 45 00 6c 00 65-00 6d 00 65 00 6e 00 74 30 : 00 31 00 00 00 02 05 01-03 00 61 00 62 00 63 00 40 : 04 01 44 00 00 00 b6 79-08 00 45 00 6c 00 65 00 </Element1> <Element2> 50 : 6d 00 65 00 6e 00 74 00-32 00 00 00 02 45 01 05 60 : 00 20 00 64 00 65 00 66-00 20 00 49 24 fb 03 00 70 : 61 00 6d 00 70 00 00 00-48 3c 00 05 01 05 00 20 80 : 00 67 00 68 00 69 00 20-00 04 41 6b 00 00 00 b7 </Element2> <Element3> 90 : 79 08 00 45 00 6c 00 65-00 6d 00 65 00 6e 00 74 A0 : 00 33 00 00 00 50 00 00-00 46 90 d8 05 00 41 00 B0 : 74 00 74 00 72 00 41 00-00 00 05 01 03 00 61 00 C0 : 62 00 63 00 06 91 d8 05-00 41 00 74 00 74 00 72 D0 : 00 42 00 00 00 45 01 03-00 64 00 65 00 66 00 49 E0 : 24 fb 03 00 61 00 6d 00-70 00 00 00 48 3c 00 05 F0 : 01 03 00 67 00 68 00 69-00 03 04 00 <Element3/> </Event>
|
Token offset |
Token type |
Comments on encoding |
|---|---|---|
|
00 |
0F - FragmentHeaderToken |
Version 1.1, flags=0 |
|
04 |
01 - OpenStartElementToken |
<Event> start tag. There is no Dependency ID because this is not a template definition. The length of the data for the entire element is 0xF2, and this data starts at offset 0x09. The data consists of three parts: name hash (2 bytes), string length (2 bytes), and name itself (the rest of the data). At offset 0x09, the name begins for the start tag. The length of the name is five Unicode characters (does not include a null-terminator). Note, the more bit is not set on the OpenStartElementToken, so attributes do not follow. |
|
19 |
02 - CloseStartElementToken |
Close <Event> start tag. |
|
1A |
01 - OpenStartElementToken |
<Element1> start tag, no attributes to follow. |
|
35 |
02 - CloseStartElementToken |
Close <Element1> start tag. |
|
36 |
05 - ValueTextToken |
The character data abc. It has a length of three Unicode characters (character data strings are not null- terminated). |
|
40 |
04 - EndElementToken |
End </Element1>. |
|
41 |
01 - OpenStartElementToken |
<Element2>. |
|
5C |
02 - CloseStartElementToken |
Close <Element2> start tag. |
|
5D |
45 - ValueTextToken (MoreBit) |
The character data "def ". Spaces surround def so its length is five Unicode characters. The more bit is set, so there is more character data that follows. |
|
6B |
49 - EntityRefToken (MoreBit) |
An entity reference with Name amp. More character data follows. |
|
78 |
48 - CharRefToken (MoreBit) |
The character reference for "&". More character data follows. |
|
7B |
05 - ValueTextToken |
The character data "ghi " (again with spaces). No more character data appears before the next markup token. |
|
89 |
04 - EndElementToken |
End </Element2>. |
|
8A |
41 - OpenStartElementToken ( MoreBit - AttrList ) |
<Element3>. The more bit is set, so an attribute list follows. The first attribute starts at offset 0xA9. |
|
A9 |
46 - AttributeToken (More Bit) |
This is AttrA, and more attributes follow. |
|
BA |
05 - ValueTextToken |
This is abc. |
|
C4 |
06 - AttributeToken ( No More Bit ) |
This is AttrB, and no more attributes follow. |
|
D5 |
45 - ValueTextToken (More Bit) |
The character data def, with more character data to follow. |
|
DF |
49 - EntityRefToken (MoreBit) |
The entity ref with Name amp with more character data to follow. |
|
EC |
48 - CharRefToken (MoreBit) |
The character reference for ampersand (&) with more character data to follow. |
|
EF |
05 - ValueTextToken |
The character data ghi, with no more character data before the next markup token. |
|
F9 |
03 - CloseEmptyElementToken |
Close empty <Element3/>. |
|
FA |
04 - EndElementToken |
End </Event>. |
|
FB |
00 - EOFToken |
End of fragment / document. |