220 likes | 306 Views
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
E N D
Create Document/View Web Applications With XML Dino EspositoWrox 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 • Separation between data and presentation
XML And XSL • Two distinct files: Data and presentation • XSL applies transformations to XML data • XSL knows about the XML code structure
Doc-View On The Web Win32 - MFC IE 5.0 XSL XSL XSL CView CView CView XML Data CDocument HTML Page
Three Scenarios For XML/XSL • Different stylesheets via ASP • Different stylesheets via XMLDOM and Dynamic HTML • Different stylesheets via MFC classes
Agenda • Documents and views • XML and ASP • HTML and XMLDOM • XML and MFC
XSL Selection Via ASP • Frame-based page • Surrounding graphics and controls • An <IFRAME> window gets the XML text through an ASP page
Ex. 1: Web Doc-View Stylesheets <IFRAME src=content.asp?XSL=…>
Using ASP: Trade-Offs • Easy to design and code • Everything happens on the server • Serious overhead • XML data is continuously downloaded • Each representation requires a new page with the same data
Agenda • Documents and views • XML and ASP • HTML and XMLDOM • XML and MFC
Using Data-Islands • The HTML page embeds the XML code to display • The <xml> tag in IE5.0+ • Retrieve the data-island text through the Dynamic HTML DOM • Apply the necessary transformation on the client
What’s A Data-Island? <html> <body> <xml id=MyData> <% ‘ Enter ASP code to ‘ produce XML data %> </xml> <!-- Rest of the page --> </body> </html> • The <xml> tag supports the src attribute • <xml> is IE50-specific • Use DHTML
Ex. 2: Using XMLDOM Stylesheets <DIV> filled at runtime via XMLDOM transformations
Using XMLDOM Request for Page.asp Browser (IE 5.0) Web Server HTML page with embedded XML code Instantiate XMLDOM, convert to HTML and use Dynamic HTML to display the final code
Using XMLDOM: Trade-Offs • Browser-dependent • Everything takes place on the client • XML data downloads only once • Only additional XSLs download • DHTML script code on the client
Agenda • Documents and views • XML and ASP • HTML and XMLDOM • XML and MFC
Using MFC And CHtmlView • A MFC application using CHtmlView • Internet Explorer 5.0+ gives you automatic support for XML and XSL • Force WebBrowser to display XML • Use temp files • Everything takes place locally
Ex. 3: Using CHtmlView Load OLE DB data and convert to XML Stylesheets WebBrowser displays a temporary XML file
Using MFC: Trade-Offs • A familiar programming model • WebBrowser (IE 5.0) dependent • Everything takes place on the client • Take advantage of XML support in SQL Server™ 2000