logback-android/src/main/java/ch/qos/logback/core/joran/action/IncludeAction.java
private void trimHeadAndTail(SaxEventRecorder recorder) {
    List<SaxEvent> saxEventList = recorder.getSaxEventList();
    if (saxEventList.size() == 0) {
      return;
    }

    boolean includedTagFound = false;
    boolean configTagFound = false;

    // find opening element
    SaxEvent first = saxEventList.get(0);
    if (first != null) {
      String elemName = getEventName(first);
      includedTagFound = INCLUDED_TAG.equalsIgnoreCase(elemName);
      configTagFound = CONFIG_TAG.equalsIgnoreCase(elemName);
    }

    // if opening element found, remove it, and then remove the closing element
    if (includedTagFound || configTagFound) {
      saxEventList.remove(0);

      final int listSize = saxEventList.size();
      if (listSize == 0) {
        return;
      }

      final int lastIndex = listSize - 1;
      SaxEvent last = saxEventList.get(lastIndex);

      if (last != null) {
        String elemName = getEventName(last);
        if ((includedTagFound && INCLUDED_TAG.equalsIgnoreCase(elemName)) ||
          (configTagFound && CONFIG_TAG.equalsIgnoreCase(elemName))) {

          saxEventList.remove(lastIndex);
        }
      }
    }
  }
private void trimHeadAndTail(SaxEventRecorder recorder) {
    List<SaxEvent> saxEventList = recorder.getSaxEventList();
    if (saxEventList.size() == 0) {
      return;
    }

    boolean includedTagFound = false;
    boolean configTagFound = false;

    // find opening element
    SaxEvent first = saxEventList.get(0);
    if (first != null) {
      String elemName = getEventName(first);
      includedTagFound = INCLUDED_TAG.equalsIgnoreCase(elemName);
      configTagFound = CONFIG_TAG.equalsIgnoreCase(elemName);
    }

    // if opening element found, remove it, and then remove the closing element
    if (includedTagFound || configTagFound) {
      saxEventList.remove(0);

      final int listSize = saxEventList.size();
      if (listSize == 0) {
        return;
      }

      final int lastIndex = listSize - 1;
      SaxEvent last = saxEventList.get(lastIndex);

      if (last != null) {
        String elemName = getEventName(last);
        if ((includedTagFound && INCLUDED_TAG.equalsIgnoreCase(elemName)) ||
          (configTagFound && CONFIG_TAG.equalsIgnoreCase(elemName))) {

          saxEventList.remove(lastIndex);
        }
      }
    }
  }
private void trimHeadAndTail ( SaxEventRecorder recorder ) { List < SaxEvent > saxEventList = recorder . getSaxEventList ( ) ; if ( saxEventList . size ( ) == 0 ) { return ; } boolean includedTagFound = false ; boolean configTagFound = false ; // find opening element SaxEvent first = saxEventList . get ( 0 ) ; if ( first != null ) { String elemName = getEventName ( first ) ; includedTagFound = INCLUDED_TAG . equalsIgnoreCase ( elemName ) ; configTagFound = CONFIG_TAG . equalsIgnoreCase ( elemName ) ; } // if opening element found, remove it, and then remove the closing element if ( includedTagFound || configTagFound ) { saxEventList . remove ( 0 ) ; final int listSize = saxEventList . size ( ) ; if ( listSize == 0 ) { return ; } final int lastIndex = listSize - 1 ; SaxEvent last = saxEventList . get ( lastIndex ) ; if ( last != null ) { String elemName = getEventName ( last ) ; if ( ( includedTagFound && INCLUDED_TAG . equalsIgnoreCase ( elemName ) ) || ( configTagFound && CONFIG_TAG . equalsIgnoreCase ( elemName ) ) ) { saxEventList . remove ( lastIndex ) ; } } } }
Removes the head tag and tail tag if they are named either
"included" or "configuration"
@param recorder the SAX Event recorder containing the tags
Removes the head tag and tail tag if they are named either included or configuration