summaryrefslogtreecommitdiffstats
path: root/kjsembed/docs/examples/sax/saxdemo.js
blob: c39ac61922d1c649da2ca335af6b4a2a661d00f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env kjscmd

sax = new Object();

sax.startDocument = function() {
   println( "start document" );
   return true;
}

sax.startElement = function( namespace, localname, qualifiedname ) {
   println( "start: '" + namespace + "', '" + localname + "', '" + qualifiedname + "'" );
   return true;
}

sax.endElement = function( namespace, localname, qualifiedname ) {
   println( "end: '" + namespace + "', '" + localname + "', '" + qualifiedname + "'" );
   return true;
}

sax.characters = function( chars ) {
   println( "characters: '" + chars + "'" );
   return true;
}

sax.endDocument = function() {
   println( "end document" );
   return true;
}

try {
    saxLoadFile( sax, application.args[0] );
}
catch( theErr )
{
    println(theErr);
}