// Main
//
/** Main program entry point. */
public static void main(String argv[]) {
Arguments argopt = new Arguments();
argopt.setUsage( new String[] {
"usage: java dom.DOMWriter (options) uri ...","",
"options:",
" -n | -N Turn on/off namespace [default=on]",
" -v | -V Turn on/off validation [default=off]",
" -s | -S Turn on/off Schema support [default=on]",
" -f | -F Turn on/off Schema full consraint checking [default=off]",
" -d | -D Turn on/off deferred DOM [default=on]",
" -c Canonical XML output.",
" -h This help screen.",
" -e Output Java Encoding.",
" Default encoding: UTF-8"} );
// is there anything to do?
if ( argv.length == 0 ) {
argopt.printUsage();
System.exit(1);
}
// vars
String parserName = DEFAULT_PARSER_NAME;
boolean canonical = false;
String encoding = "UTF8"; // default encoding
argopt.parseArgumentTokens(argv, new char[] { 'p', 'e'} );
int c;
String arg = null;
while ( ( arg = argopt.getlistFiles() ) != null ) {
outer:
while ( (c = argopt.getArguments()) != -1 ){
switch (c) {
case 'c':
canonical = true;
break;
case 'e':
encoding = argopt.getStringParameter();
if ( encoding != null && isValidJavaEncoding( encoding ) )
setWriterEncoding( encoding );
else {
printValidJavaEncoding();
System.exit( 1 );
}
break;
case 'v':
setValidation = true;
break;
case 'V':
setValidation = false;
break;
case 'N':
setNameSpaces = false;
break;
case 'n':
setNameSpaces = true;
break;
case 'p':
parserName = argopt.getStringParameter();
break;
case 'd':
setDeferredDOM = true;
break;
case 'D':
setDeferredDOM = false;
break;
case 's':
setSchemaSupport = true;
break;
case 'S':
setSchemaSupport = false;
break;
case 'f':
setSchemaFullSupport = true;
break;
case 'F':
setSchemaFullSupport = false;
break;
case '?':
case 'h':
case '-':
argopt.printUsage();
System.exit(1);
break;
case -1:
break outer;
default: