Closed iWantToKeepAnon closed 6 months ago
Yeah this definitely does not parse all or even most XSDs, just simple ones.
But yes this match
looks like it could try to handle a sequence inside a choice. Maybe it can just make a recursive call? Probably several parts of this should handle more complex structure just by calling back to the same method, even.
I don't work on this and it's not maintained now that it's copied into Spark 4, but if you have a straightforward change that makes your case work, I can get it in here and copy to Spark.
Thanks for the reply. I don't have scala experience or tooling and our schema uses groups and other unsupported syntax; so I can't take the time to pursue creating a PR. This is a great tool, I wish it fit our project.
https://github.com/databricks/spark-xml/blob/b2611bd20e917a75b7e96f5eb5cbc78f5ab21740/src/main/scala/com/databricks/spark/xml/util/XSDToSchema.scala#L223
I looks like choice can only have an element or xs:Any per line 223 of v0.17.0. Below is a snippet of an industry standard flight identification XSD. If I remove the choice or the sequence it works, but fails w/ both. The XSD is saying your key has to be (Flt# and iataCode) or just (Flt#). That is the choice of a sequence or an element. The failure stacktrace is below the XSD snippet.