private static void configureEntityManager(XmlFile file, SAXParser parser) throws SAXException {
    XMLEntityManager entityManager = (XMLEntityManager)parser.getXMLReader().getProperty(ENTITY_MANAGER_PROPERTY_ID);
    Map<String, XMLEntityManager.Entity> entities = file.getUserData(ENTITIES_KEY);
    if (entities != null) {
      // passing of entityManager object would break validation, so we copy its entities
      Map<String, XMLEntityManager.Entity> map = XercesAccessor.getEntities(entityManager);
      for (Map.Entry<String, XMLEntityManager.Entity> entry : entities.entrySet()) {
        if (entry.getValue().isEntityDeclInExternalSubset()) {
          map.put(entry.getKey(), entry.getValue());
        }
      }
    }
    else {
      file.putUserData(ENTITIES_KEY, XercesAccessor.getEntities(entityManager));
    }
  }
private static void configureEntityManager(XmlFile file, SAXParser parser)