3

I have a structured XML data. I want to convert this XML to AVRO(or JSON) using AVRO schema. I've defined the AVRO schema for this XML. But how can I convert it in java?

Actually, I want to convert received xml data from the server to the JSON/AVRO format in the Kafka Connect. What is the best way to do this?

ago
  • 59
  • 2
  • 8

1 Answers1

1

Since you're using Kafka Connect, you can use the XML Single Message Transform to do exactly this.

Robin Moffatt
  • 30,382
  • 3
  • 65
  • 92
  • Thank you so much for your response. I've looked this transform. But my received xml may be have different structure. I'm using a global xml standart, and this standart have different versions such as 1.2, 1.3 etc. Each of them has different XSD schema. I want to convert xml to json based on the avro schema rather than the using xsd. For this, I'll define a global AVRO schema. For example, Apache Nifi, converts XML to JSON or AVRO using AVRO schema. In this case, I can define a global XSD schema, and use this transform. But, XSD schema is very complicated for me. Which options is better? – ago Aug 09 '19 at 15:11