iso8211 0-1-0 by Weft

uk.co.weft.iso8211
Class Parser

java.lang.Object
  |
  +--uk.co.weft.iso8211.Parser

public class Parser
extends java.lang.Object
implements uk.co.weft.domutil.DocumentGenerator

Command line for ISO 8211 parse. TODO: Currently no real exception handling. This class (and consequently any class inheriting from this class) knows about the following tokens in contexts:

debug
Boolean: whether or not to print output to the output stream. Config only. Optional. Defaults to false.
doctype
The document type definition for the generated XML. Optional. No default. Note that there probably will be a default value in a later version.
dom_implementation_class
String: The name of the dom implementation to use. Optional. Defaults to org.apache.xerces.dom.DOMImplementationImpl. Note that the DOM implementation specified must be on the classpath.
root_name
String: the name of the root element of the generated XML. Context only. Optional. Defaults to iso8211.
s57_file_name
String: The relative path name of the S57 file to be parsed. Context only. Optional, but if not supplied s57_file_url must be. No default.
s57_file_url
String: The URL from which the S57 file to be parsed may be fetched. Context only. Optional, but if not supplied s57_file_name must be. If both are supplied s57_file_name is preferred. No default.
transform_url
String: the url of an XSL-T file which should be used to transform the output before printing. Config only. Optional. Defaults to null.
xmlns
String: the XML namespace specifier to use. Optional. No default. Note that there probably will be a default value in a later version.

However when running this parser from the command line both config and context tokens can be supplied as command line flags prefixed by '-'. The token to which the '-' is prepended will be used as a key in the context and the token following will be used as its value. Any token not either a keyword token (prepended with '-') or immediately following a key token on the command line will be taken as the name of an S57 file to be parsed, as though a '-s57_file_name' had been read. If multiple S57 input files are specified on the command line only the last will be read.

Version:
$Revision: 1.3 $ This revision: $Author: simon $
  $Log: Parser.java,v $
  Revision 1.3  2002/11/04 14:11:15  simon
  Now generating (some) XML. Tidy up for first public release.

  Revision 1.2  2002/11/02 00:09:16  simon
  Promising, but still not there. Problems include not correctly finding
  the start of the next record.

  Revision 1.1.1.1  2002/10/29 11:27:33  simon
  More or less parses


  
Author:
Simon Brooke (simon@jasmine.org.uk)

Field Summary
 boolean debug
          whether or not I'm in debug mode
 java.lang.String transformURL
          the URL to use to transform the output
 
Constructor Summary
Parser()
           
 
Method Summary
 org.w3c.dom.Document generate(uk.co.weft.dbutil.Context context)
          Parse an S57 file and generate a document.
 java.lang.String getTransformURL(uk.co.weft.dbutil.Context context)
          get the URL of my stylesheet as a String.
 void init(uk.co.weft.dbutil.Context config)
          Initialise this generator with configuration information from this context
static void main(java.lang.String[] args)
          very crude command line shell.
protected  Record readRecord(ISO8211InputStream in, DDR ddr)
          get the next record from my stream if any
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public boolean debug
whether or not I'm in debug mode

transformURL

public java.lang.String transformURL
the URL to use to transform the output
Constructor Detail

Parser

public Parser()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
very crude command line shell. May do something more sophisticated later.

readRecord

protected Record readRecord(ISO8211InputStream in,
                            DDR ddr)
                     throws java.lang.Exception
get the next record from my stream if any

generate

public org.w3c.dom.Document generate(uk.co.weft.dbutil.Context context)
                              throws java.lang.Exception
Parse an S57 file and generate a document.
Specified by:
generate in interface uk.co.weft.domutil.DocumentGenerator

getTransformURL

public java.lang.String getTransformURL(uk.co.weft.dbutil.Context context)
                                 throws uk.co.weft.domutil.GenerationException
get the URL of my stylesheet as a String. If I don't have a preferred stylesheet, return null
Specified by:
getTransformURL in interface uk.co.weft.domutil.DocumentGenerator

init

public void init(uk.co.weft.dbutil.Context config)
          throws uk.co.weft.htform.InitialisationException
Initialise this generator with configuration information from this context
Specified by:
init in interface uk.co.weft.domutil.DocumentGenerator

iso8211 0-1-0 by Weft