public class ConvertDatabaseSchemaVersion extends Object
This demo application can be used directly or extended when other options and/or features are desired.
public static void main( String[] args ) {
// be sure the user has provided an XTCE database XML document
if ( args.length < 1 ) {
System.err.println( "Usage: convertxtcedatabase XTCEFILE" ); // NOI18N
System.exit( -1 );
}
// convert the provided XTCE XML document from 1.1 schema compliance
// to 1.2 schema compliance and if successful, save the file with a
// new name using "-1.2.xml" at the end (default new name on save).
// alternate names can be provided with the save( File ) method.
try {
// initialize the converter using XInclude = false
XTCEDatabaseConverter converter =
new XTCEDatabaseConverter( new File( args[0] ), false );
// perform the modifications to the document structure
converter.upgrade();
// normalize the spacing for output on save
converter.normalizeDocument();
// save the new file with the default output filename
boolean success = converter.save();
// print any messages emitted from the operation
for ( String message : converter.getMessages() ) {
System.out.println( message );
}
if ( success == false ) {
System.err.println( "Output file not emitted" );
System.exit( -2 );
}
} catch ( Exception ex ) {
System.err.println( "Unexpected exception: " +
ex.getLocalizedMessage() );
System.exit( -3 );
}
}
| Constructor and Description |
|---|
ConvertDatabaseSchemaVersion() |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args)
This application emits a new XTCE 1.2 compliant XML document from an
existing XTCE 1.1 compliant XML document.
|
public static void main(String[] args)
args - String array of the command line arguments passed by the
Java VM. One argument is needed and that is the XML document file.
This tool will return a negative exit code value back to the calling process when it is not successful. When successful, the normal return value from the JVM occurs, which should be 0 on most platforms. Errors will also print a string to the STDERR stream.
Copyright © 2015–2019. All rights reserved.