protected Driver parseDriver(XMLStreamReader reader) throws XMLStreamException, ParserException,
      ValidateException
   {
      String driverClass = null;
      String dataSourceClass = null;
      String xaDataSourceClass = null;

      //attributes reading

      String name = null;
      Integer majorVersion = null;
      Integer minorVersion = null;
      String module = null;

      Map<String, String> expressions = new HashMap<String, String>();
      
      for (int i = 0; i < reader.getAttributeCount(); i++)
      {
         switch (reader.getAttributeLocalName(i))
         {
            case XML.ATTRIBUTE_NAME : {
               name = attributeAsString(reader, XML.ATTRIBUTE_NAME, expressions);
               break;
            }
            case XML.ATTRIBUTE_MAJOR_VERSION : {
               majorVersion = attributeAsInt(reader, XML.ATTRIBUTE_MAJOR_VERSION, expressions);
               break;
            }
            case XML.ATTRIBUTE_MINOR_VERSION : {
               minorVersion = attributeAsInt(reader, XML.ATTRIBUTE_MINOR_VERSION, expressions);
               break;
            }
            case XML.ATTRIBUTE_MODULE : {
               module = attributeAsString(reader, XML.ATTRIBUTE_MODULE, expressions);
               break;
            }
            default :
               break;
         }
      }

      //elements reading
      while (reader.hasNext())
      {
         switch (reader.nextTag())
         {
            case END_ELEMENT : {
               if (XML.ELEMENT_DRIVER.equals(reader.getLocalName()))
               {
                  return new DriverImpl(name, majorVersion, minorVersion, module,
                                        driverClass, dataSourceClass, xaDataSourceClass,
                          !expressions.isEmpty() ? expressions : null);
               }
               else
               {
                  switch (reader.getLocalName())
                  {
                     case XML.ELEMENT_DATASOURCE_CLASS :
                     case XML.ELEMENT_XA_DATASOURCE_CLASS :
                     case XML.ELEMENT_DRIVER_CLASS :
                        break;
                     default :
                        throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                  }
               }
               break;
            }
            case START_ELEMENT : {
               switch (reader.getLocalName())
               {
                  case XML.ELEMENT_DATASOURCE_CLASS : {
                     dataSourceClass = elementAsString(reader, XML.ELEMENT_DATASOURCE_CLASS, expressions);
                     break;
                  }
                  case XML.ELEMENT_XA_DATASOURCE_CLASS : {
                     xaDataSourceClass = elementAsString(reader, XML.ELEMENT_XA_DATASOURCE_CLASS, expressions);
                     break;
                  }
                  case XML.ELEMENT_DRIVER_CLASS : {
                     driverClass = elementAsString(reader, XML.ELEMENT_DRIVER_CLASS, expressions);
                     break;
                  }
                  default :
                     throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
               }
               break;
            }
         }
      }
      throw new ParserException(bundle.unexpectedEndOfDocument());
   }
protected Driver parseDriver ( XMLStreamReader reader ) throws XMLStreamException , ParserException , ValidateException { String driverClass = null ; String dataSourceClass = null ; String xaDataSourceClass = null ; String name = null ; Integer majorVersion = null ; Integer minorVersion = null ; String module = null ; Map < String , String > expressions = new HashMap < String , String > ( ) ; for ( int i = 0 ; i < reader . getAttributeCount ( ) ; i ++ ) { switch ( reader . getAttributeLocalName ( i ) ) { case XML . ATTRIBUTE_NAME : { name = attributeAsString ( reader , XML . ATTRIBUTE_NAME , expressions ) ; break ; } case XML . ATTRIBUTE_MAJOR_VERSION : { majorVersion = attributeAsInt ( reader , XML . ATTRIBUTE_MAJOR_VERSION , expressions ) ; break ; } case XML . ATTRIBUTE_MINOR_VERSION : { minorVersion = attributeAsInt ( reader , XML . ATTRIBUTE_MINOR_VERSION , expressions ) ; break ; } case XML . ATTRIBUTE_MODULE : { module = attributeAsString ( reader , XML . ATTRIBUTE_MODULE , expressions ) ; break ; } default : break ; } } while ( reader . hasNext ( ) ) { switch ( reader . nextTag ( ) ) { case END_ELEMENT : { if ( XML . ELEMENT_DRIVER . equals ( reader . getLocalName ( ) ) ) { return new DriverImpl ( name , majorVersion , minorVersion , module , driverClass , dataSourceClass , xaDataSourceClass , ! expressions . isEmpty ( ) ? expressions : null ) ; } else { switch ( reader . getLocalName ( ) ) { case XML . ELEMENT_DATASOURCE_CLASS : case XML . ELEMENT_XA_DATASOURCE_CLASS : case XML . ELEMENT_DRIVER_CLASS : break ; default : throw new ParserException ( bundle . unexpectedEndTag ( reader . getLocalName ( ) ) ) ; } } break ; } case START_ELEMENT : { switch ( reader . getLocalName ( ) ) { case XML . ELEMENT_DATASOURCE_CLASS : { dataSourceClass = elementAsString ( reader , XML . ELEMENT_DATASOURCE_CLASS , expressions ) ; break ; } case XML . ELEMENT_XA_DATASOURCE_CLASS : { xaDataSourceClass = elementAsString ( reader , XML . ELEMENT_XA_DATASOURCE_CLASS , expressions ) ; break ; } case XML . ELEMENT_DRIVER_CLASS : { driverClass = elementAsString ( reader , XML . ELEMENT_DRIVER_CLASS , expressions ) ; break ; } default : throw new ParserException ( bundle . unexpectedElement ( reader . getLocalName ( ) ) ) ; } break ; } } } throw new ParserException ( bundle . unexpectedEndOfDocument ( ) ) ; }
Parse driver
@param reader The reader
@return The result
@exception XMLStreamException XMLStreamException
@exception ParserException ParserException
@exception ValidateException ValidateException