I am using Apache Kafka to read in an multiple xml files. I want to convert the xml files into a flat file (csv file or text file). I have an example output below:
I think converting xml into dom is a solution or using Jackson-xml data converter?
Can anyone comment on the best solution to achieve this? Thanks!
Input 1:
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<id>123</id>
<firstName>Jane</firstName>
<phoneNumbers type="work">555-1111</phoneNumbers>
</customer>
Input 2:
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<id>1234</id>
<firstName>Bob</firstName>
<phoneNumbers type="work">555-1111</phoneNumbers>
</customer>
Output:
<?xml version="1.0" encoding="UTF-8"?><customer><id>123</id><firstName>Jane</firstName><phoneNumbers type="work">555-1234</phoneNumbers></customer>
<?xml version="1.0" encoding="UTF-8"?><customer><id>1234</id><firstName>Bob</firstName><phoneNumbers type="work">555-1111</phoneNumbers></customer>