Interstage Shunsaku Data Manager Application Development Guide - Microsoft(R) Windows(R) 2000/ Microsoft(R) Windows Server(TM) 2003 - - UNIX - |
Contents
Index
![]() ![]() |
Appendix L XML Conversion Function Mapping Rules | > L.1 Mapping Rule File Definition Format |
This tag specifies rules for converting column values in the XML documents to attributes.
<attributeRule id="attribute value" { colname="attribute value"| colno="attribute value" } attrname="attribute value" attrof="attribute value" null="attribute value" handler="attribute value" handler-arg="attribute value" /> |
Note: Specify either the colname attribute or the colno attribute.
Attribute name |
Description |
Required item? |
---|---|---|
id |
Specifies the mapping rule identifier (*1). |
Required |
colname |
Specifies the name of the column in the results table that is to be extracted as the element of the attributeRule tag. |
Conditional |
colno |
Specifies the number of the column in the results table that is to be extracted as the element of the attributeRule tag. |
Conditional |
attrname |
Specifies the attribute name for the attributeRule tag. If the value of this attribute is not specified, the column name in the results table will be set as the attribute value(*2). |
Required |
attrof |
Specifies the mapping rule identifier for the column rule specified in the attributeRule tag. |
Required |
null |
Specifies the format used to output the attribute if the column value is null.
If this attribute is not specified, the default value is "empty". |
Optional |
handler |
If the data stored in the column of the results table is binary data, it will be converted to the appropriate character code and output as XML documents. |
Optional |
handler-arg |
This attribute is enabled when "BINARYDATA" is specified in the 'handler' attribute. It specifies the character code for the data stored in the column of the results table, and the type of data that will be converted from binary to this code.
If this attribute is not specified, the default values are "TEXT" for the data type and "UTF-8" for the character code. |
Optional |
*1) 'Mapping rule identifiers' are used to identify mapping rules. Each identifier must be unique within a mapping rule file.
*2) When converting from a CSV file, the CSVSource class setFirstRecordToColumn() method can be used to handle the data in the first row as column names.
*3) The entity references that can be used with the XML conversion function are as follows:
Entity references |
Symbol represented |
---|---|
< |
< |
> |
> |
& |
& |
' |
' |
" |
" |
None
Example:
In the following example, an error will occur because the attributeRule tags use both colname and colno attributes in the same mapping rule file.
<attributeRule id="a1" colname="B" attrname="NUM" attrof="c1" /> <attributeRule id="a2" colno="3" attrname="NAME" attrof="c1" />
Example:
In the following example, an error will occur because both the colname and colno attributes are used in the same mapping rule file.
<columnRule id="c1" colname="A" tagname="NAME" parent="p1" /> <attributeRule id="a1" colno="2" attrname="NUM" attrof="c1" /> <attributeRule id="a2" colno="3" attrname="NAME" attrof="c1" />
Example:
In the following example, an error will occur because the same attribute name is specified for two different attributeRule tags.
<columnRule id="c1" colname="B" tagname="NAME" parent="p1" /> <attributeRule id="a1" colname="A" attrname="foo" attrof="c1" /> <attributeRule id="a2" colname="C" attrname="foo" attrof="c1" />
Contents
Index
![]() ![]() |