Skip to content

neither as specific field nor 'any' element #15

Description

@nag9s

i am getting the following error when i ran the command

C:\work\xml-avro\target>java -Xmx1048m -jar xml-avro-0.0.1-SNAPSHOT.jar Decoding
Request.xsd abc_DecoP_Max_20151022080132962.xml

DecodingRequest.xsd -> DecodingRequest.avsc
abc_DecoP_Max_20151022080132962.xml -> abc_DecoP_Max_20151022080132962.avro
Exception in thread "main" ly.stealth.xmlavro.ConverterException: Could not find
field b in Avro Schema DecodingRequestCT , neither as specific field n
or 'any' element
at ly.stealth.xmlavro.DatumBuilder.setFieldFromNode(DatumBuilder.java:23
8)
at ly.stealth.xmlavro.DatumBuilder.createRecord(DatumBuilder.java:183)
at ly.stealth.xmlavro.DatumBuilder.createNodeDatum(DatumBuilder.java:104
)
at ly.stealth.xmlavro.DatumBuilder.createDatum(DatumBuilder.java:90)
at ly.stealth.xmlavro.DatumBuilder.createDatum(DatumBuilder.java:85)
at ly.stealth.xmlavro.DatumBuilder.createDatum(DatumBuilder.java:80)
at ly.stealth.xmlavro.DatumBuilder.createDatum(DatumBuilder.java:67)
at ly.stealth.xmlavro.Converter.main(Converter.java:136)

Unfortunately, i cant provide you the xsd , xml files as those were confidential. However, i can say that the field in question "b" is available in xsd but i didnt see the field in generated avro schema.

<xsd:complexType name="DecodingResponseCT">
xsd:sequence
<xsd:element name="a" type="xsd:string" />
<xsd:element name="b" type="xsd:string" />
<xsd:element name="c" type="xsd:string" />
<xsd:element name="errorMessages" type="ErrorMessagesCT"
minOccurs="0" maxOccurs="1" />
<xsd:element name="e" type="WarningMessagesCT"
minOccurs="0" maxOccurs="1" />
<xsd:element name="f" type="InfoMessagesCT"
minOccurs="0" maxOccurs="1" />
<xsd:element name="g" type="QueryResultCT"
minOccurs="0" maxOccurs="unbounded" />
/xsd:sequence
/xsd:complexType

part of the snippet from generated avsc file

"fields" : [ {
"name" : "a",
"type" : "string",
"source" : "element a"
}, {
"name" : "userId",
"type" : "string",
"source" : "element userId"
}, {
"name" : "c",
"type" : "string",
"source" : "element c"
}, {
"name" : "d",
"type" : [ "null", "string" ],
"source" : "element d"
}, {

Please note, the other fields under the same parent were available in avro schema. Please let me know if you want me to provide any other details.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions