DtoXml - D-file to Xml portion

[ English | Japanese ]

[visit D-home]

SYNOPSIS

DtoXml [ options ] [ input-file.. ]

DESCRIPTION

DtoXml converts D-records in the input-files into an XML portion. Usually, output XML file is fed to other XML program to form a total application system.

A D-field is converted to an XML element having only character data. The field name becomes the element name, and the field value becomes the character data. A D-record is converted to an XML element containing only elements converted from the D-fields of the record. The element name is <record> by default, which you can change by the -r option.

An input file is enclosed as <file> element. Whole input files are enclosed as <root> element. These element names can be changed by the -f and -o option.

A D-field of which name start with COMMERCIAL AT (@) is converted to an attribute. The attribute is placed in the element of the preceding D-field, or in the record element when no preceding D-field exists.

When a D-field value is converted to the character data of an element, characters not allowed in XML character data (e.g. <) are converted to the predefined entities (e.g. &lt;). But, when the D-field value is already coded as XML character data, you can escape this conversion by listing the field names in the -n option.

Output file has no indention. Start-tag, character data and end-tag are concatenated and form one line. Start-tag or end-tag for the root, file and record forms one line by itself. After the end-tag for the record and file, one null line is inserted.

OPTIONS

-o root-node-name
Element name for the root element. The default is "root".
-f file-node-name
Element name for the file element. The default is "file".
-r record-node-name
Element name for the record element. The default is "record".
-n field-list
The values in the listed field become the character data of the element as they are. It is the user's responsibility to ensure the XML validity.
-D [i/o]datautf=8|16|32
UTF I/O feature (see manual page of UTF I/O feature.)

EXAMPLES

This is an example to show basic function of DtoXml. Input D-file is as follows:

@attr1:1
a:text-a
@attr2:2
b:text-b

DtoXml without any option produces next output.

<root>
<file>
<record attr1="1">
<a attr2="2">text-a</a>
<b>text-b</b>
</record>

</file>

</root>

Next example is to show -n option. Input file is:

a:text-a <c>text-ac</c>
b:text-b <c>text-bc</c>

DtoXml -n a will produce:

<root>
<file>
<record>
<a>text-a <c>text-ac</c></a>
<b>text-b &lt;c&gt;text-bc&lt;/c&gt;</b>
</record>

</file>

</root>

ENVIRONMENT

Ddatautf, Didatautf, Dodatautf
for UTF I/O feature.

DIAGNOSTICS

See the manual of D_msg.

SEE ALSO

Dintro, DfromXml, DtoTex, DtoCsv, D_msg.

AUTHOR

MIYAZAWA Akira


miyazawa@nii.ac.jp
2006