 |
XML for Data Exchange |
 |
The need to generate XML data from a variety of data sources is
becoming increasingly important to a wide variety of data processing
environments. Interoperability and data exchange between mainframe systems
and other systems running on a variety of hardware and software platforms
is essential.
XML—EXtensible Markup Language—is a way to generically describe data to
facilitate interchange of data between applications. Our support for XML
output is important for organizations that have the need to exchange
mainframe data with applications/products running on different platforms
or written in different languages.
With UltraQuest Reporter, users can generate output as XML documents.
Within Reporter, the user can choose the new output type of XML and then
generate the XML output based on the CREATE XML command of NOMAD version
7.50. By default, UltraQuest Reporter will generate hierarchical XML
output for importing into those products or applications that understand
one-to-many relationships. Simple or flat XML documents can also be
created for SQL, row-oriented DBMS products such as SQL Server or Oracle.
An XML Schema can also be generated for those products that require more
information about the structure and content of the XML data file being
imported. The older version of the XML structured definition file or DTD
(Document Type Definition) can be generated but will be included as part
of the XML data file itself.
With UltraQuest Applications, developers can use the CREATE XML command to
generate the types of XML documents discussed above.
The CREATE XML feature allows creation of valid XML documents in XML
formats specified by the developer using mainframe data described by a 4GL
schema. The XML output can be retained on the mainframe or transmitted to
other platforms, where it can be used directly by a client process or
transformed to a format usable by other systems. CREATE XML produces
well-defined, self-contained, and understandable XML output that can be
used by Java, Visual Basic, and other XML-enabled processes.
CREATE XML is a robust facility that combines XML support with the
powerful data retrieval and data manipulation capabilities of the CREATE
command. It is a marriage of full support of XML with CREATE
functionality.
 |
|
 |
| |
| |
CREATE XML
benefits from existing capabilities: |
 |
 |
 |
It allows generation of XML
output using data sources described by 4GL schemas, and lets
the user easily reference data from multiple data sources
through a single schema. |
 |
 |
 |
It leverages the full
functionality of the CREATE command to retrieve, sort,
summarize, join, and manipulate data. |
 |
 |
 |
It lets the user define dynamic
calculations (virtual columns) based upon database data. |
 |
 |
 |
It translates hierarchical and
relational data into the specified format, in this case, XML. |
 |
 |
 |
It takes advantage of the
CREATE command's ability to dynamically generate hierarchical
XML documents (output). |
 |
 |
| |
Additional features
specific to XML are provided with CREATE XML: |
 |
 |
 |
A wide range of XML structures,
such as elements, attributes, tag names, XML Schema, and DTD
can be generated. |
 |
 |
 |
XML attributes, like tag names,
can be permanently defined for a given database or can be
dynamically defined as needed for various XML applications.
|
 |
 |
 |
CREATE infers a default XML
structure based upon the context of the request with tags that
can be easily overridden by the user. Data collected by the
4GL is mapped into an XML hierarchical document structure.
|
 |
 |
 |
Complex XML element types can
easily be represented within a CREATE request. |
 |
 |
 |
CREATE’s default behavior can
be overridden through system variables designed for XML use. |
|
|
 |
|
 |
Generating XML data can be as simple as adding the XML keyword to an
existing CREATE request. In cases where XML data must be produced to meet
specific application needs, CREATE XML allows generation of a variety of
complex XML structures.
Let’s look at this simple example of a CREATE XML request, which generates
total income for each video store:
 |
|
 |
| |
create xml by storename sum(income); |
|
 |
|
 |
This is the XML document file that is generated:
 |
|
 |
| |
<?xml
version="1.0"?>
<root>
<node>
<storeName>VIDEOHEAVEN</storeName>
<incomeAmount>119152.63</incomeAmount>
</node>
<node>
<storeName>VIDEO MADNESS</storeName>
<incomeAmount>50300.24</incomeAmount>
</node>
<node>
<storeName>VIDEO MAGIC</storeName>
<incomeAmount>725580.55</incomeAmount>
</node>
</root> |
|
 |
|
 |
The file includes default XML tags, like <node>, that indicate data
structure, as well as custom XML tags, like <StoreName>, provided through
the database metadata (schema).
Flat and Hierarchical XML
Generally, the CREATE XML command produces XML documents structured in
one of two ways—flat and hierarchical. The following sections show simple
examples of each type of document. The following examples show some simple
XML document files produced by CREATE to show the difference between flat
and hierarchical XML data.In some cases, an XML document may be a
combination of hierarchical and flat structures.
A Flat XML Document
A flat XML document is very simplistic and is comparable to an external
flat file, such as a QSAM file. It has a very simple XML structure. <row>
tags enclose each data record. A flat XML document is geared for data
import into products like spreadsheets or SQL tables, which do not have
hierarchical structure. Flat XML documents are generic and suitable for
use in a variety of products without the need to provide specific metadata
to accompany the file.
This is an example of a flat XML document generated by CREATE XML. It
shows video stores by state locations New Jersey and New York. Notice how
the state value NY is repeated for each store within New York:
 |
|
 |
| |
<?xml
version="1.0"?>
<root>
<row>
<state>NJ</state>
<storeName>VideoHeaven</storeName>
</row>
<row>
<state>NY</state>
<storeName>VideoMagic</storeName>
</row>
<row>
<state>NY</state>
<storeName>Video Madness</storeName>
</row>
<row>
<state>NY</state>
<storeName>Video Rentals</storeName>
</row>
</root> |
|
 |
|
 |
A Hierarchical XML Document
By default CREATE XML produces a hierarchical XML document file. The
intent of hierarchical XML is to preserve the data relationships produced
by the CREATE request. A sort key represents a parent value, and the
objects being sorted represent children of the parent key. A <node> tag
indicates a break in the hierarchical structure. <node> tags are generated
for sort breaks caused by BY items (sort keys) used in the request. Each
set of records within a sort break is enclosed by an opening <node> tag
and a closing </node> tag. Also, immediately after each sort value, <node>
tags enclose each separate child record associated that sort value.
This is an example of a hierarchical XML document generated by CREATE XML.
As in the flat example above, it shows video stores by state locations New
Jersey and New York. In contrast to flat XML, sort values for the key
State are not repeated for each store. The state value NY appears once for
all stores within New York, and the <state> element is the parent of the <storeName>
elements:
 |
|
 |
| |
<?xml
version="1.0"?>
<root>
<node>
<state>NJ</state>
<node>
<storeName>Video Heaven</storeName>
</node>
</node>
<node>
<state>NY</state>
<node>
<storeName>Video Magic</storeName>
</node>
<node>
<storeName>VideoMadness</storeName>
</node>
<node>
<storeName>VideoRentals</storeName>
</node>
</node>
</root> |
|
 |
|
 |
 |
Learn More |
 |
To find out more about how Select Business Solutions can help you
either Contact Us, or visit our
Product Resources area for all the latest related downloads.
 |
|
 |
| |
| Resources |
 |
| Want to learn more about this
solution? All major downloads relating to a particular product
or solution can
now be accessed in one location.
Click here
to continue |
 |
       |
|
|
 |
|
 |
|
 |
|
|
 |
|