highsource / jaxb2-basics

Useful plugins and tools for JAXB2.
BSD 2-Clause "Simplified" License
108 stars 54 forks source link

Ability to selectively disable simplification #173

Open sebersole opened 1 month ago

sebersole commented 1 month ago

I'm not exactly sure if this is a feature request or a question, but I am not sure of a better place to ask.

I am using the Simplify Plugin and it works outstanding. What I see is that the plugin aggresively simplifies all repeatable choices. Generally this is perfect; however I do have a situation where the order of elements within a choice does matter in my schema. But I have been unable to figure out how to make Simplify Plugin NOT do the simplification in just that case.

Is that possible currently? Or is that something for which you'd consider adding support?

Thanks!

If it helps, the fragment of the schema is this complex-type:

    <xsd:complexType name="many-to-one">
        <xsd:sequence>
            <xsd:choice>
                <xsd:sequence>
                    <xsd:choice>
                        <xsd:sequence>
                            <xsd:sequence>
                                <xsd:choice>
                                    <xsd:element name="join-column" type="orm:join-column" minOccurs="0" maxOccurs="unbounded"/>
                                    <xsd:element name="join-formula" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
                                </xsd:choice>
                                ...
                            </xsd:sequence>
                            ...
                        </xsd:sequence>
                        ...
                    </xsd:choice>
                    ...
                </xsd:sequence>
                ...
            </xsd:choice>
            ...
        </xsd:sequence>
    </xsd:complexType>

Currently, with Simplify Plugin, XJC produces:

    protected List<JaxbJoinColumnImpl> joinColumns;

    protected List<String> joinFormulas;

In this case, the order is important so I really need the heterogeneous form:

    protected List<Serializable> joinColumnsOrFormulas;

Thanks again!

laurentschoelens commented 1 month ago

Hi @sebersole

First, thanks for using jaxb2-basics. It's now part of jaxb-tools project, which was former repository of maven-jaxb2-plugin. See Readme for new location.

To answer your question, you should give a try to the ignored special binding with the simplify prefix bound to simplify namespace : see excluding properties section in wiki.

If you got any more question, feel free to ask (you'll also get more support from new repository location).

Regards Laurent