Wednesday 1 December 2010

Sixth Task - Describe and discuss the logical modelling of data in the context of XML, giving examples


The DOM is a W3C (World Wide Web Consortium) standard. The DOM defines a standard for accessing documents like HTML and XML. 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, and style of a document.


The DOM is separated into 3 different parts  levels:

  • Core DOM - standard model for any structured document
  • XML DOM - standard model for XML documents
  • HTML DOM - standard model for HTML documents

The DOM defines the objects and properties of all document elements, and the methods (interface) to access them.

Node Parents, Children, and Siblings

The document object model defines the object and the properties of a document and its methods. The nodes in the node tree have a hierarchical relationship to each other. The terms parent, child, and sibling are used to describe the relationships. Parent nodes have children. Children on the same level are called siblings (brothers or sisters). 


  • In a node tree, the top node is called the root
  • Every node, except the root, has exactly one parent node
  • A node can have any number of children
  • A leaf is a node with no children
  • Siblings are nodes with the same parent 


An External JavaScript for loadXMLDoc()

XML document can be made into DOM Object model,The file  called "loadxmldoc.js",  will be loaded in the head section of an HTML page. Then, the loadXMLDoc() function can be called from a script in the page.The following example uses the loadXMLDoc() function to load books.xml

<html>
<head>
<script type="text/javascript" src="loadxmldoc.js">
</script>
</head>

<body>
<script type="text/javascript">
xmlDoc=loadXMLDoc("books.xml");
document.write("xmlDoc is loaded, ready for use");
</script>
</body>
</html>

No comments:

Post a Comment