class XmlStackingSemanticTranslator extends AbstractStackingSemanticTranslator<XmlStackItem> implements StackingSemanticTranslator<XmlStackItem>, SemanticTranslator {

    @Override
    public Model translate(InputStream dataStream, String entityIdentifier, ExtractedOntology managedOntology)
            throws SemanticTranslationException {
        final Model resultsModel = modelFactory.createModel();
        final XMLStreamReader reader = initXmlStreamReader(dataStream);
        try {
            final StringBuilder stringBuffer = new StringBuilder();
            for (int event = reader.next(); event != XMLStreamConstants.END_DOCUMENT; event = reader.next()) {
                final String address = getCurrentLocation();
                switch (event) {
                    case XMLStreamConstants.START_ELEMENT:
                        // Process the start of an element.
                        startElement(reader, managedOntology);
                        break;
                    case XMLStreamConstants.COMMENT:
                        // Handle a comment on the document.
                        handleComment(reader.getText());
                        break;
                    case XMLStreamConstants.END_ELEMENT:
                        // Pull the item corresponding to this element end off the stack.
                        final XmlStackItem endingItem = popStack()
                                // End of element requires a corresponding stack item.
                                .orElseThrow(() -> new SemanticTranslationException("Element ending without a " +
                                        "corresponding stack item."));
                        // Get the content for this ending element.
                        final String val = stringBuffer.toString();
                        stringBuffer.setLength(0);
                        LOG.trace("Ending '{}' - Value: '{}'", reader.getLocalName(), val);
                        // Handle the end of a root element.
                        rootElementEnding(endingItem);
                        // Handle the ending element.
                        handleElementEnd(endingItem, val, managedOntology, address, resultsModel);
                        break;
                    case XMLStreamConstants.CHARACTERS:
                        stringBuffer.append(reader.getText().trim());
                        break;
                    default:
                        break;
                }
            }
        } catch (XMLStreamException e) {
            throw new SemanticTranslationException("Issue reading XML from incoming data stream", e);
        } finally {
            silentlyCloseReader(reader);
        }
        return resultsModel;
    }

    public  XmlStackingSemanticTranslator();

}