[oXygen-user] Improve the schema that gets created with Tools -> Generate/Convert Schema

Danny MacMillan dm-bulk-oxygenxml at mail-eh.ca
Thu Apr 20 15:00:10 CDT 2023


Hello,

I work with a third party application that produces a large number of XML files.
The third party does not make a schema for these files available to me. All I
can do is use Oxygen to infer a schema by pointing it at a population of these
files.

I need to read and manipulate the XML files in Kotlin code. I have been
using Tools -> Generate/Convert Schema to create a schema, then processing that
schema with JAXB as you ordinarily would. The schemas that Oxygen produces are
completely reasonable, but there are some things I'd like to change.

In one case I have an element named 'de' that occurs twice. The Generate/Convert
Schema tool assumes (or seems to) that these elements describe the same kind of
data and it merges their definitions. In fact though, the elements represent
entirely different kinds of data. There's no overlap of attributes between the
'de' elements in the first place and the 'de' elements in the second place. So
Oxygen doesn't mark any of the attributes as required, when in fact, they're all
required in their proper context.

The schema also uses anonymous complex types for each element and I'd rather it
used named types.

I can and will have to edit the schema Oxygen creates to take care of a few
things, but I'd like to minimize the amount of manual editing I have to do,
because I'll have to repeat this process in the future as the third party
software version increases and/or I have to deal with new XML files created from
different environments that happen to include elements I haven't yet
encountered.

What affordances are there for customizing the behaviour of the generate schema
tool? The dialog box doesn't have much on it.

Alternately, are there other tools I could use to post-process the schema in an
automated fashion to get it closer to what I want? I see there's a flatten
schema feature but it didn't do much other than re-order the attributes.

Thanks,

--
Danny MacMillan



More information about the oXygen-user mailing list