1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<span class="description">
<br>
<div class="descriptionheading">Overview</div>
This example shows how to do very basic validation of an XML document.
<br><br>
<div class="descriptionheading">Well formedness</div>
The DOM parser automatically tests for well-formedness when loading the file (row 10).
The value that is returned from the <span class="interestingdescription">load</span> method is true if the file was well-formed and false if not.
<br><br>
<div class="descriptionheading">Validation</div>
Validation of the file using the DTD linked by the XML file (if such a link exists) is performed with the <span class="interestingdescription">validate</span> method.
The value returned is true if the file is valid and false if not.
<br><br>
Validation is as simple as this in the simplest case. However we do not get very detailed information abou why validation or well-formedness has failed.
<br><br>
<div class='exampleheading'>Web Page Output:<br><br>
<img src='DomExample2.png'>
</div>
</span>
|