XML Step by Step- P12 doc

15 241 0
XML Step by Step- P12 doc

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Chapter 7 Creating Valid XML Documents Using XML Schemas 191 7 XML Schemas <TITLE>The Legend of Sleepy Hollow</TITLE> <AUTHOR> <FIRSTNAME>Washington</FIRSTNAME> <LASTNAME>Irving</LASTNAME> </AUTHOR> <BINDING>mass market paperback</BINDING> <PAGES FrontMatter=”6">98</PAGES> <PRICE>2.95</PRICE> <PUBLISH_DATE>1973-06</PUBLISH_DATE> <ISBN>9-9999-9999-9</ISBN> </BOOK> <BOOK InStock=”true”> <TITLE>The Marble Faun</TITLE> <AUTHOR Born=”1804"> <FIRSTNAME>Nathaniel</FIRSTNAME> <LASTNAME>Hawthorne</LASTNAME> </AUTHOR> <BINDING>trade paperback</BINDING> <PAGES>473</PAGES> <PRICE>10.95</PRICE> <ISBN>9-9999-9999-9</ISBN> </BOOK> <BOOK InStock=”false”> <TITLE>Moby-Dick <SUBTITLE>Or, the Whale</SUBTITLE></TITLE> <AUTHOR Born=”1819"> <FIRSTNAME>Herman</FIRSTNAME> <LASTNAME>Melville</LASTNAME> </AUTHOR> <BINDING>hardcover</BINDING> <PAGES FrontMatter=”20">724</PAGES> <PRICE>9.95</PRICE> <PUBLISH_DATE>2001-06</PUBLISH_DATE> <ISBN>9-9999-9999-9</ISBN> </BOOK> <BOOK InStock=”true”> <TITLE>The Portrait of a Lady</TITLE> <AUTHOR> <FIRSTNAME>Henry</FIRSTNAME> <LASTNAME>James</LASTNAME> </AUTHOR> <BINDING>mass market paperback</BINDING> <PAGES FrontMatter=”8">256</PAGES> PART 3 Displaying XML Documents on the Web [...]... element of an XML document: 206 XML Step by Step Referencing Namespaces If an element name in the XML document contains an explicit namespace prefix, you must include that prefix in the selector of a CSS rule used to format that element Namespaces are covered in “Using Namespaces” on page 69 Consider, for instance, the example XML document given in Listing 3-5 (Collection Default .xml) This document includes... Chapter 8 Displaying XML Documents Using Basic Cascading Style Sheets 209 later in the file take precedence over those in a style sheet imported previously For more information on precedence, see “Cascading in Cascading Style Sheets” later in this chapter The Second Step: Linking the Style Sheet to the XML Document To link a cascading style sheet to an XML document, you insert the reserved xml- stylesheet... the same name but are in different default namespaces (or to two elements, one of which is in a default namespace and the other in no namespace) 208 XML Step by Step tip For a valid XML document, you need to declare the STYLE attribute in the DTD or XML schema before you can use the attribute In a DTD, you should declare it as in the following example attribute-list declaration (for a TITLE element):...Chapter 8 Displaying XML Documents Using Basic Cascading Style Sheets 203 Case insensitivity in cascading style sheets has an important implication for XML Because XML documents are case-sensitive, you can normally have two distinct element types whose names vary only in case, such as Book and... if you intend to display your XML document using a cascading style sheet, you should not have element types whose names vary only in the case of one or more letters Inheritance of Property Settings In general, a property setting that you assign to a particular element (such as BOOK) affects all child elements nested directly or indirectly within it, unless it’s overridden by a different setting made... document, you insert the reserved xml- stylesheet processing instruction into the document This processing instruction has the following general form, where CSSFilePath is a quoted URL indicating the location of the style sheet file: < ?xml- stylesheet type=”text/css” href=CSSFilePath?> You can use a fully qualified URL, such as this: < ?xml- stylesheet type=”text/css” href=”http://www.mjyOnline.com/Inventory01.css”?>... background-position), described in “Setting Background Properties” later in this chapter 8 I The display property, discussed in “Setting the Display Property” later in this chapter Chapter 8 Displaying XML Documents Using Basic Cascading Style Sheets 205 Using Contextual Selectors In a selector, you can preface the element type name with the names of one or more ancestor elements (the parent, the parent... however, are exceptions and are not inherited by child elements: I The vertical-align and text-decoration properties, explained in “Setting Text Spacing and Alignment Properties” later in this chapter I The box properties, covered in “Setting Box Properties” in Chapter 9 For instance, the example style sheet in Listing 8-1 formats the BOOK elements (in the document in Listing 8-2) like this: BOOK {display:block;... (Pseudo-elements are discussed in “Using Pseudo-Elements” in Chapter 9.) The following are two limitations on accessing namespaces from a CSS: I The namespace prefix must be declared within the start-tag of the XML document’s root element A CSS won’t recognize a namespace prefix that’s declared within a descendent element of the root element I If an element is within the scope of a default namespace and its name... incorporate one or more other style sheets The option of importing separate style sheets allows you to store related style rules in separate files, and then combine them as needed for particular types of documents Here’s the general form of the @import directive, where StyleSheetURL is the fully qualified or relative URL of the file containing the cascading style sheet that you want to import: @import . you must complete the following two basic steps: 1 Create the style sheet file. 2 Link the style sheet to the XML document. 198 XML Step by Step The First Step: Creating the Style Sheet File A cascading. and edit each document. Basic Cascading Style Sheets CHAPTER 8 196 XML Step by Step Creating and linking a cascading style sheet is probably the simplest method for displaying an XML document. The. namespace and the other in no namespace). 208 XML Step by Step tip For a valid XML document, you need to declare the STYLE attribute in the DTD or XML schema before you can use the attribute.

Ngày đăng: 03/07/2014, 07:20

Mục lục

    00000___07be008c8276e95dbbf4cdee2cdf4385

    00002___79c277462295ccdeedc24e5b50330987

    00003___7e0229f16eefad21c64fe455ba7840d5

    00004___a933fe67c82b988d8a19eb1cf4460489

    00005___c78cce8114aad80865103a642f927492

    00006___05fca2542d7816c3088c08cb5a953c52

    00007___dbcd3471236536641cfe07a8b300c340

    00008___51a230a8ae343e365423c24fc4c892b8

    00011___81cd371e1c1bacf76929df14a6b72ecd

    00012___fa71951b85f2335bba3707db9c9945c3

Tài liệu cùng người dùng

Tài liệu liên quan