Submits the contents of an XML file to the application database.
命名空間: Microsoft.SqlServer.NotificationServices
組件: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)
語法
'宣告
Public Function LoadXml ( _
eventDoc As String _
) As Integer
public int LoadXml (
string eventDoc
)
public:
int LoadXml (
String^ eventDoc
)
public int LoadXml (
String eventDoc
)
public function LoadXml (
eventDoc : String
) : int
參數
- eventDoc
A string representing the path and name of the XML file that contains the event data to be loaded. This parameter cannot be null.
傳回值
An integer specifying how many events have been submitted in this LoadXml call.
範例
The following examples show how to use the LoadXml method to submit event data from an XML file to the application database:
Dim instanceName As String = "MyInstanceName"
Dim applicationName As String = "MyApplicationName"
Dim eventClassName As String = "MyEventClassName"
Dim eventProviderName As String = "MyEventProviderName"
Dim eventSchema As String = "MySchemaFilePathAndName"
Dim myXmlFile As String = "MyXMLFilePathAndName"
'Create an NSInstance object.
Dim myInstance As New NSInstance(instanceName)
'Create an NSApplication object.
Dim myApplication As New NSApplication(myInstance, applicationName)
'Create an EventLoader object.
Dim myEventLoader As New EventLoader(myApplication, _
eventProviderName, eventClassName, eventSchema)
'Use the LoadXml method to load an XML document.
Dim eventsWritten As Integer = myEventLoader.LoadXml(myXmlFile)
string instanceName = "MyInstanceName";
string applicationName = "MyApplicationName";
string eventClassName = "MyEventClassName";
string eventProviderName = "MyEventProviderName";
string eventSchema = "MySchemaFilePathAndName";
string myXmlFile = "MyXMLFilePathAndName";
//Create an NSInstance object.
NSInstance myInstance = new NSInstance(instanceName);
//Create an NSApplication object.
NSApplication myApplication =
new NSApplication(myInstance, applicationName);
//Create an EventLoader object.
EventLoader myEventLoader =
new EventLoader(myApplication, eventProviderName,
eventClassName, eventSchema);
//Use the LoadXml method to load an XML document.
int eventsWritten = myEventLoader.LoadXml(myXmlFile);
執行緒安全性
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
平台
開發平台
如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。
目標平台
如需受支援的平台清單,請參閱<安裝 SQL Server 2005 的硬體和軟體需求>。
請參閱
參考
EventLoader Class
EventLoader Members
Microsoft.SqlServer.NotificationServices Namespace