@Override
  public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
    PersistenceXml element = PersistenceXml.parse((localName == null || localName.isEmpty()) ? name : localName);
    schemaVersion = PersistenceXmlUtil.parseSchemaVersion(uri, element, attributes);
    // found, stop parsing
    if (schemaVersion != null) {
      throw new StopSAXParser();
    }

    // This should never occurs, however check if contain known tag other than TAG_PERSISTENCE
    if (TAG_PERSISTENCE != element && EnumSet.allOf(PersistenceXml.class).contains(element)) {
      throw new PersistenceException("Cannot find schema version attribute in <persistence> tag");
    }
  }
@Override
  public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException {
    PersistenceXml element = PersistenceXml.parse((localName == null || localName.isEmpty()) ? name : localName);
    schemaVersion = PersistenceXmlUtil.parseSchemaVersion(uri, element, attributes);
    
    if (schemaVersion != null) {
      throw new StopSAXParser();
    }

    
    if (TAG_PERSISTENCE != element && EnumSet.allOf(PersistenceXml.class).contains(element)) {
      throw new PersistenceException("Cannot find schema version attribute in <persistence> tag");
    }
  }
@ Override public void startElement ( String uri , String localName , String name , Attributes attributes ) throws SAXException { PersistenceXml element = PersistenceXml . parse ( ( localName == null || localName . isEmpty ( ) ) ? name : localName ) ; schemaVersion = PersistenceXmlUtil . parseSchemaVersion ( uri , element , attributes ) ; // found, stop parsing if ( schemaVersion != null ) { throw new StopSAXParser ( ) ; } // This should never occurs, however check if contain known tag other than TAG_PERSISTENCE if ( TAG_PERSISTENCE != element && EnumSet . allOf ( PersistenceXml . class ) . contains ( element ) ) { throw new PersistenceException ( "Cannot find schema version attribute in <persistence> tag" ) ; } }
Fist tag of 'persistence.xml' (<persistence>) have to have 'version' attribute

@see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String, java.lang.String, java.lang.String,
org.xml.sax.Attributes)
Fist tag of persistence . xml ( <persistence > ) have to have version attribute