I’m wondering if there is an accepted method to convert a Pipe delimited text file to XML in Java. The delimited file I am looking to convert is in the format:
RefNo | Location | Name | Age
123 | North America | Steve | 32
And I am looking to convert it to:
<data>
<RefNo>123</RefNo>
<location>North America</location>
<name> Steve </name>
<age> 32 </age>
</data>
Here are some answers to your question, but first you should replace the pipe separator by a comma, because it is
CSVtoXML.You can do it using
s.replaceAll("|",",")inStringclass and following these instructions:Conversion of CSV to XML with JAVA
Java lib or app to convert CSV to XML file?