1<!-- 2 3 example.html - file for testing Dommer, serves also as an example 4 Copyright (C) 2004 Guido Wesdorp 5 email johnny@debris.demon.nl 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 21--> 22<html> 23 <head> 24 <title>Dommer example</title> 25 <script type="text/javascript" src="../jsbase/array.js"></script> 26 <script type="text/javascript" src="../jsbase/string.js"></script> 27 <script type="text/javascript" src="../minisax.js/minisax.js"></script> 28 <script type="text/javascript" src="dommer.js"></script> 29 <script type="text/javascript"> 30 // <![CDATA[ 31 32 function run() { 33 // some XML 34 var xml = '<?xml version="1.0" ?>' + 35 '<foo xmlns="http://debris.demon.nl/foo"\n' + 36 'xmlns:baz="http://debris.demon.nl/baz"\n' + 37 'xmlns:quux="http://debris.demon.nl/quux"\n' + 38 'quuux="quu&uux">\n' + 39 '<baz:bar foo="bar" quux:quuux="quuuux">' + 40 '<Qux!>' + 41 '</baz:bar>\n' + 42 '</foo>\n'; 43 document.getElementById('startxml').appendChild( 44 document.createTextNode(xml) 45 ); 46 var dom = new dommer.DOM(); 47 var doc = dom.parseXML(xml); 48 document.getElementById('resultxml').appendChild( 49 document.createTextNode(dom.toXML(doc)) 50 ); 51 }; 52 53 // ]]> 54 </script> 55 </head> 56 <body onload="run();"> 57 <h4>Start data:</h4> 58 <pre id="startxml"></pre> 59 <h4>Result:</h4> 60 <pre id="resultxml"></pre> 61 </body> 62</html> 63