Generating XML Data from a Database Eugenia Fernandez IUPUI.

Slides:



Advertisements
Similar presentations
XML-XSL Introduction SHIJU RAJAN SHIJU RAJAN Outline Brief Overview Brief Overview What is XML? What is XML? Well Formed XML Well Formed XML Tag Name.
Advertisements

Integrating XML in Business Ken Spencer Vice President 32X Corporation
Java Script Session1 INTRODUCTION.
The Librarian Web Page Carol Wolf CS396X. Create new controller  To create a new controller that can manage more than just books, type ruby script/generate.
WeB application development
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
1 Chapter 12 Working With Access 2000 on the Internet.
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
B.Sc. Multimedia ComputingMedia Technologies Database Technologies.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
1 Active Server Pages Active Server Pages (ASPs) are Web pages ASP = server-side scripts + HTML The appearance of an Active Server Page depends on who.
Java Server Pages Russell Beale. What are Java Server Pages? Separates content from presentation Good to use when lots of HTML to be presented to user,
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Chapter 11 ASP.NET JavaScript, Third Edition. 2 Objectives Learn about client/server architecture Study server-side scripting Create ASP.NET applications.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Tutorial 11: Connecting to External Data
2440: 141 Web Site Administration Web Server-Side Programming Professor: Enoch E. Damson.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
1 Web Database Processing. Web Database Applications Static Report Publishing a report is prepared from a database application and exported to HTML DB.
Some Basic Database Terminology
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
INTRODUCTION TO DREAMWEAVER 8. What we already know…  Design basics  Contrast  Repetition  Alignment  Repetition  HTML.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Basics of Web Databases With the advent of Web database technology, Web pages are no longer static, but dynamic with connection to a back-end database.
1998 PI System Users’ Conference PI on the Web: A Primer for PI Users Omicron Consulting 1998 PI System Users’ Conference.
XSLT transformations Or how to get your XML to become HMTL.
© 2002 by Prentice Hall 1 David M. Kroenke Database Processing Eighth Edition Chapter 14 Networks, Multi-Tier Architectures, and XML.
Posting XML Data From the Client to a Server Eugenia Fernandez IUPUI.
Web Programming: Client/Server Applications Server sends the web pages to the client. –built into Visual Studio for development purposes Client displays.
Tutorial 121 Creating a New Web Forms Page You will find that creating Web Forms is similar to creating traditional Windows applications in Visual Basic.
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Web Design and Development for E-Business By Jensen J. Zhao Copyright 2003 Prentice Hall, Inc. Web Design and Development for E-Business Jensen J. Zhao.
 2004 Prentice Hall, Inc. All rights reserved. 1 Chapter 34 - Case Study: Active Server Pages and XML Outline 34.1 Introduction 34.2 Setup and Message.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
Web Scripting [PHP] CIS166AE Wednesdays 6:00pm – 9:50pm Rob Loy.
CITA 330 Section 6 XSLT. Transforming XML Documents to XHTML Documents XSLT is an XML dialect which is declared under namespace "
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 13 – Advanced.
1 Committed to Shaping the Next Generation of IT Experts. Chapter 8 Exchanging Data Between Access and Other Applications Exploring Microsoft Office Access.
Searching Business Data with MOSS 2007 Enterprise Search Presenter: Corey Roth Enterprise Consultant Stonebridge Blog:
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
What is database?  Any Method for access info into Application from DataBase?  ODBC is standard for Accessing Data.  Problem with ODBC:  Information.
USING XML AS A DATA SOURCE. Data binding is a process by which information in a data source is stored as an object in computer memory. In this presentation,
XP 1 New Perspectives on XML Binding XML Data with Internet Explorer.
How to Connect to Database ODBC (Open Database Connectivity) ADO (ActiveX Data Object) ASP Code To Connect to Database Recordset Object Navigating through.
1 Introduction  Extensible Markup Language (XML) –Uses tags to describe the structure of a document –Simplifies the process of sharing information –Extensible.
New Perspectives on XML, 2nd Edition Tutorial 9B1 USING XML AS A DATA SOURCE TUTORIAL 9B.
3-Tier Client/Server Internet Example. TIER 1 - User interface and navigation Labeled Tier 1 in the following graphic, this layer comprises the entire.
ASP. What is ASP? ASP stands for Active Server Pages ASP is a Microsoft Technology ASP is a program that runs inside IIS IIS stands for Internet Information.
IS-907 Java EE World Wide Web - Overview. World Wide Web - History Tim Berners-Lee, CERN, 1990 Enable researchers to share information: Remote Access.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
Database Connectivity with ASP.NET. 2 Introduction Web pages commonly used to: –Gather information stored on a Web server database Most server-side scripting.
ASP-2-1 SERVER AND CLIENT SIDE SCRITPING Colorado Technical University IT420 Tim Peterson.
1 CS 3870/CS 5870: Note07 Prog 4. Master Pages Creating a master page based on another master page MainMasterPage –For all Progs and Tests Prog4MasterPage.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 8 1 Microsoft Office Access 2003 Tutorial 8 – Integrating Access with the.
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
1 ADO Activex Data Objects. 2 ADO ADO allows users to access data easily from many existing databases (such as Access or Paradox) From ODBC compliant.
CHAPTER 7 LESSON C Creating Database Reports. Lesson C Objectives  Display image data in a report  Manually create queries and data links  Create summary.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
eCommerce Technologies Syntax & Procedures for Markup MIS Spring 2004 Instructors: Kelly Fish, Ph.D. John Seydel, Ph.D.
Rendering XML Documents ©NIITeXtensible Markup Language/Lesson 5/Slide 1 of 46 Objectives In this session, you will learn to: * Define rendering * Identify.
Embedding XML in HTML: Using Data Islands Eugenia Fernandez IUPUI.
ASP – Web Programming Class  Ravi Anand. ASP – Active Server Pages What is ASP? - Microsoft Technology - Can Run using IIS/PWS/Others - Helps us create.
ASP.NET Programming with C# and SQL Server First Edition
Active Server Pages Computer Science 40S.
Microsoft Access 2003 Illustrated Complete
Presentation transcript:

Generating XML Data from a Database Eugenia Fernandez IUPUI

N-Tier Architecture Data sources available at back end Static XML Document Data Sources (e.g. a database) Middle tier merges data from various data sources and converts the data into a suitable format The client processes and presents data in an appropriate format LCD currently HTML

Sending & Presenting Data to Client: The Choices Convert to HTML less browser compatibility problems data loses semantic meaning more work done at server Convert to XML and XSL data retains its semantic meaning processing done locally on client browser must be XML compatible

Our Choice: XML The server uses the database schema to construct an XML document. An XSL stylesheet may be attached to format it for the browser. The user fills in the form and sends the revised XML document back to the server. The server converts the XML into appropriate columns in the database.

Our Tools: ASP ASP provides server-side scripting. An ASP page consists of text, HTML tags and scripting commands. ASP files have.asp extension and can be edited with any text editor. I recommend using Visual InterDev if you like color coding of elements. For a quick intro to ASP, see my Intro to ASP notes.

Our Tools: ADO ADO is a data access object that encapsulates OLE DB. It is the recommended data-access method for Microsoft Enterprise Servers. ADO can be used in ASP pages to query a database and return the results to a Web browser.

ADO Database Objects Connection represents the connection to a database source Recordset consists of records returned from a database query Field contains data from single column Fields collection contains all Field objects of a Recordset

How ADO Objects Relate Connection Recordset Field Fields Collection Execute or Open Active Connection

Connecting to a Data Source 1. Declare a Connection object 2. Create a Recordset object 3. Connect the Recordset to the Connection Object 4. Populate the Recordset by opening it using SQL 5. Reference the fields See the ASP Database Connection notes for details on how to do this.

Referencing Fields in a Recordset To use a field in a recordset, you can reference the field name directly reference the field name in the Fields collection use an index to refer to the field (first field has index = 0) Example rsBooks(“title”) rsBooks.Fields(“title”) rsBooks.Fields(0)

Navigating a Recordset MethodResult MoveFirstMoves to first record MoveLastMoves to last record MoveNextMoves to next record MovePreviousMoves to previous record MoveMoves a given number of records, forward or backwards recordset.Move NumRecords, [Start] Start can be 0 for current record (the default), 1 for first record, or 2 for last record

Checking for Records Use EOF and BOF properties to check if recordset has any records, or if you’ve moved beyond the limits of the recordset BOF = True if current position is BEFORE the first record, False otherwise EOF = True if current position is AFTER the last record, False otherwise If either BOF or EOF is True, there is no current record If you open a Recordset that is empty, both BOF and EOF are set to True

Navigation Example No book records found. <% Else Do Until rsBooks.EOF %> Book Title: <% rsBooks(“Title”) rsBooks.MoveNext Loop End If %>

Returning XML to the Client <% rsBooks.MoveNext Loop %> must set content type for Response to XML no whitespace between ContentType and XML declaration specify XML root element loop through recordset create XML elements

Returning XML as a Data Island <% rsBooks.MoveNext Loop %> must set content type for Response to HTML specify XML DSO ID loop through recordset create XML elements

Saving an ADO Recordset Directly as XML An ADO Recordset can be saved directly in XML format rsBooks.save fileName, 1 The persisted recordset consists of a series of elements representing the rows and a schema definition. Simple method, no loop needed output format harder to use

Example: Saving ADO as XML <% ‘this example shows how to persist an ADO recordset ‘into a temporary XML file called tempfile.xml ‘Prepare temporary file set fso = CreateObject(“Scripting.FileSystemObject”) fileName = Server.MapPath(“tempfile.xml”) ‘Delete tempfile if it already exists If fso.FileExists(fileName) Then fso.DeleteFile(fileName) End If ‘Save the recordset as XML rsBooks.Save fileName, 1 %>

Sources “Building XML-Based Web Applications” a Microsoft Certified Course.