Freigeben über


Adding Contact Data to the Contacts Data File

  Microsoft Speech Technologies Homepage

This document describes the structure of the XML elements that contain information for a contact, and provides instructions for adding information for a new contact to the contacts data file that the Contacts application uses.

Element Structure for a Contact

The Contacts reference application included in the Microsoft Speech Application SDK Version 1.1 (SASDK) uses contact data stored in an XML file labeled FakeContacts.xml. Each discrete piece of data about a contact is contained in a single XML element. All of the XML elements that contain data pertaining to a single contact are contained within a single <contact> element. The following code block is copied from the FakeContacts.xml file. It illustrates the structure of an entry for a single contact.

<Contact>
    <ID>34</ID>
    <DateAdded>2002-01-01</DateAdded>
    <FirstName>Barry</FirstName>
    <LastName>Potter</LastName>
    <EmailAddress>barry@contoso.com</EmailAddress>
    <SMSAddress>5550139@thephone-company.com</SMSAddress>
    <WorkPhone>555-0136</WorkPhone>
    <HomePhone>555-0137</HomePhone>
    <CellPhone>555-0138</CellPhone>
    <Information>
        <OfficeNumber>28</OfficeNumber>
        <PostalAddress>111213 Main St, Buffalo, NY 98052</PostalAddress>
    </Information>
    <RecognitionAlternates>
        <Alternate>Barry Potter</Alternate>
    </RecognitionAlternates>
</Contact>

To add data for a new contact

  1. Open the FakeContacts.xml file in a file editor.
  2. Scroll to the end of the file. Select and copy the Contact element for the contact with ID number 34. Include the opening and the closing Contact elements (<Contact> and </Contact>) in the selection.
  3. Paste the copied code immediately following the closing Contact element for the contact with ID number 34.
  4. In the newly pasted code block, change:
  1. The number contained in the ID element from 34 to 35. This number serves as the key identifier for the database.
  2. The date contained in the DateAdded element to the current date, using the form: YYYY-MM-DD. The Contact Helper application uses this information to generate recording scripts.
  3. The first name of the contact contained in the FirstName element. The prompt engine requires this information.
  4. The last name of the contact contained in the LastName element. The prompt engine requires this information.
  5. The full name contained in the Alternate element from Barry Potter to the full name of the new contact. The Contact Helper application uses this information to generate the names grammar.
  6. All other contact data as appropriate.
  1. Repeat steps 2 through 4 for each additional contact, incrementing the contact ID number for each new contact by 1 (in other words, the next contact should be numbered, 35, then 36, 37, 38…).
  2. Ensure that all newly added Contact elements at minimum contain a unique identification number in the ID element, a properly formatted date in the DateAdded element, a first name in the FirstName element, a last name in the LastName element, and the full contact name in the Alternate element.
  3. Save the FakeContacts.xml file.
  4. Run the Contacts Helper application to rebuild the name grammar to include the newly added names.

Remarks

Contacts Helper reads the data in the FakeContacts.xml file and generates the RealNames.grxml grammar file located at:

C:\Program Files\Microsoft Speech Application SDK 1.1\Applications\Contacts\Grammars\Static\RealNames.grxml.