TXT files provide a convenient way to note down the textual data quickly and easily. On the other hand, XML files are commonly used to store and transport data within or between applications. In certain cases, you need to export TXT file’s data to XML format programmatically from within your Java applications. To achieve that, this article shows how to convert a TXT file to XML in Java.