code: public void readWriteUpToStartElement(String startTag) throws XMLStreamException {
          boolean startTagIsNext = false;
          while (xmlEventReader.hasNext() && !startTagIsNext) {
              XMLEvent peekedEvent = xmlEventReader.peek();
              switch (peekedEvent.getEventType()) {
                  case XMLStreamConstants.START_ELEMENT:
                      String elementName = peekedEvent.asStartElement().getName().getLocalPart();
                      if (elementName.equals(startTag)) {
                          startTagIsNext = true;
                      } else {
                          XMLEvent readEvent = xmlEventReader.nextEvent();
                          add(readEvent);
                      }
                      break;
                  default:
                      XMLEvent readEvent = xmlEventReader.nextEvent();
                      add(readEvent);
                      break;
              }
          }
      }
docs: postcondition read pointer is just before the start of the tag with the local name startTag