/lenasys/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/lenasys/trunk

« back to all changes in this revision

Viewing changes to codehighlighterimpl/DomExample1.htm

  • Committer: c11emian
  • Date: 2013-04-05 08:35:29 UTC
  • mto: (19.4.3 lenasys)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: c11emian@student.his.se-20130405083529-3bpc9l6i6z8xl8np
Fixed bug #1164571 by changing the name of newbutton() to newButton() in Parser_Test.html, and bug 
#1164550 by changing all the function-calls named maketoken() to makeToken() in Parser_Test.js

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<span class="description">
 
2
<br>
 
3
<div class="descriptionheading">Overview</div>
 
4
This example shows how to navigate a DOM document.
 
5
<br><br>
 
6
<div class="descriptionheading">Initiation</div>
 
7
The first part of the code (rows 8-10) creates the DOM document object. The DOM object has all the functionality needed to 
 
8
load and parse a document. We use the load function (row 10) to load the data into memory. When this is done, the DOM object contains
 
9
a reference to the data that has been loaded into memory. <a href="#" onclick="highlight(['ace_showcodephp'],'str_replace')">str_replace</a>
 
10
<br><br>
 
11
<div class="descriptionheading">Element Navigation</div>
 
12
The <span class="interestingdescription">documentElement</span> (row 12) attribute of the DOMDocument object contains a reference
 
13
to the root node of the dom document. In this case it is a person element. <a href="#" onclick="highlight(['ace_showcodephp'],'buffer')">buffer</a>
 
14
<br><br>
 
15
In the following row (row 12) we print the name of the element using the <span class="interestingdescription">tagName</span> attribute (for this file <a href='../XMLData/example1.xml'>example1.xml</a> the root element is a person element)  <a href="#" onclick="highlight(['ace_showcodephp','ace_indexphp'],'script');">script</a>
 
16
<br><br>
 
17
The foreach statement on row (13-17) iterates over the <span class="interestingdescription">childNodes</span> of the root node that was retrieved on row 12.
 
18
The childNodes attribute returns an array of the child nodes of the node. If there are no child nodes, an empty array is returned.
 
19
<br><br>
 
20
The <span class="interestingdescription">nodeValue</span> attribute (row 16) of a document element gives us the text content of any elements
 
21
below the referenced element. In this case the nodeValue for the "car" element returns  the value "Red!!" even though the contents inside the car element 
 
22
is a color element which contains the text "Red!!".
 
23
<br><br>
 
24
<div class='exampleheading'>Web Page Output:<br><br>
 
25
<img src='DomExample1.png'>
 
26
</div>
 
27
                                                                                                                                        
 
28
</span>
 
 
b'\\ No newline at end of file'