The XPathXmlStreamReader component handles XML documents using XPath properties. Select XPathXmlStreamReader as the parsing method to get sources to populate a number of tables.
DOStringReader=com.sybase.esp.adapter.xml.xpath.XPathXmlStreamReader
Specify a base stream that Event Stream Processor updates based on data from the source. Also, define the fields within each source record by specifying the name and datatype for each field.
You can populate fields with data from an XML document by specifying tag data or attribute values. Specify nested tags by using a forward slash (/) to separate the tag names:
XPath=/env/body/tag <env> <body> <tag> xyz </tag> </body> </env>
Attributes are specified by [@attributeName].
XPath=/env/body/tag[@attr] <env> <body> <tag attr= abc /> </body> </env>
The XPathXmlStreamReader handles collections.
XPath=/env/body/tag <env> <body> <tag> xyz </tag> <tag> abc </tag> </body> </env>
By default, the command above inserts both values into the field, separated by the collection separator character: xyz|abc.
XPath=/env/body/tag[2] <env> <body> <tag> xyz </tag> <tag> abc </tag> </body> </env>
Property | Description |
---|---|
XmlRoot | (Required) Enter the root node of the XML document.
For example:env |
SecondDateFormat | (Optional) If you create fields with a datetime
datatype, you can type the default format that the adapter
understands when reading data for that field. Unless overridden by the field's Format property, the adapter rejects any data that is not in this format. If you do not enter a value, the adapter only understands datetime values with the format yyyyMMdd or yyyyMMdd HH:mm:ss for the field. It rejects any other datetime data. |
Type++ | (Required) Name of the base streams that Event Stream Processor updates based on the data in the source. |
XPath | (Required) Enter an XPath-style expression for the
root node of the table. For
example:/env |
.AttName++ | (Required) Names of the table fields that Event Stream Processor updates based on the data in the source. This property is case-sensitive. Specify a name for each record field in the target Event Stream Processor base stream. |
.XPath | (Required) Enter an XPath-style expression for the
data to be inserted into this field. If the expression begins
with "/", it is taken as a full path. Otherwise, it is relative
to the Typen.XPath property.
For
example:tag /env/body/tag |
.DefaultValue | (Optional) If the field is empty, for example, it is an empty tag or the tag is not present in the XML document, this value is substituted. |
.Format | (Dependent optional) If you created a field with a datetime datatype, you may type the format that the adapter understands when reading data for that field. The adapter rejects any data that is not in this format. If you do not enter a value, the adapter understands datetime values only with the format yyyyMMdd, yyyyMMdd HH:mm:ss for the field, or with the default value from the SecondDateFormat property. It rejects any other datetime data. |
.Match | (Optional) If necessary, type a regular expression
match for the adapter to perform on the record. AttNamex is the
field name as defined in the AttName property. If the regular expression is
matched in the field data, the string defined in
AttNamex.MatchReplace is substituted. For
example:.*char_is_(.).* |
.MatchReplace | (Dependent optional) Type the replacement value for the .Match property that the adapter may use when the corresponding regular expression match is successful. |
.AttType | (Default required) Type the datatype for the field.
AttNamex is the field name
as defined in the AttName
property. Event Stream Processor supports these datatypes:
|
.UTCTimeZone | (Dependent optional) If you created a field with a
datetime datatype, you may type the time zone for the field. The
adapter converts and normalizes the corresponding datetime value
from its originating time zone value to an equivalent UTC value.
The UTC value is then passed to Event Stream Processor for storage. You may type any time zone that Java recognizes (for example, Europe/London or America/New_York). If no value is set, the datetime value passes through as local time to Event Stream Processor for storage. |
BadRecordLoggerName | (Optional) The name of the logger responsible for
writing bad records. The behavior depends on implementation. If the name is provided, also provide the
implementation class. If this property is left blank, the
adapter warns only about bad records but the original
message is lost.
<BadRecordLoggerName>.ClassName - Logger implementation |