91d0b9f5f89417a9caf850871bbe9693.ppt
- Количество слайдов: 19
Displaying and Using XML n There are simple ways to use or display XML ¨ CSS stylesheets ¨ Data Source Objects ¨ DHTML & Data Islands n In later lessons we will see more powerful mechanisms ¨ Document Object Model (DOM) programming ¨ XSL transforms
XML Stylesheets n Stylesheets can be applied to an XML data file with a processing instruction xml version="1. 0"? > xml-stylesheet type="text/css" href="book. css" ? >
CSS Stylesheet selector CHAPTER, TITLE, PARA {display: block; } TITLE character CHAPTER style definition {font-weight: bold; } {font-style: italic; } {margin: 0. 2 in 0. 5 in; border: 2 pt solid red; padding: 0. 1 in; }
CSS Stylesheets n Selectors ¨ element name ¨ list of elements ¨ context title, para, chapter title book title author name title
CSS Stylesheets n Common declarations font-family: Arial display: block font-size: 32 pt margin: 12 pt font-style: italic 12 pt; font-weight: bold border: 0. 1 in solid red; line-height: 14 pt padding: 0. 1 in color: green background-color: yellow text-align: center text-transform: uppercase text-indent: 3 em 0. 1 in;
CSS Stylesheets n Pros ¨ simple ¨ good n for documents Cons ¨ unable to add to or change documents ¨ bad for data n CSS 2 addresses some of the cons
XML Data Source Objects n The XML DSO binds HTML tables to an XML data set. n The table contents display the elements in the XML data.
XML Data Source Objects n In Internet Explorer use the
XML Data Source Objects n Use the ID attribute of the . . .
XML Data Source Objects n Create the structure of the table ¨ columns for name, age and height
| Name | Age | Height |
|---|
XML Data Source Objects n Bind individual fields to XML elements
| Name | Age | Height |
|---|---|---|
." src="https://present5.com/presentation/91d0b9f5f89417a9caf850871bbe9693/image-12.jpg" alt="XML Data Source Objects n Limit size of the table
XML Data Source Objects n Pros ¨ simple ¨ good n for simple, regular, repeated data Cons ¨ non-standard ¨ unable to add to or change documents ¨ bad for complex, rich data
XML and Dynamic HTML n The internal structure of XML data island is exposed to Java. Script ¨ The XML document root is accessed as xmlstuff. XMLDocument ¨ The document. Element component accesses the top level element ¨ child. Nodes. item(n). text accesses the text of the nth sub-element
XML and Dynamic HTML n A Java. Script function can access the contents of any element function xml. Get. Element(n){ return xmlstuff. XMLDocument. document. Element. child. Nodes. item(n). text } n This expression is an example of DOM programming (next lesson)
XML and Dynamic HTML n This can be used for fine-grained control with a template
Now that you are years old you ought to buy a zimmer frame.
XML and Dynamic HTML n By controlling the contents of the positionholding elements
XML and Dynamic HTML n Assuming the data island looks as follows
XML and Dynamic HTML n Pros ¨ very flexible ¨ works with highly irregular data n Cons ¨ non-standard ¨ very time consuming ¨ highly dependent on the structure


