XML: Write To XML File Adapter.

A Write To XML File adapter writes received rows to an XML file. If the file already exists, the adapter overwrites it.

Property Name (screen)

Property Name (Attach Adapter)

Type

Description

Filename

Filename

String

The name and path of the XML file to write data to. You may specify a file name and path either by typing it in or by clicking on the Browse button for this field. By default, the path is relative to the server's Base Folder and must be underneath that base folder, but you can use $ProjectFolder to specify a path relative to the current project folder. For more information, see Setting The Base Folder For File Input/Output Adapters. For more information about the Browse and Edit buttons, see the discussion that follows this table.

Maximum Size in bytes

MaximumSize

Integer Min: 1

The maximum size of the output file. If this property is set, the adapter starts writing a new file every time the size of the current output file becomes greater than this property. The files are named <filename>, <filename>.001, <filename>.002, ... where <filename> is the value of the Filename property. If the property is not set, output is written to a single file that can grow as large as the available space.

Append To Existing File

Append

Boolean

This parameter affects how the adapter behaves when the adapter re-starts.

If "Append To Existing File" is set to false, then when the adapter is started, the adapter moves any existing file named <Filename> to <Filename>.### and starts a new file named <Filename>.

If a maximum size is specified and "Append To Existing File" is set to true, then when the adapter is started, the adapter appends to any existing file named <Filename> rather than immediately renaming the existing file.

Set timestamp to current time

UseCurrentTimestamp

Boolean

If set to true, the adapter overrides the timestamp specified in the row with the current system time. Defaults to false.

Formatted

Formatted

Boolean

If the flag is set to true, then the output XML will be indented and will include end-of-line characters. If the flag is set to false, then the output XML will not be indented.

Include Column Names

Extended

Boolean

If the flag is set to true, then field names will be included within each output message. If the flag is set to false, then field names will not be included within each output message.

For more information about the format of the data written to the XML file, see the description of the file format in the section about the "Read From XML File" adapter XML: Read From XML File. Note that when Sybase CEP Server writes INTERVAL values in XML format, the values are always written as a 64-bit signed integer representing a number of microseconds.

The Adapter Properties screen in Sybase CEP Studio allows you to specify an input path and file name for the file by clicking the Browse button and identifying the file. The path is relative to the adapters base folder, either as specified for Sybase CEP Server running on the same computer as Sybase CEP Studio, or as specified in the preferences for Sybase CEP Studio. For more information, see Setting The Base Folder For File Input/Output Adapters. In order for this feature to work properly, make sure that the Adapter's Base Folder field in Sybase CEP Studio Settings is set to the same folder as the adapters base folder for Sybase CEP Server. The Base Folder setting for the Sybase CEP Server is specified during the installation process, and can also be changed in the Sybase CEP Server's c8-server.conf file. The base folder setting for Sybase CEP Studio can be set from the Tools->Settings command on the Sybase CEP Studio menu.

The Edit button brings up an editor that will allow you to view any file whose name you enter into the filename field. If the file's extension is "csv" or "xml", Sybase CEP Studio opens the appropriate editor specified in the "External Tools" tab available from the menu item "Tools -> Settings". For files with other extensions, on Microsoft Windows the editor is the one specified by the operating system's file associations, and on UNIX-like operating systems, Sybase CEP Studio opens the editor specified by the EDITOR environment variable.

Note:

When you click the Edit button, Sybase CEP Studio looks for the file in the SybaseC8Repository, even if the adapters base folder is set to another location. You may need to use the Browse button (adjacent to the Edit button) to navigate to the desired directory before you try to open the file.