Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to parse the following xsd without complex types #6

Open
tikaa opened this issue Feb 25, 2016 · 1 comment
Open

Unable to parse the following xsd without complex types #6

tikaa opened this issue Feb 25, 2016 · 1 comment

Comments

@tikaa
Copy link

tikaa commented Feb 25, 2016

<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:sobject.partner.soap.sforce.com"> <xs:element name="type" type="xs:string"/> <xs:element name="Id" nillable="true" type="xs:string"/> <xs:element name="Name" type="xs:string"/> <xs:element name="Amount" type="xs:float"/> </xs:schema>

In the case the XSD not having complex types, the java class is generated from JAXB, but the avro schema is not generated, If I add a complex type to this as follows,

<?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="urn:sobject.partner.soap.sforce.com"> <xs:element name="type" type="xs:string"/> <xs:element name="Id" nillable="true" type="xs:string"/> <xs:element xmlns:urn="urn:sobject.partner.soap.sforce.com" name="Account" type="urn:AccountType"/> <xs:element name="Name" type="xs:string"/> <xs:element name="Amount" type="xs:float"/> <xs:complexType name="AccountType"> <xs:sequence> <xs:element type="xs:string" name="type"/> <xs:element type="xs:string" name="Id" nillable="true"/> <xs:element type="xs:string" name="Name"/> </xs:sequence> </xs:complexType> </xs:schema>
then, avro schema is generated only for the complex type parameters and the root level parameters such as
<xs:element name="Name" type="xs:string"/> <xs:element name="Amount" type="xs:float"/>

are ignored...

@UnquietCode
Copy link
Contributor

This behavior seems to be currently unsupported. If you look here you can see that only the classes and enums generated by JAXB are turned into an avro schema. At the moment I'm not sure how to do that, but it could probably be done by synthesizing some root class and manually placing the root elements on it. Either that or JAXB is already creating a root class but it's not in the usual classes list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants