---------- Forwarded message ---------- From: shashi kumar <kshashi...@gmail.com> Date: Tue, May 23, 2017 at 11:20 AM Subject: Fwd: Converting xml to avro and getting back the same xml from avro. To: user-i...@avro.apache.org, user-...@avro.apache.org
---------- Forwarded message ---------- From: shashi kumar <kshashi...@gmail.com> Date: Mon, May 22, 2017 at 6:46 PM Subject: Converting xml to avro and getting back the same xml from avro. Hello All, Github source code used. https://github.com/elodina/xml-avro By using the above source, i am able to generate the avro schema (.avsc file ) and avro file by giving xsd and xml. While i need to generate back the xml from the avro file generated. It is giving the error as "Exception in thread "main" java.lang.ExceptionInInitializerError Caused by: org.apache.avro.SchemaParseException: No protocol name specified: " Then in the avro schema i gave the protocol has : "namespace": "xs", "protocol": "HelloWorld", "doc": "Protocol Greetings", Or "namespace": "http://www.w3.org/2001/XMLSchema", "protocol": "HelloWorld", "doc": "Protocol Greetings", I tried giving this protocol and tried to generate the xml from the avro. i got another error: Exception in thread "main" java.util.NoSuchElementException Is there any better solution for this ?. Attachment: student_2.xml and xml_2.xsd is used for generating the avro schema and avro file. After getting the avro file, i tried the avro schema generated and avro file to generate back the xml. Thanks, Shashi
xml.avsc
Description: Binary data
xml_2.xsd
Description: Binary data
<?xml version = "1.0"?> <class> <student rollno = "393"> <firstname>Dinkar</firstname> <lastname>Kad</lastname> <nickname>Dinkar</nickname> <marks>85</marks> </student> <student rollno = "493"> <firstname>Vaneet</firstname> <lastname>Gupta</lastname> <nickname>Vinni</nickname> <marks>95</marks> </student> <student rollno = "593"> <firstname>Jasvir</firstname> <lastname>Singh</lastname> <nickname>Jazz</nickname> <marks>90</marks> </student> </class>
student_3.avro
Description: Binary data