1 / 17

Document Object Model (DOM): An Abstract Data Structure for XML data

Document Object Model (DOM): An Abstract Data Structure for XML data. Alex Dekhtyar. CSC 560: Management of XML Data. Department of Computer Science. <faculty id =“27” > <name origin=“Ukraine” > <first> </first> <middle> </middle>

allen-diaz
Download Presentation

Document Object Model (DOM): An Abstract Data Structure for XML data

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

  2. <faculty id =“27” > <name origin=“Ukraine”> <first> </first> <middle> </middle> <last> </last> </name> <dept> </dept> <course> <sem> </sem> <code> </code> <title> </title> </course> </faculty> Alexander M. Dekhtyar Computer Science Spring 2007 CS405 Database systems Trees for XML faculty dept name course

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

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

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

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

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

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

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

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

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

  12. DocumentType doctype Element documentElement interface Document document doctype Attributes root DTD <a> <a> <a> <a> Methods 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 NodeList list of interface Node interface Document subtype interface NamedNodeMap interface Element set of interface Attr interface DocumentType interface Comment interface CharacterData interface Text interface DocumentType interface CDATASection … and a few more

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

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

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

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

More Related