When marking up text, certain characters or symbols (e.g., <) might be difficult to embed directly into an XHTML document. Some keyboards do not provide these symbols, or the presence of these symbols could cause syntax errors. For example, the markup
if x < 10 then increment x by 1
results in a syntax error, because it uses the less-than character (<), which is reserved for start tags and end tags such as
and
. XHTML provides special characters or entity references (in the form &code;) for representing these characters. We could correct the previous line by writing
if x < 10 then increment x by 1
which uses the special character < for the less-than symbol.
Figure J.7 demonstrates how to use special characters in an XHTML document. For a list of special characters, see Appendix K. Lines 2627 contain other special characters, which are expressed either as word abbreviations (e.g., & for ampersand and © for copyright) or as hexadecimal values (e.g., & is the hexadecimal representation of &). Hexadecimal numbers are base-16 numbersdigits in a hexadecimal number have values from 0 to 15 (a total of 16 different values). The letters AF represent the hexadecimal digits corresponding to decimal values 1015. Thus, in hexadecimal notation, we can have numbers like 876 consisting solely of decimal-like digits, numbers like DA19F consisting of digits and letters, and numbers like DCB consisting solely of letters. We discuss hexadecimal numbers in detail in Appendix D.
Figure J.7. Inserting special characters into XHTML.
(This item is displayed on pages 1338 - 1339 in the print version)
"http://www.w3.org/1999/xhtml"> 9 10
1 "1.0"?> 2 "-//W3C//DTD XHTML 1.1//EN" 3 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 4 5 6 7 8 |
Inserting special characters 11 12 13 | 14 15 16 17
18 Click 19 <a href="</span"> "mailto:deitel@deitel.com">here 20 </a> to open an e-mail message addressed to 21 deitel@deitel.com. 22 23 2425 26 All information on this site is © 27 Deitel & Associates, Inc. 2005. 28 29 30 31 32 33
Note: < ¼ of the information 38 presented here is updated daily. 39 40 41 |
In lines 3335, we introduce three new elements. Most browsers render the del element as strike-through text. With this format, users can easily indicate document revisions. To superscript text (i.e., raise text on a line with a decreased font size) or subscript text (i.e., lower text on a line with a decreased font size), use the sup and sub elements, respectively. We also use special characters < for a less-than sign and ¼ for the fraction 1/4 (line 37).
In addition to special characters, this document introduces a horizontal rule, indicated by the
tag in line 24. Most browsers render a horizontal rule as a horizontal line. The
tag also inserts a line break above and below the horizontal line.
Introduction to Computers, the Internet and World Wide Web
Introduction to C++ Programming
Introduction to Classes and Objects
Control Statements: Part 1
Control Statements: Part 2
Functions and an Introduction to Recursion
Arrays and Vectors
Pointers and Pointer-Based Strings
Classes: A Deeper Look, Part 1
Classes: A Deeper Look, Part 2
Operator Overloading; String and Array Objects
Object-Oriented Programming: Inheritance
Object-Oriented Programming: Polymorphism
Templates
Stream Input/Output
Exception Handling
File Processing
Class string and String Stream Processing
Web Programming
Searching and Sorting
Data Structures
Bits, Characters, C-Strings and structs
Standard Template Library (STL)
Other Topics
Appendix A. Operator Precedence and Associativity Chart
Appendix B. ASCII Character Set
Appendix C. Fundamental Types
Appendix D. Number Systems
Appendix E. C Legacy Code Topics
Appendix F. Preprocessor
Appendix G. ATM Case Study Code
Appendix H. UML 2: Additional Diagram Types
Appendix I. C++ Internet and Web Resources
Appendix J. Introduction to XHTML
Appendix K. XHTML Special Characters
Appendix L. Using the Visual Studio .NET Debugger
Appendix M. Using the GNU C++ Debugger
Bibliography