public class ProcessContainerExample extends Object
The following is an example based on this demonstration class file. The class main() uses a built-in example database file in this larger package, instead of the "myfile.xml" used in the example code below.
try {
XTCEDatabase db = new XTCEDatabase( new File( "myfile.xml" ),
false, // skip XSD validation
true, // apply the XIncludes
true ); // ReadOnly
List<XTCETMContainer> containers = db.getContainers();
for ( XTCETMContainer container : containers ) {
XTCEContainerContentModel model =
new XTCEContainerContentModel( container,
db.getSpaceSystemTree(),
null,
false );
// get the size
long sizeInBits = model.getTotalSize();
// for demonstration, get the parameters in the container
List<XTCEContainerContentEntry> entries =
model.getContentList();
for ( XTCEContainerContentEntry entry : entries ) {
// skip content entries that are not actually used because
// the conditional include is false
if ( entry.isCurrentlyInUse() == false ) {
continue;
}
// print a message based on the type of entry
switch ( entry.getEntryType() ) {
case PARAMETER:
System.out.println( entry.getEntryTypeString() +
": " +
entry.getParameter().getName() );
break;
case ARGUMENT:
System.out.println( entry.getEntryTypeString() +
": " +
entry.getArgument().getName() );
break;
case CONSTANT:
System.out.println( entry.getEntryTypeString() +
": " +
entry.getValue() );
break;
case CONTAINER:
// ignore for this purpose
break;
default:
break;
}
}
System.out.println( "Total Size: " +
Long.toString( sizeInBits ) +
" bits" );
}
System.out.println( "Done" );
} catch ( Exception ex ) {
System.out.println( "Exception: " + ex.getLocalizedMessage() );
ex.printStackTrace();
}
| Constructor and Description |
|---|
ProcessContainerExample() |
public static void main(String[] args)
args - the command line argumentsCopyright © 2015–2019. All rights reserved.