Selfreview Exercises Lle
State whether the following are true or false. If false, explain why. a XML is a technology for creating markup languages. b XML markup text is delimited by forward and backward slashes and . c Arabic characters can only be placed in to an XML document using an Arabic language keyboard. d Unlike HTML, all XML start tags must have corresponding end tags. e Parsers check an XML document's syntax and may support the Document Object Model and or the Simple API for XML. f An XML document is...
Nested framesets
You can use the frameset element to create more complex layouts in a framed Web site by nesting frameset areas as in Fig. 3.10. The first level of frameset tags is on lines 21 and 22 frameset cols 110, gt frame name navsrc nav.html gt The frameset and frame elements here are constructed in the same manner as in Fig. 3.9. We have one frame that extends over the first 110 pixels starting at the left edge. The second nested level of the frameset element covers only the remaining frame area that...
Objectives Vjx
To be able to use the Simple API for XML SAX . To understand the differences between the Document Object Model DOM and SAX. To be able to use JAXP's SAX implementation to parse a document. To understand fundamental differences between SAX 1.0 and SAX 2.0. To be able to use Xerces' SAX implementation to parse a document. Tis one thing to show a man that he is in an error, and another to put him in possession of truth. An error is the more dangerous in proportion to the degree of I claim not to...
Example Tree Diagram
Figure 9.3 is a program that parses an XML document with a SAX-based parser and outputs the document's data as a tree diagram. Using the SAX Parser to generate a tree diagram, import java.io. import org.xml.sax. for HandlerBase class import javax.xml.parsers.SAXParserFactory import import javax.xml.parsers.SAXParser public class Tree extends HandlerBase private int indent 0 indentation counter returns the spaces needed for indenting private String spacer int count for int i 0 i lt count i temp...
Exercises Ocg
10.4 Modify the XmlMessenger application so that the server holds an XML file of registered users with passwords. This file should be stored on the server and should contain every user ever to register i.e., not just those who log in to the current server session . When a user logs in, their name and password should be checked against this document for validity. If the name is registered with a different password, indicate so to the user and ask for the correct password or a unique user name....
Introduction Vsx
In Chapter 6, we studied Document Type Definitions DTDs . These describe an XML document's structure. DTDs are inherited from SGML. Many developers in the XML community feel DTDs are not flexible enough to meet today's programming needs. For example, DTDs cannot be manipulated e.g., searched, transformed into different representation such as HTML, etc. in the same manner as XML documents can because DTDs are not XML documents. In this chapter, we introduce an alternative to DTDs called schemas...
Selfreview Exercises
1.1 Fill in the blanks in each of the following Fill in the blanks in each of the following sentences. , incorporates the elements of both CSS and DSSSL. , combines ideas from HyTime and the Text Encoding Initiative TEI . _is the information carrying capacity of communications lines. The W3C is pursuing its_to help individuals with disabilities utilize the Web. _is the grandparent of what is today called the Internet. The information carrying capacity of a communications medium like the...
Markup
This section elaborates on elements and their attributes as well as how they are used to construct proper XML markup. XML element markup consists of a start tag, content and an end tag. Unlike HTML, all XML start tags must have a corresponding end tag. For example, lt img src img.gif gt is correct HTML, but in XML, the ending tag must also be supplied, as in lt img src img.gif gt lt img gt This type of element is called an empty element , because it does not contain content i.e., character data...
Good Programming Practice 73
By convention, Microsoft XML Schema authors use namespace prefix dt when referring to the URI urn schemas-microsoft-com datatypes. char A single character e.g., D . string A series of characters e.g., Deitel . Fig. 7.12 Some Microsoft XML Schema data types part 1 of 2 . float A real number e.g., 123 .4567890 . date A date formatted as YYYY-MM-DD e.g., 2000-04-25 . time A time formatted as HH-MM-SS e.g., 14 30 00 . id Text that uniquely identifies an element or attribute. enumeration A series of...
Introduction Lhg
In this chapter we introduce three technologies that take advantage of XML to deliver Web content. We first introduce the Apache Group's Web publishing framework Cocoon. In our first example we take advantage of Cocoon's XSL capabilities to dynamically deliver Web content to different types of clients, including Web browsers, such as Netscape Communicator and Internet Explorer, and wireless devices, such as digital cellular phones. In our second example, we use Cocoon's XML-based scripting...
DOM Components
In this section, we will use Java, JAXP and the XML-related Java packages described in Fig. 8.4 to manipulate an XML document. Before discussing our first Java-based example, we summarize several important DOM classes, interfaces and methods. Due to the number of DOM objects and methods available, we provide only a partial list of these objects and methods. For a complete list of DOM classes and interfaces, browse the HTML documentation index.html in the api folder included with JAXP. Node...
Using Unicode in an XML Document
This section demonstrates XML's Unicode support. Figure 5.4 lists an XML document that displays Arabic words. Each Arabic character is represented by an entity reference for a Unicode character. Each line that contains a series of entity references represents one Arabic word. When translated to English, element from line 9-17 contains Deitel and Associates and element subject lines 19-29 contains Welcome to the world of Unicode. Fig. 5.4 XML document that contains Arabic words part 1 of 2 ....
Case Study Writing a Microsoft XML Schema for the Day Planner Application
Figure 7.20 is a Microsoft XML Schema for the day planner introduced in Chapter 5. lt xml version 1.0 gt lt -- Fig. 7.2 0 planner-schema.xml -- gt lt -- Microsoft XML Schema for day planner -- gt lt Schema xmlns xmlns dt lt ElementType name planner content eltOnly model closed gt lt element type year minOccurs 0 maxOccurs gt lt ElementType gt lt ElementType name year content eltOnly model closed gt lt AttributeType name value dt type int gt lt attribute type value gt lt element type date...
Case Study A Wireless Online Bookstore
In this section we present a case study that uses XML and XSL with Java servlets and the Wireless Applications Protocol WAP to build a wireless online bookstore. WAP uses the Wireless Markup Language WML , which adheres to the XML 1.0 recommendation from the World Wide Web Consortium W3C . Many digital cellular phones now support WAP for browsing the Web, reading e-mail and shopping online. Using WAP will allow customers to purchase books from our store using these devices. The wireless...
Internet and World Wide Web Resources Muv
XSL Formatting Object vocabulary links. www.renderx.com Tests validator fo2 0 00.dtd.html Home page of FOP, an open-source XSL formatter-renderer, from Apache. Provides XEP, a commercial XSL FO processor. Arbortext Web site where a commercial XSL FO processor is available. Provides links to many different XML-related pieces of software including XSL processors. XSL formatting objects format XML documents for presentation. Formatting objects constitute the vast majority of XSL features....
XML Linking Language XLink
In Chapter 2, we discussed HTML's a element and href attribute for linking to documents on the Web. The W3C has been actively developing a specification, called the XML Linking Language XLink , for linking to resources from an XML document. As we will soon discover, XLink goes far beyond HTML linking. XLink is currently a W3C Candidate Recommendation i.e., one step away from becoming a W3C Recommendation . XLink was designed using ideas from other linking standards HTML, HyTime and the Text...
Iteration and Sorting
XSLT also allows for iteration through a node set returned by an XPath expression. The node set can also be sorted. Figure 12.8 shows an XML document we introduced in Chapter 5. At the time we introduced this XML document, we briefly introduced the concept of an XSL stylesheet. Figure 12.9 shows the XML stylesheet used to render the document. Figure 12.9 lists an XSLT document for transforming this XML document into an HTML document. 1 lt xml version 1.0 gt 3 lt -- Fig. 12.8 usage.xml -- gt 4...
Creating Elements and Attributes
In the previous section, we demonstrated the use of XSLT for simple element matching. This section discuss the creation of new elements and attributes within an XSLT document. Figure 12.4 lists an XML document that marks up various sports. _ 1 lt xml version 1.0 gt 3 lt -- Fig. 12.2 intro.xml -- gt 4 lt -- Simple introduction to XML markup -- gt 6 lt xml stylesheet type text xsl href intro.xsl gt 9 lt message gt Welcome to XSLT lt message gt 10 lt myMessage gt 1 lt html gt lt body gt Welcome to...
Summary Sxb
SAX was developed by the members of the XML-DEV mailing list and is an alternative model for parsing XML documents that uses an event-based model notifications called events are raised as the document is parsed. DOM is a tree-based model, which stores the document's data in a hierarchy of nodes. Because all the document's data is in memory, data can be quickly accessed. DOM also provides facilities for adding or removing nodes i.e., modifying the document . SAX-based parsers invoke methods...
Info Sai
Chapter 1 Introduction to the Internet and World Wide Web 15 Chapter 17 Perl and XML A Web-based Message Forums Application There are a variety of popular server-side technologies for developing Web-based applications. Historically, the most widely used and the third such technology we cover in this book has been Perl CGI. Despite newer technologies from Microsoft and Sun Active Server Pages ASP and JavaServer Pages, respectively Perl CGI is well entrenched and growing rapidly. Chapter 17...
Case Study Writing a DTD for the Day Planner Application
In this section, we build upon the case study introduced in Chapter 5. Figure 6.15 lists the external subset of the DTD for the day planner XML document, planner.xml. The following document type declaration is inserted into the day planner XML document lt DOCTYPE planner SYSTEM planner.dtd gt 1 lt -- Fig. 6.15 planner.dtd -- gt 2 lt -- DTD for day planner -- gt 4 lt ELEMENT planner year gt 6 lt ELEMENT year date gt 7 lt ATTLIST year value CDATA REQUIRED gt 9 lt ELEMENT date note gt 10 lt...
Exercises Iju
5.5 Create an XML document that marks up the nutrition facts for a package of Grandma Deitel's Cookies. A package of Grandma Deitel's Cookies has a serving size of 1 package and the following nutritional value per serving 260 calories, 100 fat calories, 11 grams of fat, 2 grams of saturated fat, 5 milligrams of cholesterol, 210 milligrams of sodium, 36 grams of total carbohydrates, 2 grams of fiber, 15 grams of sugars and 5 grams of protein.Render the XML documents in Internet Explorer 5. Hint...
Introduction Uud
An XSL stylesheet can be used to transform an XML document into a variety of formats Fig. 13.1 . In Chapter 12, we used XSLT to transform XML documents into HTML, which is perhaps the most common use of XSLT. In this chapter, we introduce another aspect of XSL called formatting objects used to format XML documents for presentation. Formatting objects constitute the vast majority of XSL features. We present only a small subset of formatting-object features in this chapter. The latest XSL Working...
Case Study XSLT and XPath
XPath and XSL are intimately related. The examples in this chapter used simple XPath expressions to locate elements, attributes and text in XML documents. In this section, we present a more substantial example that uses more complex XPath expressions. Figure 12.25 marks up information about Deitel amp Associates, Inc.'s complete training course and Web-based training products. The document contains root element product, which has three child elements completeTrainingCourses, books and...
Info Cmk
message, and to send them to the server. The client also has to parse the XML messages received from the server and display them to the user. This messaging system demonstrates how to incorporate XML into all the tiers of a client server interface. It can be expanded to include many more advanced capabilities, but for our purposes, the system we implement provides ample illustration of XML. Because the XmlMessenger uses Sun's Java implementation of the org.w3c.dom package, Chapter 8 is a...
XML Pointer Language XPointer
The XML Pointer Language XPointer is used to reference fragments of an XML document via a URI. In Chapter 11, we discussed XPath, which allowed for selecting specific nodes in an XML document. XPointer uses XPath expressions to provide a means for referencing an XML document's nodes from a URI. The XPointer specification is currently a W3C Candidate Recommendation. For the latest XPointer specification, visit www.w3.org TR xptr. In Section 14.2, we discussed XLink, which links resources. By...
Outline Epw
12.4 Creating Elements and Attributes 12.10 Case Study XSLT and XPath 12.11 Internet and World Wide Web Resources Summary Terminology Self-Review Exercises Answers to Self-Review Exercises Exercises
Images
We have thus far dealt exclusively with text. We now show how to incorporate images into Web pages Fig. 2.5 . lt DOCTYPE HTML PUBLIC - W3C DTD HTML 4.01 EN lt -- Fig. 2.5 picture.html -- gt lt -- Adding images with HTML -- gt lt title gt XML How to Program - Welcome lt title gt lt head gt lt p gt lt img src xmlhtp.jpg height 238 width 183 alt Demonstration of the alt attribute gt lt p gt The image in this code example is inserted in lines 14 and 15 lt p gt lt img src xmlhtp.jpg height 238 width...
Internet and World Wide Web Resources Dut
The World Wide Web Consortium's XML Path Language Recommendation. The XPath Reference Page on the vbxml.com Web site. In XPath, an XML document is viewed conceptually as a tree in which each XML construct is represented as a node. For each node, there is a corresponding string-value, which is determined differently for each node type. Some node types have a corresponding expanded-name, which has both a local part and a namespace URI. Nodes in an XPath tree have an ordering, called document...
Info Xld
Chapter 1 Introduction to the Internet and World Wide Web 5 stand-alone computers, i.e., computers that were not connected to one another. Today's applications can be written to communicate among the world's hundreds of millions of computers. The Internet mixes computing and communications technologies. It makes our work easier. It makes information instantly and conveniently accessible worldwide. It makes it possible for individuals and small businesses to get worldwide exposure. It is...
Exercises Oub
6.3 Create a DTD for Fig. 5.6 letter.xml . 6.4 Create a DTD products, dtd for a retailer with the following specifications The XML document that conforms to the DTD must contain a list of products and manufacturers. Each product should be represented by a product element and each manufacturer should be represented by a manufacturer element. Each manufacturer has a unique ID. Represent details like name, address, etc., as child elements of a manufacturer element. Each product has attributes such...
Exercises Xdx
7.3 Write a Microsoft XML Schema document for the XML document in Fig. 7.2 that would allow element note to be a child element of element myMessage. Element note can contain only text. Validate your document using Microsoft XML Validator. 7.4 Write a schema to validate the XML document shown in Fig. 7.22. This XML document contains information about products in a grocery store. Each product is represented by a product element that contains the name, manufacturer, quantity and price of the...
Introduction Ars
In previous chapters, we concentrated on basic XML markup and documents e.g., DTDs and schema for validating XML documents. In this chapter, we focus on manipulating the contents of an XML document. XML documents, when parsed, are represented as a hierarchical tree structure in memory. This tree structure contains the document's elements, attributes, content, etc. XML was designed to be a live, dynamic technology a programmer can modify the contents of the tree structure, which essentially...
Exercises Fiv
4.3 Write a CSS rule that makes all text 1.5 times larger than the base font of the system and colors it red. 4.4 Write a CSS rule that removes the underline from all links inside list items li and shifts them left by 3 ems. 4.5 Write a CSS rule that places a background image halfway down the page, tiling horizontally. - i i The image should remain in place when the user scrolls up or down. 4.6 Write a CSS rule that gives all h1 and h2 elements a padding of .5 ems, a grooved border style and a...









