Let’s take a look at some of the methods and properties that help you access and manipulate this information, often called Walking The DOM.
In general, you can get the number of children belonging to a particular element by using the childNodes .length property of the object.Because <race> is the document element, it is at the top of the object hierarchy, and we can refer to it simply with the variable myxmlDoc:
We can also determine information about individual children by appending the node number in parentheses:
The preceding line refers to the first <yacht> element appearing in the document.
We can test for the presence of children for a particular element by using the hasChildNodes() method
This line returns true because the second yacht in the document has three children (with tag names name, skipper, and helm). However,
returns false because the <name> element within that <yacht> element has no children.
The tagname property allows you to find the tagname associated with a particular element:
The preceding line returns skipper.
Getting Element Attributes
The method getAttribute(“AttributeName”) can be used to return the attribute values for a given element:
This line returns 74.
The text property can be used to return the contents of a particular element.The line
would return Walter Jeffries.
AJAX Related Interview Questions
|XML Interview Questions||HTML Interview Questions|
|Java Script Interview Questions||Android Interview Questions|
|CSS Interview Questions||Web Developer Guide Interview Questions|
|XSLT Interview Questions||Java XML Interview Questions|
|XML DOM Interview Questions|
Anatomy Of A Website
Writing Web Pages In Html
Sending Requests Using Http
Server-side Programming In Php
A Brief Introduction To Xml
Anatomy Of An Ajax Application
The Xmlhttprequest Object
Talking With The Server
Using The Returned Data
Our First Ajax Application
Returning Data As Text
Ahah-asynchronous Html And Http
Returning Data As Xml
Web Services And The Rest Protocal
Web Services Using Saop
The Prototype.js Toolkit
Using Xoad 193
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.