Jaa


File Validation

The file system watcher event provider validates each file added to the watched directory before submitting data to the application. Files that are added to the monitored directory must be XML. If a non-XML file is added to the monitored directory, it is ignored.

When you define this event provider, you provide the path to a Transact-SQL annotated XML schema (XSD) file. This file specifies the mapping between the XML file and the event class fields. If a dropped XML file does not map to the specified XSD file, the event provider logs an error to the event log and then renames the file so that the event provider does not pick up the file again.

Example: Transact-SQL Annotated XML Schema File

The following schema defines the structure for the StockEvents event class.

You must provide the sql:relation annotation for the event element. Its value is modified at run time to be the name of the event table associated with the specified event class:

<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:sql="urn:schemas-microsoft-com:mapping-schema">
    <xsd:element name="event" sql:relation="StockEvents">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="StockSymbol" type="xsd:string" />
                <xsd:element name="StockPrice" type="xsd:float" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>
</xsd:schema>

For more information about creating a Transact-SQL annotated XML schema file, see SQLXML and XML Mapping Technologies, in the Microsoft MSDN Library.

See Also

Concepts

File Pickup and Retry Logic
Defining a File System Watcher Event Provider

Other Resources

File System Watcher Event Provider
Standard Event Providers
Defining Event Providers

Help and Information

Getting SQL Server 2005 Assistance