WorldClass Creating an Extension with XML. XML is a Language.
This utilizes an Open Source “Language Driver” technology that is published as a part of XMLFoundation.
The “ObjectsFromXML” example application is part of the XMLFoundation source download. In the example application, XML data is transformed into business objects ready to be used by an application developer. The purpose of the sample is to show how an application developer can use XML. The source of the XML is irrelevant, it can come from anywhere so two sample sources are shown to create the same application data – one source from a disk file, and another from a dynamic document rendering system – UBT’s TransactXML Server
The complete source and makefiles are located in the Examples/c++/ObjectsFromXML directory.
The purpose of this document is to show how to setup UBT’s TransactXML Server version 5.2 to generate the dynamic XML that works with the sample application.. Refer to the notes in the sample source code to see how to switch from one XML data source to another.
The first step to creating a document is understanding where to get the information that must be included in the document. That information is located within your business or organization. It may be hand entered, but generally it comes from the DBMS (DataBase Management System) directly, or from an existing Application that has applied business rules to the information in the DBMS . Information may also come directly from a hardware device interface.
For this reason, TransactXML server crosses a binary layer (often called a driver) to go get the actual information. The specifications for which are public so if you have a proprietary information source can build you own. While we have drivers for many different sources this example will focus on the simplest and most common source of information, this is the DBMS. Any DBMS will do, but for the example we need to choose one, so I picked one that ships as a sample database on both SQL Server and Microsoft Access, the Northwind database so you can use either DBMS . If you use Oracle you can use the sample SCOTT database or DB2 use the sample ADMINISTRATOR, but you’ll need to simplify the results to a list of Employees.
The query will join 3 tables to retrieve the information.
Visually it looks like this:
In Native SQL syntax it looks like this:
SELECT Customers.CustomerID, Customers.ContactName, Customers.City, Customers.Country,
Orders.OrderID,Orders.OrderDate, Orders.ShippedDate, [Order Details].ProductID, [Order Details].UnitPrice
FROM (Customers INNER JOIN Orders ON Customers.CustomerID = Orders.CustomerID)
INNER JOIN [Order Details] ON Orders.OrderID =
ORDER BY Customers.CustomerID,Orders.OrderID
and as data it looks like this:
Once the SQL to generate the data has been created, we need to define the markup in DesignerXML.
In DesignerXML:, File/new
Change the default from “SQL stored procedure” to “SQL Select statement”
Then press finish to this:
Then double click “CustomerID” in the XML document so that it’s properties may be set like this:
Press OK, then add “ContactName”, “City”, and “Country” and “OrderID” to the XML document like this:
Double click ProductID and change it’s name to LineItem and set it to be repeatable on each occurance of ProductID, then add “ProductID” and “Unit Price” to “LineItem” so that the document looks like this:
Save the script. You just programmed TransactXML server to render a moderately complex XML Document. This document uses no external modifiers, but every element has the option “Custom Extension” that allows you to manipulate the document values, apply business logic, or graft in new branches of XML from C/C++ Library , Java class, Perl, Python, COM, CORBA, or even Custom Implementation extensions that you develop.