| Acknowledgments | xvii |
| Introduction | xix |
| Part I | Overview of the W3C Document Object Model | |
| Chapter 1 | Introduction to the DOM | 3 |
| What Is the Document Object Model? | 4 |
| The DOM Philosophy | 6 |
| Yet Another Standard? | 6 |
| Design Philosophy | 7 |
| Object-Oriented vs. Flat Views of the DOM Interfaces | 7 |
| History of the DOM | 8 |
| The DOM on the Client | 8 |
| The DOM on the Server | 9 |
| Levels of the DOM | 9 |
| Level 1 | 10 |
| Level 2 | 11 |
| Level 3 | 12 |
| Conventions Used in the DOM Specification | 12 |
| What the DOM Isn't | 14 |
| Conclusion | 15 |
| Chapter 2 | How the DOM Represents Structured Documents | 17 |
| Basic DOM Data Types | 18 |
| The DOMString Type | 18 |
| The DOMTimeStamp Type | 19 |
| Handling Errors: The DOMException Interface | 19 |
| The Document Tree Structure | 20 |
| DOM Node Types | 22 |
| The Fundamental Core DOM Interfaces | 24 |
| DOMException Codes | 25 |
| The DOM Node Interface | 26 |
| Node Helper Interfaces: NodeList and NamedNodeMap | 31 |
| The DOMImplementation Interface | 33 |
| The Document Interface | 34 |
| The DocumentFragment Interface | 37 |
| The Element Interface | 37 |
| The Attr Interface | 40 |
| The CharacterData Interface | 41 |
| The Comment Interface | 43 |
| The Text Interface | 43 |
| The Extended Core Interfaces | 44 |
| CDATASection Interface | 44 |
| DocumentType Interface | 44 |
| Notation Interface | 45 |
| Entity Interface | 46 |
| EntityReference Interface | 46 |
| ProcessingInstruction Interface | 46 |
| Conclusion | 47 |
| Chapter 3 | Navigating and Manipulating Structured Documents | 49 |
| Working with Nodes | 50 |
| A Word About Namespaces | 51 |
| Obtaining Object References to Nodes | 52 |
| Inspecting Nodes | 53 |
| Manipulating Nodes | 56 |
| Creating New Nodes | 62 |
| Importing Nodes from Other Documents | 65 |
| Traversing Documents | 67 |
| Using the Node Interface Properties | 67 |
| Using the DOM Level 2 Traversal Module | 68 |
| Conclusion | 84 |
| Part II | Real-World DOM | |
| Chapter 4 | Algorithms | 87 |
| DOM Algorithms | 88 |
| Basic Node Traversal Algorithms | 88 |
| Position-Based Algorithms | 91 |
| Determining Whether a Node Has an Ancestor of a Given Type | 91 |
| Determining Whether a Node Has a Sibling of a Given Type | 92 |
| Content-Based Algorithms | 93 |
| Determining Whether a Node Contains Another Node | 93 |
| Better Versions of Node Interfaces: Retrieving Relative Nodes by Type | 95 |
| Finding a Node by Attribute Value | 97 |
| Conclusion | 99 |
| Chapter 5 | Browsers | 101 |
| DOM Support in the Major Browsers | 102 |
| Microsoft Internet Explorer 6 | 103 |
| Netscape Navigator 6.x | 103 |
| Opera 6 | 104 |
| Using the DOM in a Browser Environment | 104 |
| Obtaining a Reference to the Document | 105 |
| Examining the Structure and Content of a Page | 106 |
| Creating and Modifying Page Elements | 110 |
| Handling Events with the DOM Level 2 Events Interface | 116 |
| Internet Explorer--Specific Methods and Properties | 127 |
| Internet Explorer--Specific Properties | 127 |
| Internet Explorer--Specific Methods | 128 |
| Browser Quirks | 129 |
| Internet Explorer | 130 |
| Netscape Navigator | 130 |
| Conclusion | 130 |
| Chapter 6 | Applications | 133 |
| DOM Implementations Aren't Just for Browsers | 134 |
| Standalone vs. Embedded DOM Implementations | 135 |
| The Apache Xerces Parser | 135 |
| Where to Get Xerces | 136 |
| Installing Xerces | 137 |
| Getting to Know the API | 139 |
| Using Xerces | 141 |
| Where to Get More Information About Xerces | 152 |
| The Microsoft MSXML Parser | 152 |
| Where to Get MSXML4 | 152 |
| Installing MSXML4 | 152 |
| Getting to Know the API | 153 |
| Using MSXML4 | 153 |
| Where to Get More Information About MSXML | 159 |
| Macromedia Dreamweaver | 159 |
| Where to Get Dreamweaver | 159 |
| The DOM in Dreamweaver | 159 |
| Getting to Know the API | 160 |
| Using the Dreamweaver DOM | 162 |
| Where to Get More Information About the Dreamweaver DOM | 167 |
| Conclusion | 167 |
| Chapter 7 | Debugging DOM Applications | 169 |
| Importance of Good Debugging Skills | 170 |
| Be Assertive: Use ASSERT() | 171 |
| Defining ASSERT() | 171 |
| Using ASSERT() Effectively | 173 |
| Getting Fancy with ASSERT() | 177 |
| Tracing Your Steps with TraceConsole | 179 |
| Using the TraceConsole | 181 |
| The TraceConsole Functions | 182 |
| The DOMDumper | 192 |
| DOMDumper Output | 193 |
| DOMDumper Code | 195 |
| Using the DOMDumper | 198 |
| Conclusion | 201 |
| Part III | Practical Uses of the DOM | |
| Chapter 8 | Providing Automatic Document Navigation | 205 |
| Using the DOM to Provide Better Document Navigation | 206 |
| Example: On-the-Fly Bookmarks | 207 |
| Setting Up | 210 |
| Creating the User Interface Elements | 211 |
| Building the Bookmark List | 212 |
| Inserting the Bookmark List into the Document | 213 |
| Responding to the User's Bookmark Selection | 214 |
| Example: Automatic Table of Contents | 215 |
| Setting Up | 218 |
| Scanning the Document's Nodes | 219 |
| Building a TOC Destination | 219 |
| Adding the TOC Entry | 220 |
| Example: Document Placeholders | 221 |
| Setting Up | 224 |
| Handling Click Events | 225 |
| Finding a Containing Paragraph Node | 226 |
| Conclusion | 227 |
| Chapter 9 | Dynamic User Interfaces | 229 |
| Building Dynamic User Interfaces with the DOM | 230 |
| Creating a Color Picker | 231 |
| In-Place List Editing | 238 |
| DOM-Based Pop-up Menus | 246 |
| Conclusion | 254 |
| Chapter 10 | Client Processing of Data-Driven Documents | 255 |
| Processing Data-Driven Documents on the Client | 256 |
| Client-Side Sorting | 257 |
| Sorting a List | 257 |
| Sorting a Table | 263 |
| Post-Processing Server-Generated Documents | 271 |
| Working with Embedded XML Data in Web Pages | 275 |
| Data Islands in Internet Explorer | 276 |
| Data Islands in Netscape Navigator | 281 |
| Example: Joe's Cafe Menu Application | 283 |
| The Menu Page | 283 |
| The Menu XML Code | 285 |
| Generating the Menu HTML | 287 |
| Handling User Interaction | 295 |
| Conclusion | 299 |
| Chapter 11 | Future Directions for the DOM | 301 |
| Where Is the DOM Headed? | 302 |
| Proposed Changes in DOM Level 3 | 303 |
| General Changes | 303 |
| Abstract Schema Support | 307 |
| Error Handling | 308 |
| Loading and Saving DOM Documents | 309 |
| Attaching Application-Specific Data to Nodes | 313 |
| Determining Relative Document Positions of Nodes | 316 |
| XPath Support | 318 |
| Other Potential Future DOM Enhancements | 326 |
| XSLT Support in the DOM | 326 |
| Transaction-Oriented Processing | 332 |
| Conclusion | 334 |
| Appendix | DOM Core Level 1 API Reference | 337 |
| DOM Interface Inheritance Tree | 338 |
| Interface Attr | 338 |
| Properties | 339 |
| Methods | 339 |
| Interface CDATA | 339 |
| Properties | 340 |
| Methods | 340 |
| Interface CharacterData | 340 |
| Properties | 340 |
| Methods | 341 |
| Interface Comment | 343 |
| Properties | 343 |
| Methods | 343 |
| Interface Document | 343 |
| Properties | 343 |
| Methods | 344 |
| Interface DocumentFragment | 347 |
| Properties | 347 |
| Methods | 347 |
| Interface DocumentType | 347 |
| Properties | 348 |
| Methods | 348 |
| Interface DOMImplementation | 348 |
| Properties | 349 |
| Methods | 349 |
| Interface DOMException | 349 |
| Constants | 349 |
| Properties | 350 |
| Methods | 350 |
| Interface Element | 350 |
| Properties | 350 |
| Methods | 350 |
| Interface Entity | 353 |
| Properties | 353 |
| Methods | 354 |
| Interface EntityReference | 354 |
| Properties | 354 |
| Methods | 354 |
| Interface NamedNodeMap | 354 |
| Properties | 355 |
| Methods | 355 |
| Interface Node | 356 |
| Constants | 357 |
| Properties | 357 |
| Methods | 359 |
| Interface NodeList | 361 |
| Properties | 361 |
| Methods | 362 |
| Interface Natation | 362 |
| Properties | 362 |
| Methods | 363 |
| Interface ProcessingInstruction | 363 |
| Properties | 363 |
| Methods | 363 |
| Interface Text | 363 |
| Properties | 364 |
| Methods | 364 |
| Index | 365 |