XML and Object-Oriented Languages

 <  Day Day Up  >  

XML works hand-in-hand with object-oriented languages to provide what I have termed portable information. Often, an application written in a language such as Java or C# is developed to interact with XML. For example, let's revisit the example earlier in the chapter. Alpha Company, a department store, uses an Oracle database, and Beta Company, a vacuum machine manufacturer, uses a SQL Server database. Alpha Company wants to purchase some vacuum cleaners from Beta Company for its inventory. All transactions will be handled electronically over the Internet.

To make a long story short, the problem is that the data is stored in two totally different databases. Even if the databases were the same, the formats of the records in the database would most likely be designed differently. Thus, the goal is to share data between Alpha Co. and Beta Co., which means sharing the data between their databases.

Proprietary Solutions

We could of course create a proprietary application for connectivity between the Alpha and Beta Companies. Although this would work for this one application, it is preferable to have a more general solution (as is the object-oriented way). For example, Alpha Company might be in the market position to require that all suppliers conform to its specification. This is where XML shines. Alpha Company can create an XML specification to which all its suppliers can connect.


To accomplish the goal of connecting the systems of the two companies, Alpha Company can come up with an XML specification describing what information is needed to complete a transaction and store the information in its database. Here is where the object-oriented languages come in. A language such as Java can be used to extract the data from Alpha Company's SQL Server database and create an XML document based on the agreed-upon standards. This XML document can then be sent over the Internet to Beta Company, which uses the agreed-upon XML standard to extract the information in the XML document and enters it into its Oracle database. Figure 12.2 represents the flow of data from one database to another. In this figure, data is extracted from a SQL database by an applications\parser and then sent over a network to another application\parser. This parser then converts the data into an Oracle format.

Figure 12.2. Application-to-application data transfer.

graphics/12fig02.gif

Parsers

A parser is a program that reads a document and extracts specific information. For example, a compiler contains a parser. The parser reads each line of a program and uses specific grammar rules to determine how to produce code. A parser would verify that a print statement was written with the appropriate syntax.


 <  Day Day Up  >  


Object-Oriented Thought Process
Object-Oriented Thought Process, The (3rd Edition)
ISBN: 0672330164
EAN: 2147483647
Year: 2003
Pages: 164
Authors: Matt Weisfeld

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net