Show TOC

XPathXmlStringWriter PropertiesLocate this document in the navigation structure

The XPathXmlWriter component uses an XPath-style syntax to format XML documents from published Event Stream Processor stream data.

The formatter formats XML tags and attributes. To use this writer, ensure the sink specifies this property:

DOStringWriter = com.sybase.esp.adapter.xml.xpath.XmlStringWriter

Specify nested tags by separating the tag names by / :

/env/body/tag
<env>
<body>
<tag>xyz</tag>
</body>
</env>

Attributes are specified by [@attributeName].

/env/body/tag[@attr]
<env>
<body>
<tag attr=’xyz’/>
</body>
</env>

By default, the formatter creates collections. For example, a new nested tag is created for each occurrence of a tag name:

XPath1=/env/body/tag
XPath2=/env/body/tag
<env>
<body>
<tag>xyz</tag>
</body>
<body>
<tag>abc</tag>
</body>
</env>

If tags are added within a nesting, use an index operator to specify the position in the collection:

XPath1=/env/body[1]/tag
XPath2=/env/body[1]/tag
<env>
<body>
<tag>xyz</tag>
<tag>abc</tag>
</body>
</env>

XML content encoding for this component is iso-8859-1.

Property Description
Type++ (Required) Name of the Event Stream Processor stream to be exported.
.XPath (Required) The XPath–style description of the top-level tags for this table.
/env/body
<env/>
<body/>
.AttName++ (Required) Name of a field within the Type (stream).
.XPath (Required) The XPath–style description of the XML tag or attribute to be formatted. Typen is the table name and AttNamen is the field name specifying the source of the data to insert into the tag or attribute.

If the description specifies a tag, the field is output as tag data:

/env/body/tag
<env>
<body>
<tag>field data from Typen.AttNamex</tag>
</body>
</env>

If the description specifies an attribute, the attribute value is set to the field data:

/env/body/tag[@attr]
<env>
<body>
<tag attr= field data from Typen.AttNamex />
</body>
</env>