xmlxpathjaxbxjcxjb

JAXB binding XPath error


I am attempting to fix a collision when JAXB is generating classes from a set of XSDs. Here's the XML:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" ...>
    ...
    <xs:simpleType name="List_OfferDimensionUOM">
        ...
    </xs:simpleType>
</xs:schema>

and the binding.xjb file:

<jxb:bindings version="1.0"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <jxb:bindings schemaLocation="OTA_Lists.xsd" node="/xs:schema">
        <jxb:bindings node="xs:simpleType[@name='List_OfferDistanceUOM']">
            <jxb:property name="List_OfferDistanceUOMList"/>
        </jxb:bindings>
    </jxb:bindings>
</jxb:bindings>

I have tried a few different combinations of defining the XPath to the desired element, and I keep getting the same error:

compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.

I have searched for a few hours now looking for answers, and have found little help. The error message saying it's in the wrong place doesn't make sense, as I'm fairly certain my XPath is valid. Also, the "other bindings" doesn't make sense, since there is only one at the moment.


Solution

  • I found the problem. It was a step above where I was here. The stack trace that lead me to the "List_OfferDimensionUOM" element didn't point to the root of the problem. The stack trace following that pointed to the correct element, with the statement: "This error is related to the above-mentioned" or something to that effect. -_-