public PaymentDates readPaymentDates(XMLStreamReader2 streamReader) throws XMLStreamException {
    Integer paymentFrequencyPeriodMultiplier = null;
    PeriodEnum paymentFrequencyPeriod = null;
    PayRelativeToEnum payRelativeTo = null;
    Offset paymentDaysOffset = null;
    BusinessDayAdjustments paymentDatesAdjustments = null;
    int startingDepth = streamReader.getDepth();
    while(streamReader.hasNext()) {
      switch(streamReader.next()) {
        case XMLEvent.START_ELEMENT:
          String localName = streamReader.getLocalName();
          if("periodMultiplier".equals(localName)) {
            paymentFrequencyPeriodMultiplier = Integer.parseInt(FpmlParser.readText(streamReader));
          } else if("period".equals(localName)) {
            paymentFrequencyPeriod = PeriodEnum.valueOf(FpmlParser.readText(streamReader));
          } else if("payRelativeTo".equals(localName)) {
            payRelativeTo = PayRelativeToEnum.fromValue(FpmlParser.readText(streamReader));
          } else if("paymentDaysOffset".equals(localName)) {
            paymentDaysOffset = offsetFactory.readOffset(streamReader);
          } else if("paymentDatesAdjustments".equals(localName)) {
            paymentDatesAdjustments = businessDayAdjustmentsFactory.readBusinessDayAdjustments(streamReader);
          }
          break;
        case XMLEvent.END_ELEMENT:
          if(streamReader.getDepth() == startingDepth) {
            return new PaymentDates(paymentFrequencyPeriodMultiplier, paymentFrequencyPeriod, payRelativeTo, paymentDaysOffset, paymentDatesAdjustments);
          }
      }
    }
    throw new PricerException("No more events before element finished");
  }