SlideShare a Scribd company logo
Document Object Model (DOM)‏ By  D.Chomaskandar Chipkidz
Outline Introduction of DOM W3C Overview of DOM DOM Examples How the DOM Really works? Advantages and Disadvantages DOM or SAX Summary
Introduction of DOM
Before going to the DOM HTML  –How to Display the Data in the Webpage.  XML  – How to Describe the Data . DHTML - How to Add Movement or Animation to an HTML Document. JAVASCRIPT - How to make Web Content Dynamic.
World Wide Web Consortium-W3C
World Wide Web Consortium-W3C To Promote Open Standard For world wide web. W3C is a vendor Organization. Main Vendors are Netscape and Microsoft. Some W3C Standards are HTTP,HTML,XML,CSS. DOM is also Recommend by W3C.
W3C
Five Basic Levels Of W3C : Recommendation :- It is the Final outcome from W3C.All the Web functions are working properly.  No Error HTML,CSS,DOM
In this layer the work is mostly complete .But some minor changes is occur.  Partial Output Proposed Recommendation :-
Working Document.all Document.all Candidate Recommendation :- Not Working MOZILLA MICROSOFT IE
Working With Current Task. W3C MEMBERS Working Drafts
DOM NEUTRAL - INTERFACE HTML XML JAVA SCRIPT ANY LANGUAGE What is the DOM?
Status Of The DOM
W3C recommendation , 1 Oct. 1998. Interfaces for representing an XML  and HTML document.  1) Document 2)Node 3)Attr 4)Element 5)and Text interfaces. DOM Level 1:
W3C recommendation , 13 Nov. 2000. It contains six different specifications:  1)DOM2 Core 2)Views 3)Events 4)Style 5)Traversal and Range 6)and the DOM2 HTML. DOM Level 2:
W3C candidate recommendation , 7 Nov. 2003 It contains five different specifications: 1)DOM3 Core 2)Load and Save 3) Validation 4)Events 5)and XPath  DOM Level 3:
Overview of DOM
The Document Tree
Referencing Objects -Each Object is Identified by Object Name.
How To Use Referencing Objects Object Names General form is  TO Access The History  To Access The   B ody object1.object2.object3.. window.history document.body
The DOM structure model It is a  Hierarchy of  Node objects   node object Element Attribute etc
The DOM Interface The DOM has many interfaces to handle various node objects. Every interface has its “Attributes” and “Methods”. Compare with Object Oriented Programming (OOP). Method Method Property Attribute Object Class Interface OOP DOM
Document Tree Structure document document.body document. documentElement
child,  sibling, parent
child ,  sibling , parent
child ,  sibling ,  parent
child ,  sibling ,  parent
<Company> <Tenth planet Tech> <Chipkidz> <Hr>Mr. Sakthi</Hr> <Members> <chomas>DOM </chomas> <perumal>SAAS </perumal> </members> </chipkidz> </Tenth planet Tech> ... DOM structure model ID=“BOLD”
DOM NODE Methods
document .firstChild .childNodes[0] .firstChild .parentNode .childNodes[1];
document .getElementById()‏ .getElementByTag()‏ returns a specific element returns an array of elements
Example  for Changing a node  document .getElementById(‘BOLD')‏ .firstChild .nodeValue ='bold bit of text';
Working with Object Collections -The Web Document Display in the window
Working with Object Properties
Example Source Code For Document Method document.body.style.backgroundColor
Examples For Document method <html> <head> <title>Change the Background</title> </head> <body> <script language = &quot;JavaScript&quot;> function background()‏ {  var color =  document.bg.color.value; document.body.style.backgroundColor =color ;  } </script> <form name=&quot;bg&quot;> Type the Color Name:<input type=&quot;text&quot; name=&quot;color&quot; size=&quot;20&quot;><br>  Click the Submit Button to change this Background color as your Color.<br>  <input type=&quot;button&quot; value=&quot;Submit&quot; onClick='background()'> </form> </body> </html>
How To Implement In  The Blogspot
 
Document Object Model
Document Object Model
 
 
NAVIGATOR
NAVIGATOR  :-Some properties are  read-only   - The Browser Itself.
Example Source Code For Navigator Method navigator.appName navigator.appVersion navigator.appCodeName navigator.platform navigator.cookieEnabled
Example For NAVIGATOR  <html><body><script type=&quot;text/javascript&quot;> document.write(&quot;<p>Browser: &quot;); document.write(navigator.appName + &quot;</p>&quot;); document.write(&quot;<p>Browserversion: &quot;); d ocument.write(navigator.appVersion  + &quot;</p>&quot;); document.write(&quot;<p>Code: &quot;); document.write(navigator.appCodeName  + &quot;</p>&quot;); document.write(&quot;<p>Platform: &quot;); document.write(navigator.platform  + &quot;</p>&quot;); document.write(&quot;<p>Cookies enabled: &quot;); document.write(navigator.cookieEnabled  + &quot;</p>&quot;); document.write(&quot;<p>Browser's user agent header: &quot;); document.write(navigator.userAgent  + &quot;</p>&quot;); </script></body></html>
Document Object Model
MOZILLA
Document Object Model
MICROSOFT INTERNET EXPLORER
   
GOOGLE CHORME GOOGLE CHORMEZ  GOOGLE  CHORME
Document Object Model
SOME OTHER METHODS
Document Object Model
How the DOM Really works?
The Relation Graph Web Client side program (e.g.: JavaScript)‏ Web Server side program (e.g.: ASP)‏ Console program (e.g.: C++, Java)‏ Output DOM XML document XML+HTML document
Attributes childNodes nodeName nodeValue firstChild lastChild previousSibling nextSiblin Methods insertBefore replaceChild removeChild appendChild An Example — Most Frequently Used Interface, Node
DOM in Programming Languages Java C++ C# VB.Net, etc.
DOM Advantages & Disadvantages
DOM Advantages & Disadvantages ADVANTAGES Robust API for the DOM tree Relatively simple to modify the data structure and extract data Disadvantages Stores the entire document in memory As Dom was written for any language, method naming conventions don’t follow standard java programming conventions
SAX
SAX - Simple API for XML  Industry-standard API for parsing XML data. Unidirectional. Event-driven.
The History of SAX   Not a W3C recommendation.  Created by members of the xml-dev mailing list, led by David Megginson.  SAX implementations for Java and C++ have been around for a while.  SAX2 is the current API revision .
DOM OR SAX
DOM or SAX DOM Suitable for small documents Easily modify document Memory intensive;Load the complete XML document SAX -  Suitable for large documents; saves significant amounts of memory Only traverse document once, start to end Event driven Limited standard functions.
Some DOM Supporting  Browsers Konqueror Camino Opera Safari
SUMMARY
Summary DOM is a tree representation of an XML document in memory Dom provides a robust API to easily Modify and extract data from an XML document JAXP provides a vendor –neutral interface to the underlying DOM or SAX Parser
References www.w3.org/DOM http://developer.mozilla.org/en/Gecko_DOM_Reference www.corewebprogramming.com http://www.w3schools.com
QUESTIONS ?
[email_address] For more Information http://web2sharing.wordpress.com For any Queries
THANK YOU

More Related Content

What's hot (20)

PPTX
Form Handling using PHP
Nisa Soomro
 
PDF
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
PDF
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
PPTX
jQuery
Dileep Mishra
 
PPTX
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
PPTX
Dom(document object model)
Partnered Health
 
PPT
Php forms
Anne Lee
 
PDF
JavaScript - Chapter 3 - Introduction
WebStackAcademy
 
PPT
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 
PPT
Javascript
mussawir20
 
PPTX
Css selectors
Parth Trivedi
 
PPTX
PHP
Steve Fort
 
PPT
Web Development using HTML & CSS
Shashank Skills Academy
 
PDF
Angular Directives
iFour Technolab Pvt. Ltd.
 
PPTX
Introduction to Javascript By Satyen
Satyen Pandya
 
PDF
Introduction to Javascript
Seble Nigussie
 
PPTX
Form using html and java script validation
Maitree Patel
 
PPT
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
PPTX
Java script
Abhishek Kesharwani
 
PPTX
Document object model
Amit kumar
 
Form Handling using PHP
Nisa Soomro
 
JavaScript - Chapter 8 - Objects
WebStackAcademy
 
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Jquery Complete Presentation along with Javascript Basics
EPAM Systems
 
Dom(document object model)
Partnered Health
 
Php forms
Anne Lee
 
JavaScript - Chapter 3 - Introduction
WebStackAcademy
 
PHP - Introduction to PHP AJAX
Vibrant Technologies & Computers
 
Javascript
mussawir20
 
Css selectors
Parth Trivedi
 
Web Development using HTML & CSS
Shashank Skills Academy
 
Angular Directives
iFour Technolab Pvt. Ltd.
 
Introduction to Javascript By Satyen
Satyen Pandya
 
Introduction to Javascript
Seble Nigussie
 
Form using html and java script validation
Maitree Patel
 
Introduction to JavaScript (1).ppt
MuhammadRehan856177
 
Java script
Abhishek Kesharwani
 
Document object model
Amit kumar
 

Similar to Document Object Model (20)

PDF
Building XML Based Applications
Prabu U
 
PPTX
buildingxmlbasedapplications-180322042009.pptx
NKannanCSE
 
PPTX
Understanding the dom by Benedict Ayiko
Damalie Wasukira
 
PDF
HTML literals, the JSX of the platform
Kenneth Rohde Christiansen
 
PDF
Intro to mobile web application development
zonathen
 
PPTX
Ie9 overview
裕波 周
 
PPT
Processing XML with Java
BG Java EE Course
 
PDF
Markup For Dummies (Russ Ward)
STC-Philadelphia Metro Chapter
 
PPTX
HTML.pptx
vikasmittal92
 
PDF
Rails Girls - Introduction to HTML & CSS
Timo Herttua
 
PDF
Jdom how it works & how it opened the java process
Hicham QAISSI
 
PDF
Html css workshop, lesson 0, how browsers work
Albino Tonnina
 
PPT
Grails Introduction - IJTC 2007
Guillaume Laforge
 
ODP
Moving from Web 1.0 to Web 2.0
Estelle Weyl
 
PPTX
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
Soumen Santra
 
PPT
Decoding the Web
newcircle
 
PPT
Is it time to start using HTML 5
Ravi Raj
 
PDF
lect9
tutorialsruby
 
Building XML Based Applications
Prabu U
 
buildingxmlbasedapplications-180322042009.pptx
NKannanCSE
 
Understanding the dom by Benedict Ayiko
Damalie Wasukira
 
HTML literals, the JSX of the platform
Kenneth Rohde Christiansen
 
Intro to mobile web application development
zonathen
 
Ie9 overview
裕波 周
 
Processing XML with Java
BG Java EE Course
 
Markup For Dummies (Russ Ward)
STC-Philadelphia Metro Chapter
 
HTML.pptx
vikasmittal92
 
Rails Girls - Introduction to HTML & CSS
Timo Herttua
 
Jdom how it works & how it opened the java process
Hicham QAISSI
 
Html css workshop, lesson 0, how browsers work
Albino Tonnina
 
Grails Introduction - IJTC 2007
Guillaume Laforge
 
Moving from Web 1.0 to Web 2.0
Estelle Weyl
 
DYNAMIC HYPERTEXT MARKUP LANGUAGE (DHTML) & CSS WITH Application of JavaScript
Soumen Santra
 
Decoding the Web
newcircle
 
Is it time to start using HTML 5
Ravi Raj
 
Ad

Document Object Model

  • 1. Document Object Model (DOM)‏ By D.Chomaskandar Chipkidz
  • 2. Outline Introduction of DOM W3C Overview of DOM DOM Examples How the DOM Really works? Advantages and Disadvantages DOM or SAX Summary
  • 4. Before going to the DOM HTML –How to Display the Data in the Webpage. XML – How to Describe the Data . DHTML - How to Add Movement or Animation to an HTML Document. JAVASCRIPT - How to make Web Content Dynamic.
  • 5. World Wide Web Consortium-W3C
  • 6. World Wide Web Consortium-W3C To Promote Open Standard For world wide web. W3C is a vendor Organization. Main Vendors are Netscape and Microsoft. Some W3C Standards are HTTP,HTML,XML,CSS. DOM is also Recommend by W3C.
  • 7. W3C
  • 8. Five Basic Levels Of W3C : Recommendation :- It is the Final outcome from W3C.All the Web functions are working properly. No Error HTML,CSS,DOM
  • 9. In this layer the work is mostly complete .But some minor changes is occur. Partial Output Proposed Recommendation :-
  • 10. Working Document.all Document.all Candidate Recommendation :- Not Working MOZILLA MICROSOFT IE
  • 11. Working With Current Task. W3C MEMBERS Working Drafts
  • 12. DOM NEUTRAL - INTERFACE HTML XML JAVA SCRIPT ANY LANGUAGE What is the DOM?
  • 14. W3C recommendation , 1 Oct. 1998. Interfaces for representing an XML and HTML document. 1) Document 2)Node 3)Attr 4)Element 5)and Text interfaces. DOM Level 1:
  • 15. W3C recommendation , 13 Nov. 2000. It contains six different specifications: 1)DOM2 Core 2)Views 3)Events 4)Style 5)Traversal and Range 6)and the DOM2 HTML. DOM Level 2:
  • 16. W3C candidate recommendation , 7 Nov. 2003 It contains five different specifications: 1)DOM3 Core 2)Load and Save 3) Validation 4)Events 5)and XPath DOM Level 3:
  • 19. Referencing Objects -Each Object is Identified by Object Name.
  • 20. How To Use Referencing Objects Object Names General form is TO Access The History To Access The B ody object1.object2.object3.. window.history document.body
  • 21. The DOM structure model It is a Hierarchy of Node objects node object Element Attribute etc
  • 22. The DOM Interface The DOM has many interfaces to handle various node objects. Every interface has its “Attributes” and “Methods”. Compare with Object Oriented Programming (OOP). Method Method Property Attribute Object Class Interface OOP DOM
  • 23. Document Tree Structure document document.body document. documentElement
  • 24. child, sibling, parent
  • 25. child , sibling , parent
  • 26. child , sibling , parent
  • 27. child , sibling , parent
  • 28. <Company> <Tenth planet Tech> <Chipkidz> <Hr>Mr. Sakthi</Hr> <Members> <chomas>DOM </chomas> <perumal>SAAS </perumal> </members> </chipkidz> </Tenth planet Tech> ... DOM structure model ID=“BOLD”
  • 30. document .firstChild .childNodes[0] .firstChild .parentNode .childNodes[1];
  • 31. document .getElementById()‏ .getElementByTag()‏ returns a specific element returns an array of elements
  • 32. Example for Changing a node document .getElementById(‘BOLD')‏ .firstChild .nodeValue ='bold bit of text';
  • 33. Working with Object Collections -The Web Document Display in the window
  • 34. Working with Object Properties
  • 35. Example Source Code For Document Method document.body.style.backgroundColor
  • 36. Examples For Document method <html> <head> <title>Change the Background</title> </head> <body> <script language = &quot;JavaScript&quot;> function background()‏ { var color = document.bg.color.value; document.body.style.backgroundColor =color ; } </script> <form name=&quot;bg&quot;> Type the Color Name:<input type=&quot;text&quot; name=&quot;color&quot; size=&quot;20&quot;><br> Click the Submit Button to change this Background color as your Color.<br> <input type=&quot;button&quot; value=&quot;Submit&quot; onClick='background()'> </form> </body> </html>
  • 37. How To Implement In The Blogspot
  • 38.  
  • 41.  
  • 42.  
  • 44. NAVIGATOR :-Some properties are read-only - The Browser Itself.
  • 45. Example Source Code For Navigator Method navigator.appName navigator.appVersion navigator.appCodeName navigator.platform navigator.cookieEnabled
  • 46. Example For NAVIGATOR <html><body><script type=&quot;text/javascript&quot;> document.write(&quot;<p>Browser: &quot;); document.write(navigator.appName + &quot;</p>&quot;); document.write(&quot;<p>Browserversion: &quot;); d ocument.write(navigator.appVersion + &quot;</p>&quot;); document.write(&quot;<p>Code: &quot;); document.write(navigator.appCodeName + &quot;</p>&quot;); document.write(&quot;<p>Platform: &quot;); document.write(navigator.platform + &quot;</p>&quot;); document.write(&quot;<p>Cookies enabled: &quot;); document.write(navigator.cookieEnabled + &quot;</p>&quot;); document.write(&quot;<p>Browser's user agent header: &quot;); document.write(navigator.userAgent + &quot;</p>&quot;); </script></body></html>
  • 51.    
  • 52. GOOGLE CHORME GOOGLE CHORMEZ GOOGLE CHORME
  • 56. How the DOM Really works?
  • 57. The Relation Graph Web Client side program (e.g.: JavaScript)‏ Web Server side program (e.g.: ASP)‏ Console program (e.g.: C++, Java)‏ Output DOM XML document XML+HTML document
  • 58. Attributes childNodes nodeName nodeValue firstChild lastChild previousSibling nextSiblin Methods insertBefore replaceChild removeChild appendChild An Example — Most Frequently Used Interface, Node
  • 59. DOM in Programming Languages Java C++ C# VB.Net, etc.
  • 60. DOM Advantages & Disadvantages
  • 61. DOM Advantages & Disadvantages ADVANTAGES Robust API for the DOM tree Relatively simple to modify the data structure and extract data Disadvantages Stores the entire document in memory As Dom was written for any language, method naming conventions don’t follow standard java programming conventions
  • 62. SAX
  • 63. SAX - Simple API for XML Industry-standard API for parsing XML data. Unidirectional. Event-driven.
  • 64. The History of SAX Not a W3C recommendation. Created by members of the xml-dev mailing list, led by David Megginson. SAX implementations for Java and C++ have been around for a while. SAX2 is the current API revision .
  • 66. DOM or SAX DOM Suitable for small documents Easily modify document Memory intensive;Load the complete XML document SAX - Suitable for large documents; saves significant amounts of memory Only traverse document once, start to end Event driven Limited standard functions.
  • 67. Some DOM Supporting Browsers Konqueror Camino Opera Safari
  • 69. Summary DOM is a tree representation of an XML document in memory Dom provides a robust API to easily Modify and extract data from an XML document JAXP provides a vendor –neutral interface to the underlying DOM or SAX Parser
  • 70. References www.w3.org/DOM http://developer.mozilla.org/en/Gecko_DOM_Reference www.corewebprogramming.com http://www.w3schools.com
  • 72. [email_address] For more Information http://web2sharing.wordpress.com For any Queries