Package mainPkg = getMainPackage();
XPDLHandler xpdlhmain = JaWEManager.getInstance().getXPDLHandler();
XPDLHandler xpdlh = null;
if (filename != null && filename.length() > 0) {
try {
xpdlh = new XPDLHandler(new DefaultXPDLHandlerSettings());
Package pkg = xpdlh.openPackage(filename, true);
// do not allow insertion if package has the same Id as the main one,
// or as some of its external packages
Set mainPkgExtPkgIds = new HashSet(mainPkg.getExternalPackageIds());
boolean canInsert = true;