create document/view web applications with xml dino esposito wrox press 6-404

22
Create Document/View Create Document/View Web Applications With Web Applications With XML XML Dino Esposito Dino Esposito Wrox Press Wrox Press 6-404 6-404

Upload: julian-best

Post on 30-Dec-2015

20 views

Category:

Documents


0 download

DESCRIPTION

Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404. Agenda. Documents and views XML and ASP HTML and XMLDOM XML and MFC. Doc/View Background. Model-View-Controller architecture Foundation of SmallTalk 25 yrs ago MFC Doc/View model simplification - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Create Document/View Web Create Document/View Web Applications With XMLApplications With XML

Dino EspositoDino EspositoWrox PressWrox Press

6-4046-404

Page 2: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404
Page 3: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

AgendaAgenda

Documents and viewsDocuments and views XML and ASPXML and ASP HTML and XMLDOMHTML and XMLDOM XML and MFCXML and MFC

Page 4: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Doc/View BackgroundDoc/View Background

Model-View-Controller architectureModel-View-Controller architecture Foundation of SmallTalk 25 yrs agoFoundation of SmallTalk 25 yrs ago

MFC Doc/View model simplificationMFC Doc/View model simplification Separation between data and Separation between data and

presentationpresentation

Page 5: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

XML And XSLXML And XSL

Two distinct files: Data and presentationTwo distinct files: Data and presentation XSL applies transformations to XSL applies transformations to

XML dataXML data XSL knows about the XML XSL knows about the XML

code structurecode structure

Page 6: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Doc-View On The WebDoc-View On The Web

CDocumentCDocument

CViewCView CViewCView CViewCView

Win32 - MFCWin32 - MFC

HTML PageHTML Page

XML DataXML Data

IE 5.0IE 5.0

XSL XSL XSL

Page 7: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Three Scenarios Three Scenarios For XML/XSLFor XML/XSL Different stylesheets via ASPDifferent stylesheets via ASP Different stylesheets via XMLDOM and Different stylesheets via XMLDOM and

Dynamic HTML Dynamic HTML Different stylesheets via MFC classesDifferent stylesheets via MFC classes

Page 8: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

AgendaAgenda

Documents and viewsDocuments and views XML and ASPXML and ASP HTML and XMLDOMHTML and XMLDOM XML and MFCXML and MFC

Page 9: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

XSL Selection Via ASPXSL Selection Via ASP

Frame-based pageFrame-based page Surrounding graphics and controlsSurrounding graphics and controls An <IFRAME> window gets the XML text An <IFRAME> window gets the XML text

through an ASP pagethrough an ASP page

Page 10: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Ex. 1: Web Doc-ViewEx. 1: Web Doc-View

<IFRAME src=content.asp?XSL=…>

Stylesheets

Page 11: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Using ASP: Trade-OffsUsing ASP: Trade-Offs

Easy to design and codeEasy to design and code EverythingEverything happens on the server happens on the server Serious overheadSerious overhead

XML data is continuously downloadedXML data is continuously downloaded Each representation requires a new page Each representation requires a new page

with the same data with the same data

Page 12: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

AgendaAgenda

Documents and viewsDocuments and views XML and ASPXML and ASP HTML and XMLDOMHTML and XMLDOM XML and MFCXML and MFC

Page 13: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Using Data-IslandsUsing Data-Islands

The HTML page embeds the XML code The HTML page embeds the XML code to displayto display

The <xml> tag in IE5.0+The <xml> tag in IE5.0+ Retrieve the data-island text through Retrieve the data-island text through

the Dynamic HTML DOMthe Dynamic HTML DOM Apply the necessary transformation Apply the necessary transformation

on the clienton the client

Page 14: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

What’s A Data-Island?What’s A Data-Island?

The <xml> tag The <xml> tag supports the src supports the src attributeattribute

<xml> is IE50-<xml> is IE50-specificspecific

Use DHTMLUse DHTML

<html><html><body><body>

<xml id=MyData><%

‘ Enter ASP code to ‘ produce XML data

%></xml>

<!-- Rest of the page --><!-- Rest of the page -->

</body></body></html></html>

Page 15: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Ex. 2: Using XMLDOMEx. 2: Using XMLDOM

<DIV> filled at runtime via XMLDOM transformations

Stylesheets

Page 16: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Using XMLDOMUsing XMLDOM

Web ServerBrowser(IE 5.0)

Request for Request for Page.aspPage.asp

HTML page with embeddedHTML page with embeddedXML codeXML code

Instantiate XMLDOM,Instantiate XMLDOM,convert to HTML and useconvert to HTML and useDynamic HTML to displayDynamic HTML to display

the final codethe final code

Page 17: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Using XMLDOM: Trade-OffsUsing XMLDOM: Trade-Offs

Browser-dependentBrowser-dependent Everything takes place on the clientEverything takes place on the client XML data downloads only onceXML data downloads only once Only additional XSLs downloadOnly additional XSLs download DHTML script code on the clientDHTML script code on the client

Page 18: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

AgendaAgenda

Documents and viewsDocuments and views XML and ASPXML and ASP HTML and XMLDOMHTML and XMLDOM XML and MFCXML and MFC

Page 19: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Using MFC And CHtmlViewUsing MFC And CHtmlView

A MFC application using CHtmlViewA MFC application using CHtmlView Internet Explorer 5.0+ gives you Internet Explorer 5.0+ gives you

automatic support for XML and XSLautomatic support for XML and XSL Force WebBrowser to display XMLForce WebBrowser to display XML

Use temp filesUse temp files Everything takes place locallyEverything takes place locally

Page 20: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Ex. 3: Using CHtmlViewEx. 3: Using CHtmlView

Stylesheets

Load OLE DB dataand convert to XML

WebBrowser displaysa temporary XML file

Page 21: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404

Using MFC: Trade-OffsUsing MFC: Trade-Offs

A familiar programming modelA familiar programming model WebBrowser (IE 5.0) dependentWebBrowser (IE 5.0) dependent Everything takes place on the clientEverything takes place on the client Take advantage of XML support in Take advantage of XML support in

SQL ServerSQL Server™™ 2000 2000

Page 22: Create Document/View Web Applications With XML Dino Esposito Wrox Press 6-404