1 Advanced Web Development IT225Spring Term 2016 Marymount University School of Business Administration Professor Suydam Week 15 XML (eXtensible Markup Language) for Data Description (Chapter 11) Collecting, Analyzing and Using Visitor Data (Chapter 12)
2 Agenda Week 15 Quiz 5 Preparation MP5 Requirements ModificationChapter 11 XML Chapter 12 Collecting, Analyzing and Using Visitor Data
3 Quiz 5 Preparation
4 MP5 Requirements
5 Fixing Website Problems: Email with Author
6 Complete up through Step #3 Modify for connectToDatabase.php and testMP5 Site Modification Complete up through Step #3 Modify for connectToDatabase.php and test Set button link for Nature 5 and Nature10 so it opens in frames page main window (phpMyAdmin should open in New Window)
7 Fix MP5 Site The effort to adapt 1st edition to the new second edition Natures Source website is so great we will add a new nature10 to our MP5 site and adapt to our server setup. Download new nature10 at this link Modify connectToDatabase.php and add your username, password, and database name (same as was done for nature5)
8 MP5 Site nature4 to nature10 Files Comparison
9 Nature5 Website: Homepage, Products, Registration
10 New nature10 Website: Homepage, Products, Registration
11 New nature10 Website: Login & Logout
12 New nature10 Website: Shopping & Checkout
13 New nature10 Website: Success!
14 Fixing Website Problems: Web Map Check of WebsiteError on page
15 Overview and Objectives Chapter 11To learn: what XML is and what it isn’t why XML may be very useful to any business the basic syntax rules of XML how to style an XML document using CSS To understand: what it means for an XML document to be well-formed and the consequences when it isn’t what it means for an XML document to be valid, and the consequences when it isn’t the structure, syntax and use of a basic Document Type Definition (DTD) what will (probably) happen when you attempt to view a “raw” XML document in a browser To have a very brief exposure to each of the following, just to know what they are: XSL (eXtensible Style Language) XSLT (XSL Transformations) XPath (to help you find your way around an XML document) XML namespaces (to help avoid name clashes in XML documents, and to provide useful collections of XML tags)
16 What Is XML? What is it? XML is a “meta language”, a language used to describe other languages, which are called “markup languages”. So, XML can also be called a “meta markup language”. XML has been used, as we know, to describe a particular version of the markup language HTML that we know as XHTML. XML can be used to create “languages” to describe many different kinds of data for business, science, or any other area of human endeavor. XML is not a programming language. Fundamental Idea XML lets you create your own “markup language” but it has no tags of its own. That forces you to make up your own tags: Example: If your business sells vitamins, you might want a vitamin “element”, which could be enclosed in a
17 The Basic Rules of XML XML is just text, so any editor can be used to create it, but there are also XML-specific editors. You create your own tags to describe your own elements:
18 Describing Data with Well-Formed XMLXML looks much like HTML, except that you make up your own element tags and attributes. To be well-formed your XML must follow all the XML rules (proper nesting, quoted attribute values, consistent capitalization, and so on). Example:
19 Create an xml folder in MP5 and add Two Button Links
20 A Well-formed XML Document: sampledata.xml
21 A Not Well-formed XML Document: sampledata.xmlError Message When Browser Attempts to Display XML That Is Not Well-Formed Not well-formed because spelling of closing tag does not match opening tag
22 What Is a Valid XML Document?We must be careful to distinguish between a well-formed XML document and a valid XML document: A well-formed XML document is one that follows all the rules of XML itself. A valid XML document is one that is, first of all, well-formed, and second, follows an additional set of rules that describe what is allowed to be in the document, how many of those things can be there, the order in which they must appear, and so on … This “additional set of rules” can take two forms: A Document Type Definition (DTD) An XML Schema DTDs are: simpler and easier to understand than XML schemas not as powerful or flexible as XML schemas not themselves XML documents (they have a very different syntax) XML schemas are: more powerful, allowing you to specify the data type of your element content, for example somewhat daunting to read, understand, and apply themselves XML documents, which means that an XML document and its XML schema can both be processed by the same XML parser DTDs are still very widely used, but will probably ultimately be replaced by XML schemas, especially as more and better tools become available for dealing with them. Example DTD, below, describes the structure our vitamin supplement XML document must have in order to be valid. It tells us, among other things, what elements must be present, what their order must be, and the required attribute. daily_requirement)>
23 Browser Displaying XML/*supplements.css*/ supplements { background-color: #ffffff; width: 100%; font-family: Arial, sans-serif; } vitamin display: block; margin-top: 10pt; margin-left:0pt; name background-color: green; color: #FFFFFF; font-size: 1.5em; padding: 5pt; margin-bottom:3pt; margin-right:0; price background-color: lime; color: #000000; padding:5pt; margin-left:0 helps_support font-size: 1.2em; padding-top: 3pt; margin-left: 20pt; daily_requirement If we want to display the information in our XML files with a little more pizzazz, what to do? To the rescue come two possibilities: CSS and XSLT (eXtensible Sheet Language Transformations) Browser Display of XML Styled with CSSsimpledata_with_css.xml How Do We Connect An XML Document to the CSS File Used to Style It? We “link” the XML file to the CSS file with the following line in the XML file: This line from simpledata_with_css.xml is analogous to a link element in an XHTML file linking it to an external CSS file. Now see the next two slides for the contents of supplements.css.
24 XML Namespaces & Other TechnologiesSince XML is used to describe data, many organizations have developed their own tag sets to describe their data. The holy grail of software development is “code reuse”, so many people will want to use one or more tag sets from one or more sources. Problem: Same tag is used for a different purpose in different tag sets (table as used by the XHTML folks, and by the furniture-making folks, for example). Solution: Every tag set that might be used by others should be placed in its own namespace. Example (and now this should make more sense): Here xmlns stands for “XML namespace”, and this opening tag, which appeared in our XHTML pages, can now be viewed as specifying the namespace containing all XHTML tags we were using. Other XML Technologies XML schema, a more flexible and powerful way (than a DTD) of specifying the permitted contents of an XML file. XSL (eXtensible Style Language) and XSLT (eXtensible Style Language Transformations) together allow one XML document to “transformed” from one form to another. XSL-FO (eXtensible Stylesheet Language Formatting Objects) is a language for formatting XML data for output to screen, paper or other media. XPath is used to navigate through elements and attributes of an XML document.
25 Browser Display of XML Styled with XSLT: sampledata_with_xsl.xml 26 Web Mining Chapter 12: An OverviewWeb-content mining: Deals with the content of web documents Web-structure mining: Concerned with the “topology” and the use of hyperlinks that connect one page to another Web-usage mining: Secondary data generated by user interactions with the website Caution: Interpreting Web-server Access Logs You do not really know any of the following: The identity of your readers The number of your visitors The number of visits The user’s navigation path through the site The entry point and referral How users left the site or where they went next How long people spent reading each page How long people spent on the site 27 Web Access Log AnalyzersTap on above image to go directly to site 28 Google Analytics 29 Google Analytics 30 GoDaddy Analytics 31 Data in Web-server Access LogsThe IP address of the client making the request The date and time of the request The URL of the requested page The number of bytes sent to serve the request The user agent (the program that is acting on behalf of the user, such as a web browser or web crawler) The referrer (the URL that triggered the request) Common Format Examples pawan [06/Sep/2001:10:46: ] "GET /s.htm HTTP/1.0" A GET request that retrieves a file named s.htm From a computer with the IP address of A dash (-) tells us that the information is unavailable raj [06/Sep/2001:11:23: ] "POST /s.cgi HTTP/1.0" A POST request that sends data to the program s.cgi. 32 A Log File Extended Format Directive Types Identifier Prefixes#Version: 1.0 #Date: 12-Jan-1996 #Fields: time cs-method cs-uri 00:34:23 GET /foo/bar.html 12:21:16 GET /foo/bar.html 12:45:52 GET /foo/bar.html 12:57:34 GET /foo/bar.html 33 A Log File Mandatory Identifiers Identifiers with No Prefixes 34 Web Access Log Analyzers 35 Analog: Summarizing Web-server Access Logs 36 Analog Monthly Report Daily Summary Hourly Summary 37 Analog Domain Report Organization Report Search-word Report Operating System Report 38 Analog Status Code Report File Size Report File-type ReportDirectory Report Request Report Report 39 Clickstream with Pathalizer7-link 20-link 40 StatViz On-campus Session that Browses the Bulletin BoardOff-campus Session with Three Distinct ActivitiesVitamin Supplements
Daily requirement: