Support Questions

Find answers, ask questions, and share your expertise

converting extended schema xml to avro

avatar
Explorer

Use case Description:

We are receiving the xml from the source and the expected xmls per day is around 1lakh. we thought is merge all the xmls of a day and convert to avro.

sample data: extended schema xml xsd:

<?xml version="1.0"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="employee" type="fullpersoninfo"/>

<xs:complexType name="personinfo">

<xs:sequence>

<xs:element name="firstname" type="xs:string"/>

<xs:element name="lastname" type="xs:string"/>

</xs:sequence> </xs:complexType>

<xs:complexType name="fullpersoninfo">

<xs:complexContent>

<xs:extension base="personinfo">

<xs:sequence>

<xs:element name="address" type="xs:string"/>

<xs:element name="city" type="xs:string"/>

<xs:element name="country" type="xs:string"/>

</xs:sequence>

</xs:extension>

</xs:complexContent>

</xs:complexType>

</xs:schema>

Issue: i have used databricks jar to convert xml to avro it worked for simple xml, but it didnt work for schema extended xml. Is there any workaround to convert this type of xml to avro

2 REPLIES 2

avatar
Explorer

also another issue we have :

we need to get back the xmls from the avro, whenever we required.

Is there any solution for this.Please let me know.

Thanks in Advance.

avatar
Contributor

Hi

Last week I wrote a version of my XML2CSV but for AVRO

It is still under improvement but you can check it out here

Git Repo xml2avro

Article XML2Avro NiFi processor