code: protected DataSources parseDataSources(XMLStreamReader reader) throws XMLStreamException, ParserException,
        ValidateException
     {
        List<DataSource> datasource = new ArrayList<DataSource>();
        List<XaDataSource> xaDataSource = new ArrayList<XaDataSource>();
        Map<String, Driver> drivers = new HashMap<String, Driver>();
        boolean driversMatched = false;
  
        while (reader.hasNext())
        {
           switch (reader.nextTag())
           {
              case END_ELEMENT : {
                 if (XML.ELEMENT_DATASOURCES.equals(reader.getLocalName()))
                 {
                    return new DatasourcesImpl(datasource, xaDataSource, drivers);
                 }
                 else
                 {
                    switch (reader.getLocalName())
                    {
                       case XML.ELEMENT_DATASOURCE :
                       case XML.ELEMENT_XA_DATASOURCE :
                       case XML.ELEMENT_DRIVERS :
                       case XML.ELEMENT_DRIVER :
                          break;
                       default :
                          throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
                    }
                 }
                 break;
              }
              case START_ELEMENT : {
                 switch (reader.getLocalName())
                 {
                    case XML.ELEMENT_DATASOURCE : {
                       datasource.add(parseDataSource(reader));
                       break;
                    }
                    case XML.ELEMENT_XA_DATASOURCE : {
                       xaDataSource.add(parseXADataSource(reader));
                       break;
                    }
                    case XML.ELEMENT_DRIVERS : {
                       driversMatched = true;
                       break;
                    }
                    case XML.ELEMENT_DRIVER : {
                       Driver driver = parseDriver(reader);
                       drivers.put(driver.getName(), driver);
                       break;
                    }
                    default :
                       throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
                 }
                 break;
              }
           }
        }
        throw new ParserException(bundle.unexpectedEndOfDocument());
     }
docs: Parse datasource
  @param reader The reader
  @return The result
  @exception XMLStreamException XMLStreamException
  @exception ParserException ParserException
  @exception ValidateException ValidateException