WTA7 XML DOM - (XML DOM) Methodology for writing XML...

Info iconThis preview shows pages 1–15. Sign up to view the full content.

View Full Document Right Arrow Icon
(XML DOM) 1 Methodology for writing XML programs which is known as Document Object Model (DOM)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
DOM b The DOM (Document Object Model) defines a standard way for accessing and manipulating XML documents. 2 b The DOM presents an XML document as a tree-structure. b All elements can be accessed through the DOM tree. Their content (text and attributes) can be modified or deleted, and new elements can be created.
Background image of page 2
DOM b The DOM is a W3C (World Wide Web Consortium) standard. b The DOM defines a standard for accessing documents like XML and HTML: b "The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, 3 and style of a document." b The DOM is separated into 3 different parts / levels: s Core DOM - standard model for any structured document s XML DOM - standard model for XML documents s HTML DOM - standard model for HTML documents b The DOM defines the objects and properties of all document elements, and the methods (interface) to access them.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
DOM NODES b According to the DOM, everything in an XML document is a node . he DOM says: 4 b The DOM says: s The entire document is a document node s Every XML element is an element node s The text in the XML elements are text nodes s Every attribute is an attribute node s Comments are comment nodes
Background image of page 4
5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6
Background image of page 6
Books.xml <?xml version="1.0" encoding="ISO-8859-1"?> <bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book> </book> <book category="web" cover="paperback"> <title lang="en">Learning XML</title> <author>Erik T. Ray</author> <year>2003</year> <price>39.95</price> </book> </bookstore> <book category="children"> <title lang="en">Harry Potter</title> <author>J K. Rowling</author> <year>2005</year> <price>29.99</price> </book> <book category="web"> <title lang="en">XQuery Kick Start</title> <author>James McGovern</author> <author>Per Bothner</author> <author>Kurt Cagle</author> <author>James Linn</author> <author>Vaidyanathan Nagarajan</author> <year>2003</year> <price>49.99</price> 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
DOM Tree of Books.xml (one record) 8
Background image of page 8
The XML DOM Node Tree b Nodes : Parents, Children, and Siblings b In a node tree, the top node is called the root very node, except the root, has exactly 9 b Every node, except the root, has exactly one parent node b A node can have any number of children b A leaf is a node with no children b Siblings are nodes with the same parent
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
DOM node tree 10
Background image of page 10
11
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
12
Background image of page 12
Example of Node Types 13
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
XML DOM Parser b The parser converts XML into a JavaScript accessible object (the XML DOM). b The XML DOM contains methods (functions) to traverse XML trees, access, insert, and delete nodes. 14
Background image of page 14
Image of page 15
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 64

WTA7 XML DOM - (XML DOM) Methodology for writing XML...

This preview shows document pages 1 - 15. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online