//If there are pruned elements in the queue filtering events is still needed
if (!prunedElements.isEmpty()) {
//If another start element add it to the queue
if (event.isStartElement()) {
final StartElement startElement = event.asStartElement();
prunedElements.push(startElement.getName());
}
//If end element pop the newest name of the queue and double check that the start/end elements match up
else if (event.isEndElement()) {
final QName startElementName = prunedElements.pop();