Chapter 5:  DOM Reference




Download 2,96 Mb.
Pdf ko'rish
bet103/131
Sana14.05.2024
Hajmi2,96 Mb.
#232039
1   ...   99   100   101   102   103   104   105   106   ...   131
Bog'liq
Ceponkus, Hoodbhoy - Applied XML - Toolkit for Programmers

Chapter 5:
 DOM Reference
Overview
In the 
preceding chapter
, we discussed why the DOM is used and from which 
environments it can be used. We also talked briefly about of the various nodes present. 
In this chapter, we drill down into the details of these various nodes. A description of 
node properties and methods is presented, including sample code in JavaScript. A 
scripting language is used in the examples because scripting languages are easier to 
follow. Also, while most developers who write in C++ or Java are able to follow 
JavaScript, the reverse isn’t necessarily true. The script examples are all HTML that run 
under Internet Explorer 5, because, at the time of writing, Internet Explorer 5 was the only 
browser that provided support for the DOM. This chapter should be read somewhat like a 
reference, where a quick glance at the method descriptions and sample code reveals 
most of the usage of the different DOM nodes.
The nodes that are most commonly used when working with the DOM are Document, 
Element, and Attribute because they directly represent a construct found in an XML 
document. Nodes that are essential, but that do not represent XML syntax constructs, are 
Text, CDATASection, NodeList and NamedNodeMap. These seven nodes are presented 
first, followed by the remaining nodes.
Appendix A
contains a concise reference of the methods and properties of each node.
At first, the plethora of methods and properties for each node type might seem a little 
daunting. We’ve added sample code to the descriptions to illustrate the most commonly 
used methods and properties. Some methods might seem redundant, and others might 
seem plain old useless. On top of that, some methods that people would have liked to see 
may have be omitted from the specification altogether. By and large, these inconsistencies 
occurred because the W3C DOM committee is made up of industry players who 
occasionally have conflicting perspectives for the use of the DOM. That being said, we’ve 
included 
all
the DOM methods and properties for the sake of thoroughness. As you read 
through this chapter, keep in mind that the usage of some of these methods is open to your 
own interpretation.

Download 2,96 Mb.
1   ...   99   100   101   102   103   104   105   106   ...   131




Download 2,96 Mb.
Pdf ko'rish