summaryrefslogtreecommitdiffstats
path: root/kjsembed/docs/examples/sax/saxdefaults.js
blob: f4a7d3da5f46545dae5aa40e80c0fbf16972675b (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
37
#!/usr/bin/env kjscmd

sax = new Object();

// This method is not implemented, so we rely on the default
//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);
}