private Vocabulary buildVocab(final String xml, final Vocabulary vocabulary)
            throws ParserConfigurationException, SAXException, IOException {

        final SAXParserFactory factory = SAXParserFactory.newInstance();
        factory.setNamespaceAware(true);
        final SAXParser saxParser = factory.newSAXParser();

        final InputStream inputStream = new ByteArrayInputStream(xml.getBytes());

        final VocabularyGenerator vocabularyGenerator;
        SerializerVocabulary serializerVocabulary = null;
        ParserVocabulary parserVocabulary = null;
        if (vocabulary != null) {

            serializerVocabulary = createSerializerVocabulary(vocabulary);
            parserVocabulary = new ParserVocabulary(vocabulary);
            vocabularyGenerator = new VocabularyGenerator(serializerVocabulary, parserVocabulary);
        } else {
            vocabularyGenerator = new VocabularyGenerator();
        }
        LOGGER.info(LogUtil.inSeparatorLine("Generating vocab"));
        saxParser.parse(inputStream, vocabularyGenerator);
        return vocabularyGenerator.getVocabulary();
    }
A proof of concept for https://github.com/gchq/stroom/issues/1945
Trying to prove that we can generate a fast infoset vocab
for some xml and then append to it. This is to reduce the volume of data
stored in the LMDB ref data store.
stroom-pipeline/src/test/java/stroom/pipeline/refdata/TestFastInfosetVocab.java