Presentation is loading. Please wait.

Presentation is loading. Please wait.

Document Object Model (DOM): An Abstract Data Structure for XML data Alex Dekhtyar Department of Computer Science CSC 560: Management of XML Data.

Similar presentations


Presentation on theme: "Document Object Model (DOM): An Abstract Data Structure for XML data Alex Dekhtyar Department of Computer Science CSC 560: Management of XML Data."— Presentation transcript:

1 Document Object Model (DOM): An Abstract Data Structure for XML data Alex Dekhtyar Department of Computer Science CSC 560: Management of XML Data

2 Trees for XML Alexander M. Dekhtyar Computer Science Spring 2007 CS405 Database systems faculty name dept course

3 Trees for XML Alexander M. Dekhtyar Computer Science Spring 2007 CS405 Database systems faculty name dept course last firstmiddle Id=“27” sem title code origin=“Ukraine” Alexander Spring 2007 M. Dekhtyar Computer Science CS 405 Database Systems

4 Trees for XML Alexander M. Dekhtyar Computer Science Spring 2007 CS405 Database systems faculty name dept course last firstmiddle Id=“27” sem title code origin=“Ukraine” Alexander Spring 2007 M. Dekhtyar Computer Science CS 405 Database Systems name - Element node Computer Science - Text node Id=“27” - Attribute node faculty - Root node

5 Document Object Model  Abstract Data Type  Object-oriented  System of types/interfaces  Attributes  Methods

6 Functionality faculty name dept course last firstmiddle Id=“27” sem title code origin=“Ukraine” Alexander Spring 2007 M. Dekhtyar Computer Science CS 405 Database Systems Creation of nodes Insertion of nodes in into the DOM Tree Traversal of the DOM Tree

7 DOM Type Structure interface Node interface Element interface Attr interface Document interface DocumentType interface Comment interface DocumentType interface CDATASection … and a few more subtypesubtype interface NodeList list of interface NamedNodeMap set of interface CharacterData interface Text

8 interface Node DOMString nodeName DOMString nodeValue short nodeType Node parentNode NodeList childNodes Node firstChild Node lastChild Node previousSibling Node nextSibling NamedNodeMap attributes Document ownerDocument faculty name first origin=“Ukraine” dept document middle

9 Node Types interface Node interface Element interface Attr interface Document interface DocumentType interface Comment interface Text interface Entity interface CDATASection … and a few more subtypesubtype nodeType 9 1 2 10 8 3 6 4 (12 nodetypes altogether) nodeNamenodeValue Tag null AttName AttValue #text content

10 interface Node methods insertBefore Node insertBefore(in Node newChild, in Node refChild) replaceChild Node replaceChild(in Node newChild, in Node oldChild) removeChild Node removeChild(in Node oldChild) appendChild Node appendChild(in Node newChild) hasChildNodes boolean hasChildNodes() cloneNode Node cloneNode(in boolean deep)

11 DOM Type Structure interface Node interface Element interface Attr interface Document interface DocumentType interface Comment interface CharacterData interface DocumentType interface CDATASection … and a few more subtypesubtype interface NodeList list of interface NamedNodeMap set of interface Text

12 interface Document Attributes DocumentType doctype Element documentElement Methods document DTD doctype root Element createElement(in DOMString tagName) DocumentFragment createDocumentFragment() Text createTextNode(in DOMString data) Comment createComment(in DOMString data) CDATASection createCDATASection(in DOMString data) Attr createAttribute(in DOMString name) NodeList getElementsByTagName(in DOMString tagname)

13 DOM Type Structure interface Node interface Element interface Attr interface Document interface DocumentType interface Comment interface DocumentType interface CDATASection … and a few more subtypesubtype interface NodeList list of interface NamedNodeMap set of interface CharacterData interface Text

14 interface Element interface Element : Node { DOMString tagName; getAttribute DOMString getAttribute(in DOMString name); setAttribute void setAttribute(in DOMString name, in DOMString value) removeAttribute void removeAttribute(in DOMString name) getAttributeNode Attr getAttributeNode(in DOMString name); setAttributeNode Attr setAttributeNode(in Attr newAttr) removeAttributeNode Attr removeAttributeNode(in Attr oldAttr) getElementsByTagName NodeList getElementsByTagName(in DOMString name) }; Attribute management

15 DOM Type Structure interface Node interface Element interface Attr interface Document interface DocumentType interface Comment interface DocumentType interface CDATASection … and a few more subtypesubtype interface NodeList list of interface NamedNodeMap set of interface CharacterData interface Text

16 DOM Type Structure interface Node interface Element interface Attr interface Document interface DocumentType interface Comment interface DocumentType interface CDATASection … and a few more subtypesubtype interface NodeList list of interface NamedNodeMap set of interface CharacterData interface Text

17 interface NodeList { item Node item(in unsigned long index); length unsigned long length; } interface NamedNodeMap { getNamedItem Node getNamedItem(in DOMString name); setNamedItem Node setNamedItem(in Node arg); Node removeNamedItem(in DOMString name); item Node item(in unsigned long index); length unsigned long length; };


Download ppt "Document Object Model (DOM): An Abstract Data Structure for XML data Alex Dekhtyar Department of Computer Science CSC 560: Management of XML Data."

Similar presentations


Ads by Google