Interesting Kotlin/Java comparison ... this Java:
         XMLOutputFactory factory = XMLOutputFactory.newInstance();
         XMLStreamWriter xmlWriter = factory.createXMLStreamWriter(writer);
         xmlWriter.writeStartDocument();
         xmlWriter.writeStartElement("html");
         xmlWriter.writeStartElement("head");
         xmlWriter.writeStartElement("title");