Share via


3.3 SmartTag Examples

This section contains an example about how smart tag information is embedded in the document.

In the following example, two smart tags of the following types are embedded in the document:

  • Stockticker

  • Date

The following is the example for the shared data stored in the PropertyBagStore structure (section 2.3.4.1).

Offset

Size

Structure

Value

0000142A

00BA

PropertyBagStore - propBagStore

0000142A

0004

    ULONG - cFactoidType

0x00000002

0000142E

007F

    FactoidTypes - factoidTypes

0000142E

0043

        A: FactoidType - factoidType-0

00001471

003C

        B: FactoidType - factoidType-1

000014AD

0002

    USHORT - cbHdr

0x000C

000014AF

0002

    USHORT - sVer

0x0100

000014B1

0004

    ULONG - cfactoid

0x089A7948

000014B5

0004

    ULONG - cste

0x00000008

000014B9

002B

    C: IndexedStringTable - stringTable

Figure 36: PropertyBagStore structure

For simplicity this structure is broken down into substructures that are explained after the following descriptions.

propBagStore: Structure of type PropertyBagStore (section 2.3.4.1).

cFactoidType: 0x00000002 specifies the number of distinct smart tag types embedded in the document.

factoidTypes: Array of two FactoidType structures (section 2.3.4.2) as specified by the cFactoidType field.

cbHdr: 0x000C specifies the count of total bytes, including itself and the sVer, cfactoid, and cste fields.

sVer: 0x0100 specifies the version of this structure.

cfactoid: 0x089A7948 is an arbitrary and ignored value.

cste: 0x00000008 specifies the total number of entries in the stringTable.

The substructures identified by label A, B, and C in the preceding example are shown in the table labeled "FactoidType structure for Stockticker smart tag type", the table labeled "FactoidType structure for Date smart tag type", and the table labeled "IndexedStringTable structure", respectively.

Offset

Size

Structure

Value

0000142E

0043

A: FactoidType - factoidType-0

0000142E

0004

    ULONG - cbFactoid

0x0000003F

00001432

0004

    ULONG - id

0x00000001

00001436

002C

    PBString - rgbUri

00001436

15 bits

        USHORT - cch

0x002A

00001436

1 bit

        USHORT - fAnsiString

0x1

00001438

002A

        array of bytes - rgxch

urn:schemas-microsoft-com:office:smarttags

00001462

000D

    PBString - rgbTag

00001462

15 bits

        USHORT - cch

0x000B

00001462

1 bit

        USHORT - fAnsiString

0x1

00001464

000B

        array of bytes - rgxch

stockticker

0000146F

0002

    PBString - rgbDownLoadURL

0000146F

15 bits

        USHORT - cch

0x0000

0000146F

1 bit

        USHORT - fAnsiString

0x1

00001471

0000

        array of bytes - rgxch

Figure 37: FactoidType structure for Stockticker smart tag type

This is the first FactoidType structure (section 2.3.4.2) corresponding to the Stockticker smart tag type. For simplicity, detailed descriptions for the subfields cch and fAnsiString of rgbTag and rgbDownloadURL have been omitted.

cbFactoid: 0x0000003F specifies the size of this structure excluding the cbFactoid field.

id: 0x00000001 specifies the unique id (across this document) for this smart tag type.

rgbUri.cch: 0x002A specifies the number of characters in the string pointed to by rbgUri.rgxch.

rgbUri.fAnsiString: 0x1 specifies that the string pointed to by rgbUri.rgxch is an ANSI character set string.

rgbUri.rgxch: "urn:schemas-microsoft-com:office:smarttags" specifies the XML namespace URI for this smart tag type.

rgbTag.rgxch: "stockticker" specifies the tag name for this smart tag type.

rgbDownLoadURL.rgxch: This field is empty because there is no download URL specified for this particular smart tag type.

Offset

Size

Structure

Value

00001471

003C

B: FactoidType - factoidType-1

00001471

0004

    ULONG - cbFactoid

0x00000038

00001475

0004

    ULONG - id

0x00000002

00001479

002C

    PBString - rgbUri

00001479

15 bits

        USHORT - cch

0x002A

00001479

1 bit

        USHORT - fAnsiString

0x1

0000147B

002A

        array of bytes - rgxch

urn:schemas-microsoft-com:office:smarttags

000014A5

0006

    PBString - rgbTag

000014A5

15 bits

        USHORT - cch

0x0004

000014A5

1 bit

        USHORT - fAnsiString

0x1

000014A7

0004

        array of bytes - rgxch

date

000014AB

0002

    PBString - rgbDownLoadURL

000014AB

15 bits

        USHORT - cch

0x0000

000014AB

1 bit

        USHORT - fAnsiString

0x1

000014AD

0000

        array of bytes - rgxch

Figure 38: FactoidType structure for Date smart tag type

This is the second FactoidType structure (section 2.3.4.2) corresponding to the Date smart tag type. For simplicity, detailed descriptions for all the fields except id have been omitted.

id: 0x00000002 specifies the unique id (across this document) for the Date smart tag.

Offset

Size

Structure

Value

000014B9

002B

C: IndexedStringTable - stringTable

000014B9

0004

    PBString - stringTableEntry-0

000014B9

15 bits

        USHORT - cch

0x0002

000014B9

1 bit

        USHORT - fAnsiString

0x1

000014BB

0002

        array of bytes - rgxch

10

000014BD

0006

    PBString - stringTableEntry-1

000014BD

15 bits

        USHORT - cch

0x0004

000014BD

1 bit

        USHORT - fAnsiString

0x1

000014BF

0004

        array of bytes - rgxch

2003

000014C3

0004

    PBString - stringTableEntry-2

000014C3

15 bits

        USHORT - cch

0x0002

000014C3

1 bit

        USHORT - fAnsiString

0x1

000014C5

0002

        array of bytes - rgxch

21

000014C7

0005

    PBString - stringTableEntry-3

000014C7

15 bits

        USHORT - cch

0x0003

000014C7

1 bit

        USHORT - fAnsiString

0x1

000014C9

0003

        array of bytes - rgxch

Day

000014CC

0004

    PBString - stringTableEntry-4

000014CC

15 bits

        USHORT - cch

0x0002

000014CC

1 bit

        USHORT - fAnsiString

0x1

000014CE

0002

        array of bytes - rgxch

ls

000014D0

0007

    PBString - stringTableEntry-5

000014D0

15 bits

        USHORT - cch

0x0005

000014D0

1 bit

        USHORT - fAnsiString

0x1

000014D2

0005

        array of bytes - rgxch

Month

000014D7

0007

    PBString - stringTableEntry-6

000014D7

15 bits

        USHORT - cch

0x0005

000014D7

1 bit

        USHORT - fAnsiString

0x1

000014D9

0005

        array of bytes - rgxch

trans

000014DE

0006

    PBString - stringTableEntry-7

000014DE

15 bits

        USHORT - cch

0x0004

000014DE

1 bit

        USHORT - fAnsiString

0x1

000014E0

0004

        array of bytes - rgxch

Year

Figure 39: IndexedStringTable structure

This is an array of string table entries. For simplicity, only the detailed description for entries at indexes 1 and 7 are shown. These two entries are referred to by the Date smart tag’s PropertyBag structure (section 2.3.4.3) to form a key/value pair. The descriptions for the cch and fAnsiString subfields are also omitted.

stringTableEntry-1: String table entry at index 1.

stringTableEntry-1.rgxch: "2003" specifies this particular string entry.

stringTableEntry-7: String table entry at index 7.

stringTableEntry-7.rgxch: "Year" specifies this particular string entry.

The following example shows how data private to the individual smart tag is persisted. In this example, the smart tags for the following data items were embedded in the document:

  • 10/21/2003

  • MSFT

The first data item was recognized as a date by the Date smart tag, and the second data item was recognized as a stock symbol by the Stockticker smart tag.

Offset

Size

Structure

Value

000014E4

002C

PropertyBags - propBags

000014E4

0026

    PropertyBag - propertyBag-0

000014E4

0002

        USHORT - id

0x0002

000014E6

0002

        USHORT - cProp

0x0004

000014E8

0002

        USHORT - cbUnknown

0x0000

000014EA

0020

        Properties - properties

000014EA

0008

            Property - property-0

000014EA

0004

                ULONG - keyIndex

0x00000004

000014EE

0004

                ULONG - valueIndex

0x00000006

000014F2

0008

            Property - property-1

000014F2

0004

                ULONG - keyIndex

0x00000005

000014F6

0004

                ULONG - valueIndex

0x00000000

000014FA

0008

            Property - property-2

000014FA

0004

                ULONG - keyIndex

0x00000003

000014FE

0004

                ULONG - valueIndex

0x00000002

00001502

0008

            Property - property-3

00001502

0004

                ULONG - keyIndex

0x00000007

00001506

0004

                ULONG - valueIndex

0x00000001

0000150A

0006

    PropertyBag - propertyBag-1

0000150A

0002

        USHORT - id

0x0001

0000150C

0002

        USHORT - cProp

0x0000

0000150E

0002

        USHORT - cbUnknown

0x0000

00001510

0000

        Properties - properties

Figure 40: PropertyBag structures

For simplicity detailed descriptions for propertyBag-1.cProp and propertyBag-1.cbUnknown have been omitted.

propBags: An array of PropertyBag (section 2.3.4.3).

propertyBag-0: The first PropertyBag (section 2.3.4.3).

propertyBag-0.id: 0x0002 specifies the FactoidType (section 2.3.4.2) id. This value maps it to the Date smart tag type as shown in the factoidTypes.factoidType-1 field of PropertyBag (section 2.3.4.3).

propertyBag-0.cProp: 0x0004 specifies the number of properties stored as part of this smart tag.

propertyBag-0.cbUnknown: 0x0000 specifies that this field is ignored.

propertyBag-0.properties: An array of key/value pair indexes in the StringTable field as shown in the preceding example. For simplicity, only the entry at index 3 is shown.

propertyBag-0.properties.property-3: Key/value pair at index 3. The pair as shown evaluates to "Year"="2003".

propertyBag-0.properties.property-3.keyIndex: 0x00000007 specifies index in the stringTable field of PropertyBag (section 2.3.4.3). This maps to the string "Year".

propertyBag-0.properties.property-3.valueIndex: 0x00000001 specifies the index in the stringTable field of PropertyBag (section 2.3.4.3). This maps to the string "2003".

propertyBag-1: The second PropertyBag (section 2.3.4.3).

propertyBag-1.id: 0x0001 specifies the FactoidType (section 2.3.4.2) id. This value maps it to the Stockticker smart tag type as shown in the factoidTypes.factoidType-0 field of the PropertyBag (section 2.3.4.3).

propertyBag-1.properties: This smart tag does not have any properties.