defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines...
-
Upload
jeffrey-booker -
Category
Documents
-
view
215 -
download
0
Transcript of defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines...
![Page 1: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/1.jpg)
![Page 2: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/2.jpg)
![Page 3: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/3.jpg)
defined as Extensible Markup Language (XML) is a set of rules for encoding documents
Defines structure and data
![Page 4: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/4.jpg)
<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book>
</bookstore>
![Page 5: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/5.jpg)
• A W3C standard that defines a standard way for accessing and manipulating XML documents
• DOM presents an XML document as a tree-structure
![Page 6: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/6.jpg)
• A standard programming interface for XML that is platform- and language-independent
• The XML DOM defines the objects and properties of all XML elements, and the methods (interface) to access them.
• In other words: The XML DOM is a standard for how to get, change, add, or delete XML elements.
![Page 7: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/7.jpg)
According to the DOM, everything in an XML document is a node.
The DOM says: The entire document is a document node Every XML element is an element node The text in the XML elements are text nodes Every attribute is an attribute node Comments are comment nodes
![Page 8: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/8.jpg)
<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book>
</bookstore>
root
![Page 9: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/9.jpg)
<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book>
</bookstore>
Book node
![Page 10: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/10.jpg)
<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book>
</bookstore>
Book node contains four other nodes
![Page 11: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/11.jpg)
• The XML DOM views an XML document as a tree structure called a node-tree
• All the nodes in the tree have a relationship to each other and can be accessed through the tree
• The node tree shows the set of nodes, and the connections between them. The tree starts at the root node and branches out to the text nodes at the lowest level of the tree
![Page 12: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/12.jpg)
![Page 13: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/13.jpg)
• Nodes in the node tree have a hierarchical relationship to each other
• The terms parent, child, and sibling are used to describe the relationships. For example, Parent nodes have children
![Page 14: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/14.jpg)
• Children on the same level are called siblings (brothers or sisters) which are nodes with the same parent
• In a node tree, the top node is called the root only one root can exist in an XML file.
• Every node, except the root, has exactly one parent node
![Page 15: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/15.jpg)
![Page 16: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/16.jpg)
<bookstore> <book category="cooking"> <title lang="en">Everyday Italian</title> <author>Giada De Laurentiis</author> <year>2005</year> <price>30.00</price> </book>
</bookstore>
• In the XML above, the <title> element is the first child of the <book> element, and the <price> element is the last child of the <book> element
• Furthermore, the <book> element is the parent node of the <title>, <author>, <year>, and <price> elements
![Page 17: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/17.jpg)
Most browsers have a built-in XML parser to read and manipulate XML
The parser converts XML into a JavaScript accessible object
• The XML DOM contains methods (functions) to traverse XML trees, access, insert, and delete nodes
![Page 18: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/18.jpg)
• However, before an XML document can be accessed and manipulated, it must be loaded into an XML DOM object
• The parser reads XML into memory* and converts it into an XML DOM object that can be accessed with JavaScript
* you must clear the browser cache to update the XML file
![Page 19: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/19.jpg)
Create an XMLHTTP objectOpen the XMLHTTP objectSend an XML HTTP request to the
server
![Page 20: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/20.jpg)
![Page 21: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/21.jpg)
Danger, Will Robinson, Danger!
![Page 22: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/22.jpg)
Danger, Will Robinson, Danger!
![Page 23: defined as Extensible Markup Language (XML) is a set of rules for encoding documents Defines structure and data.](https://reader036.fdocuments.us/reader036/viewer/2022062500/5697bfdb1a28abf838cb096b/html5/thumbnails/23.jpg)
xmlDoc=new ActiveXObject("Microsoft.XMLDOM");