private def captureFromXml()

in app/helpers/S3XMLProcessor.scala [52:84]


  private def captureFromXml(xml:XMLEventReader, currNode:List[String],allCaptures:Map[String,String]):Map[String,String] =
    if(xml.hasNext){
      xml.next() match {
        case EvElemStart(_, label, attrs, scope)=>
          logger.debug(s"\telem start: $label")
          captureFromXml(xml, label :: currNode, allCaptures)
        case EvText(text)=>
          if(currNode.nonEmpty) {
            logger.debug(s"\ttext: $text, currentCapture: ${currNode.head}")

            val updatedText = allCaptures.get(currNode.head) match {
              case Some(existingText) => existingText + text
              case None => text
            }
            val updatedCaptures = allCaptures ++ Map(currNode.head -> updatedText)
            logger.debug(updatedCaptures.toString)
            captureFromXml(xml, currNode, updatedCaptures)
          } else {
            captureFromXml(xml, currNode, allCaptures)
          }
        case EvElemEnd(_, label)=>
          logger.debug(s"\telem end: $label")
          if(currNode.isEmpty){
            allCaptures
          } else {
            captureFromXml(xml, currNode.tail, allCaptures)
          }
        case _=>
          captureFromXml(xml, currNode, allCaptures)
      }
    } else {
      allCaptures
    }