Chapter 23: Working with XML Data Using ColdFusion MX


Instructions for Project Execution

This section describes the detailed instructions to execute the application code provided with this book.

Steps to Create the Database

Perform the following steps to create the database and tables:

  1. Choose Start, Programs, Microsoft SQL Server, Query Analyzer. The Connect to SQL Server dialog box appears.

  2. Provide the name of the SQL server. Then provide the user authentication information and click OK.

  3. Ensure that you are connected to the Master database. If you are not connected to the Master database, select it from the Database drop-down list.

  4. Chose File, Open.

  5. In the Open Query File dialog box, select Project6.sql. This script first creates the WeMakeCars database and then creates the following tables: tblInvoiceDetails, tblInvoiceHeader, tblItemMaster, tblItemSupplierCostList, tblPurchaseDetails, tblPurchaseHeader, tblRequisitions, and tblSuppliers. If the SQL server is installed in C:\, you do not need to modify the script. If the SQL server is installed in any other path, modify the database path in the script.

  6. Click the Execute button on the toolbar to execute the Project6.sql script. This creates the database and the tables in the database.

Perform the following steps to import the data from an Excel file to the tables:

  1. Start SQL Server Enterprise Manager.

  2. Right-click the WeMakeCars database in the Enterprise Manager.

  3. Select All Tasks, Import Data from the pop-up menu. This starts the Data Transformation Services Import/Export Wizard. Click the Next button to proceed to the next screen.

  4. The Choose a Data Source screen appears. Select Microsoft Excel 97–2000 from the Data Source drop-down list and choose the Excel file Project6Data.xls. Then click the Next button.

  5. The Choose the Destination screen appears. Click the Next button to continue.

  6. The Specify Table Copy or Query screen appears. This copies the tables in the Excel file to the WeMakeCars database. Click the Next button to continue.

  7. The Select Source Tables and Views screen appears. Select the tables that you want to import and click the Next button to continue.

  8. The Save, Schedule, and Replicate package screen appears. Select the Run Immediately option and then click the Next button to continue.

  9. Click the Finish button to close the wizard.

Steps to Test the Application in ColdFusion MX

Create the data source as follows:

  1. Start ColdFusion MX Administrator. This is usually located at http://localhost/CFIDE/Administrator/index.cfm, but the location can be different as per the setup.

  2. Provide the password. The main screen appears.

  3. Navigate to data sources under the Data and Services section.

  4. Create a data source named WeMakeCars for SQL Server.

Test the application as follows:

  1. Create the directories as listed in Table 23.1.

    Table 23.1: Directories and Their Purpose

    Directory

    Purpose

    C:\PurchaseOrders

    To save the purchase orders in XML format

    C:\NewInvoices

    To save invoice XML files received from suppliers

    C:\OldInvoices

    To store the invoices that came from the NewInvoices directory

  2. Create a directory named ProjectSix under the wwwroot directory on the Web server.

  3. Copy all the .cfm files in the ProjectSix directory.

  4. Start the browser and access the URL http://hostname/projectsix/.

The application also assumes the Web server to be installed in C:\.

To work with invoices, use the INV001.xml file provided with the setup files. Create more invoices using this standard format. Save it in the NewInvoices directory.

Extensible Markup Language (XML) is a new markup language that's used to store data in a structured format. A markup language provides you with a set of tags to describe the text in a document. Let's say you need to create a Web page, which involves deciding the structure of the page and the content to be included in the page. All this can be done easily using the tags in a markup language. For example, languages such as HTML have a set of predetermined tags that you can use to describe and format the text in a document. However, sometimes you might not need the elements that already exist in a markup language. In such cases, you need to create your own tags. This can be achieved using XML. Therefore, XML is called a metamarkup language.

This chapter will introduce you to XML and the various components of an XML document, including type definitions, tags, attributes, and comments. Using this knowledge, you'll learn how to create a sample XML document.




Macromedia ColdFusion MX. Professional Projects
ColdFusion MX Professional Projects
ISBN: 1592000126
EAN: 2147483647
Year: 2002
Pages: 200

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