SlideShare uma empresa Scribd logo
1 de 6
DOM Specifics CIS-189 9/29/2009
DocumentElement: provides access to root element References an Element Node In XHTML will refer to <html> element CreateElement(tagName): Create a new element node with given tag name Creating an element doesn’t add it to document, must be appended: oDoc.documentElement.appendChild(oDoc.createElement(“Tests”)) Document InterfaceCommon Members Note:“oDoc” is a document object 9/29/2009
CreateTextNode(value): Create a text node using the argument as the specified value oElement = oDoc.createElement(“DueDate”) oElement.appendChild(oDoc.createTextNode(“10/5/2009”) oDoc.documentElement.appendChild(oElement) Creates an element node with the text node having specific date Document InterfaceCommon Members – 2 9/29/2009
CreateAttribute(attributeName):  Create an attribute with specified name oAttrib = oDoc.CreateAttribute(“Sequence”) oAttrib.Value = “2” Create attribute Sequence with value = 2 GetElementsByTagName(tagName): Returns all elements with specified name as a NodeList (similar to an array or collection) varProjectNodes = oDoc.getElementsByTagName(“Project”) Get all project nodes Document InterfaceCommon Members - 3 9/29/2009
Properties Attributes Parent Node Child Nodes First Child Last Child Previous Sibling Next Sibling Node Name Node Type Methods HasChildNodes() AppendChild() CloneNode() InsertBefore() RemoveChild() ReplaceChild() Node InterfaceCommon Members 9/29/2009
Attributes returns a namedNodeMap that contains all attributes of an Element node oDoc.getElementsByTagName(“Assignment”)[0].Attributes Get Attributes of first assignment element ParentNode provides access to node that “owns” current node oDoc.getElementsByTagName(“Assignment”)[0].parentNode Get parent of first Assignment element ChildNodes returns children of current node oDoc.getElementsByTagName(“Project”)[0].childNodes Returns list of nodes found in first projects node Node Interface Examples 9/29/2009

Mais conteúdo relacionado

Semelhante a DOM specifics

java API for XML DOM
java API for XML DOMjava API for XML DOM
java API for XML DOM
Surinder Kaur
 
Ado.net session13
Ado.net session13Ado.net session13
Ado.net session13
Niit Care
 

Semelhante a DOM specifics (20)

Url&doc html
Url&doc htmlUrl&doc html
Url&doc html
 
DOM and Events
DOM and EventsDOM and Events
DOM and Events
 
java API for XML DOM
java API for XML DOMjava API for XML DOM
java API for XML DOM
 
Automating Ievb
Automating IevbAutomating Ievb
Automating Ievb
 
Xml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh malothXml dom & sax by bhavsingh maloth
Xml dom & sax by bhavsingh maloth
 
Web 6 | JavaScript DOM
Web 6 | JavaScript DOMWeb 6 | JavaScript DOM
Web 6 | JavaScript DOM
 
INTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREEINTRODUCTION TO DOM AND DOM TREE
INTRODUCTION TO DOM AND DOM TREE
 
C# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slidesC# Tutorial MSM_Murach chapter-22-slides
C# Tutorial MSM_Murach chapter-22-slides
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
DOM Quick Overview
DOM Quick OverviewDOM Quick Overview
DOM Quick Overview
 
6867389.ppt
6867389.ppt6867389.ppt
6867389.ppt
 
6867389.ppt
6867389.ppt6867389.ppt
6867389.ppt
 
6867389 (1).ppt
6867389 (1).ppt6867389 (1).ppt
6867389 (1).ppt
 
Dom
Dom Dom
Dom
 
All you need to know about Kotlin's documentation engine Dokka
All you need to know about Kotlin's documentation engine Dokka All you need to know about Kotlin's documentation engine Dokka
All you need to know about Kotlin's documentation engine Dokka
 
FYBSC IT Web Programming Unit III Document Object
FYBSC IT Web Programming Unit III  Document ObjectFYBSC IT Web Programming Unit III  Document Object
FYBSC IT Web Programming Unit III Document Object
 
Document object model
Document object modelDocument object model
Document object model
 
Dom structure
Dom structure Dom structure
Dom structure
 
Ado.net session13
Ado.net session13Ado.net session13
Ado.net session13
 
Live session 2 lightning web component
Live session 2 lightning web componentLive session 2 lightning web component
Live session 2 lightning web component
 

Mais de Randy Riness @ South Puget Sound Community College

Mais de Randy Riness @ South Puget Sound Community College (20)

Stored procedures
Stored proceduresStored procedures
Stored procedures
 
3 sql overview
3 sql overview3 sql overview
3 sql overview
 
Normalization
NormalizationNormalization
Normalization
 
CIS160 final review
CIS160 final reviewCIS160 final review
CIS160 final review
 
SQL Constraints
SQL ConstraintsSQL Constraints
SQL Constraints
 
CIS 245 Final Review
CIS 245 Final ReviewCIS 245 Final Review
CIS 245 Final Review
 
CIS145 Final Review
CIS145 Final ReviewCIS145 Final Review
CIS145 Final Review
 
Cis166 Final Review C#
Cis166 Final Review C#Cis166 Final Review C#
Cis166 Final Review C#
 
Classes and Objects
Classes and ObjectsClasses and Objects
Classes and Objects
 
CIS245 sql
CIS245 sqlCIS245 sql
CIS245 sql
 
Cis245 Midterm Review
Cis245 Midterm ReviewCis245 Midterm Review
Cis245 Midterm Review
 
CSS
CSSCSS
CSS
 
XPath
XPathXPath
XPath
 
XSLT Overview
XSLT OverviewXSLT Overview
XSLT Overview
 
Views
ViewsViews
Views
 
CIS282 Midterm review
CIS282 Midterm reviewCIS282 Midterm review
CIS282 Midterm review
 
Schemas 2 - Restricting Values
Schemas 2 - Restricting ValuesSchemas 2 - Restricting Values
Schemas 2 - Restricting Values
 
CIS 145 test 1 review
CIS 145 test 1 reviewCIS 145 test 1 review
CIS 145 test 1 review
 
XML schemas
XML schemasXML schemas
XML schemas
 
Document type definitions part 2
Document type definitions part 2Document type definitions part 2
Document type definitions part 2
 

Último

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

DOM specifics

  • 2. DocumentElement: provides access to root element References an Element Node In XHTML will refer to <html> element CreateElement(tagName): Create a new element node with given tag name Creating an element doesn’t add it to document, must be appended: oDoc.documentElement.appendChild(oDoc.createElement(“Tests”)) Document InterfaceCommon Members Note:“oDoc” is a document object 9/29/2009
  • 3. CreateTextNode(value): Create a text node using the argument as the specified value oElement = oDoc.createElement(“DueDate”) oElement.appendChild(oDoc.createTextNode(“10/5/2009”) oDoc.documentElement.appendChild(oElement) Creates an element node with the text node having specific date Document InterfaceCommon Members – 2 9/29/2009
  • 4. CreateAttribute(attributeName): Create an attribute with specified name oAttrib = oDoc.CreateAttribute(“Sequence”) oAttrib.Value = “2” Create attribute Sequence with value = 2 GetElementsByTagName(tagName): Returns all elements with specified name as a NodeList (similar to an array or collection) varProjectNodes = oDoc.getElementsByTagName(“Project”) Get all project nodes Document InterfaceCommon Members - 3 9/29/2009
  • 5. Properties Attributes Parent Node Child Nodes First Child Last Child Previous Sibling Next Sibling Node Name Node Type Methods HasChildNodes() AppendChild() CloneNode() InsertBefore() RemoveChild() ReplaceChild() Node InterfaceCommon Members 9/29/2009
  • 6. Attributes returns a namedNodeMap that contains all attributes of an Element node oDoc.getElementsByTagName(“Assignment”)[0].Attributes Get Attributes of first assignment element ParentNode provides access to node that “owns” current node oDoc.getElementsByTagName(“Assignment”)[0].parentNode Get parent of first Assignment element ChildNodes returns children of current node oDoc.getElementsByTagName(“Project”)[0].childNodes Returns list of nodes found in first projects node Node Interface Examples 9/29/2009