// This method is called from SaxParserHandler.startElement() method
// as well as DeploymentDescriptorFile.getDefaultSchemaSource().
// When it is called from former method, descriptor is non-null,
// but when it is called later method, descriptor is null.
if(descriptor==null ||
descriptor instanceof Application ||
descriptor instanceof ApplicationClientDescriptor ||
descriptor instanceof EjbBundleDescriptor ||
descriptor instanceof WebBundleDescriptor) {
return new PersistenceNode(new PersistenceUnitsDescriptor());
} else {
throw new IllegalArgumentException(descriptor.getClass().getName()+
"is not allowed to contain persistence.xml file");
}