Avro-Schema-Generator
Avro-Schema-Generator copied to clipboard
Unable to handle defined type 'javax.xml.datatype.Duration'
Hi,
Thanks for the quick reply to the previous question. That helped me to get schemagen to run on a large XSD we received from another organization. There was only one type of error; on fields of type "xs:duration."
The error we get when fields fo type "xs:duration" are present is:
"Unable to handle defined type 'javax.xml.datatype.Duration'"
See com.nokia.util.avro.schemagen.SchemagenHelper.java, line 243.
This links shows the JAXB mapping for "xs:duration" is 'javax.xml.datatype.Duration', which makes sense.
http://docs.oracle.com/javase/tutorial/jaxb/intro/bind.html
This link shows the XML definition of "duration" type, with example values:
http://www.w3.org/TR/xmlschema-2/#duration
This class seems to create a Duration for us, but only after we do the work of parsing out the individual fields from the string.
http://xerces.apache.org/xerces2-j/javadocs/api/javax/xml/datatype/DatatypeFactory.html
As a workaround, I edited the .xsd file to say these fields are of type xs:string.
Thanks, Vick
Some 'special' xml types like dates and big numbers are handled specially.
There is room to add a test for (what I presume will come out as) javax.xml.datatype.Duration
. Assuming JAXB provides that, the question is, what avro type does this need to become?