TAILIEUCHUNG - XML Step by Step- P21

XML Step by Step- P21:Extensible Markup Language, or XML, is currently the most promising language for storing and exchanging information on the World Wide Web. Although Hypertext Markup Language (HTML) is presently the most common language used to create Web pages, HTML has a limited capacity for storing information. In contrast, because XML allows you to create your own elements, attributes, and document structure, you can use it to describe virtually any kind of information from a simple recipe to a complex database | Chapter 11 Displaying XML Documents Using Document Object Model Scripts 371 childNodes is a property of the Element node for the root element. It contains a collection of all the nonattribute child nodes of the root Element node. In this example it contains the Element nodes for the five child XML elements TITLE AUTHOR BINDING PAGES and PRICE. The expression childNodes 0 references the first of these child nodes the one for the TITLE element . note In the example page Listing 11-3 you could use the expression 2 to obtain the Element node for the root element. 0 is the node for the XML declaration and 1 is the node for the comment. However an advantage of using the Document node s documentElement property is that its value doesn t depend on the position of the root element within the XML document. For example if you were to remove the comment at the beginning of the document or if you were to add a document type declaration 2 would no longer represent the root element. text is a property of the Element node returned by childNodes 0 . It provides the complete text content of this node as well as the text belonging to any descendent Element nodes it might have. In this example TITLE has no descendent elements so text contains only TITLE s own text The Adventures of Huckleberry Finn. note The childNodes and text properties are among the common node properties given in Table 11-2. Document Object Model Scripts 11 372 XML Step by Step Document node property Description Example async Assigning false to the false async property causes a subsequent call to the load method described later in the table to load the XML document synchronously that is the call won t return until the document is fully loaded . The default property value is true. doctype The DocumentType node representing the document type declaration DocumentType documentElement The Element node .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU LIÊN QUAN
19    16    0
182    13    0
138    6    0
3    7    0
142    12    0