XML Command [XML]. Robelle Suprtool 5.7
Реклама
Реклама
XML Command [XML]
Use XML to produce XML Documents for either Internet or Intranet applications.
XML
VERSION |2"string"|
DOCTYPE |2"string" &| filename|
FILE |2"string"|
RECORD |2"string"|
Example
STExport can generate "well-formed" XML output with just a few commands.
$input file1sd
$xml
$output myxml
$xeq
These four simple commands will generate the following file that packages such as
XMLSpy will consider to be "well-formed" XML. The result of such an STExport task will look as follows:
<?xml version='1.0'?>
<file>
<record>
<CITY>Los Altos</CITY>
<CREDIT-RATING>100000</CREDIT-RATING>
<CUST-ACCOUNT>4003302</CUST-ACCOUNT>
<CUST-STATUS>20</CUST-STATUS>
<NAME-FIRST>Ralph</NAME-FIRST>
<NAME-LAST>Perkins</NAME-LAST>
<STATE-CODE>CA</STATE-CODE>
<STREET-ADDRESS>Room 655</STREET-ADDRESS>
<STREET-ADDRESS>Los Altos 040033022</STREET-ADDRESS>
<ZIP-CODE>93002</ZIP-CODE>
</record>
</file>
Notes
By default STExport will add the simplest version tag at thebeginning of the file, then it inserts a <file> and matching </file> at the beginning and the end of the file.
Then STExport encloses each record from the input file in a <record> and </record> tag. Finally, the Self-Describing tags are added around each field's data values and edited appropriately.
Naturally users would want options to customize and specify the various options and tags themselves, in order to generate a file that is acceptable to their tools.
Version
You can specify the "version" tag at the beginning of the XML file with the following command:
xml version "?xml version='1.0' encoding='ISO-8859-1'?"
STExport will put the "<" and ">" around what is specified in the version string.
Suprtool 5.7 for MPE
STExport Commands • 339
340 • STExport Commands
Doctype
A Document Type Declaration can be made at the beginning of the file via the
!DOCTYPE specification. This typically tells whatever tool that is parsing the xml file where the DTD for the file resides.
In STExport you can specify simple one-line doctype specs with the following command:
xml doctype '!DOCTYPE address-book SYSTEM "address-book.dtd"'
This will write the doctype specification at the top of the output file, directly after the
XML version specification.
More complicated and lengthy doctype specifications can be implemented by using the filename option, whereby STExport will append the contents of a named file directly after the version specification. The syntax can be simply:
xml doctype myfile.xml
File
You can customize the "file" tags with the following command commands:
xml file "orders"
STExport will put the "<" and ">" around what is specified in the File string.
Record
You can customize the "record" tags with the following command commands:
xml record "Details"
STExport will put the "<" and ">" around what is specified in the Record string.
Example
You can enter multiple XML commands per task to set the XML options you require.
$in file1sd
$xml version "?xml version='1.0' encoding='ISO-8859-1'?"
$xml file "Orders" record "Details"
$out myfile
An example of the output generated by the above commands is as follows:
Suprtool 5.7 for MPE
<?xml version='1.0' encoding='ISO-8859-1'?>
<Orders>
<Details>
<CITY>Los Altos</CITY>
<CREDIT-RATING>100000</CREDIT-RATING>
<CUST-ACCOUNT>4003302</CUST-ACCOUNT>
<CUST-STATUS>20</CUST-STATUS>
<NAME-FIRST>Ralph</NAME-FIRST>
<NAME-LAST>Perkins</NAME-LAST>
<STATE-CODE>CA</STATE-CODE>
<STREET-ADDRESS>Room 655</STREET-ADDRESS>
<STREET-ADDRESS>Los Altos 040033022</STREET-ADDRESS>
<ZIP-CODE>93002</ZIP-CODE>
</Details>
</Orders>
Tags
In XML the tags that surrounded the data can not have any special characters other than hyphen, underscore and period ("-","_", "."). So STExport replaces any of the invalid special characters with a "." by default.
You can change the default character to be something else with the following set command:
$Set xmltagchar "_"
STExport will only allow the hyphen, underscore and period to be set with this command.
Quotes
All of STExport's XML command options (version, doctype, file and record) allow for a string to be passed via surrounding quotes. The quotes may be either single or double, but keep in mind that if the string is to contain double quotes, then you should surround the entire string with single quotes.
Suprtool 5.7 for MPE
STExport Commands • 341
Скачать
Реклама