Skip to main content

"catch-all" property and xsd attribute ref= how to bind

5 replies [Last post]
utuba
Offline
Joined: 2006-07-18
Points: 0

I'm trying to use jaxb to generate objects for the following xsd, using bindings defined below

================= Bindings

-->

=================== XSD chunk

AdministrativeArea is referenced twice and causes the catch all mapping in the object. When I try and use the binding above, it results in an error:

[ERROR] [ERROR] compiler was unable to honor this property customization. It is attached to a wrong place, or its inconsistent with other bindings.
[ERROR] line 12 of file:/home/utuba/documents/development/iizuka/component/snen-message/src/main/resources/bindings.xjb
[ERROR]
[ERROR] [ERROR] (the above customization is attached to the following location in the schema)
[ERROR] line 100 of file:/home/utuba/documents/development/iizuka/component/snen-message/src/main/resources/bs7666-v2-0.xsd

which I guessing is because I'm trying to add an attribute via the bindings which is not valid, i.e. "name". Is there a way of overriding this binding?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
utuba
Offline
Joined: 2006-07-18
Points: 0
sekhar
Offline
Joined: 2003-06-25
Points: 0

The property customization is valid for an . Can you post a more complete schema (for example showing the complex types containing the xs:choice element) that I can run through xjc ?

Also, I don't see the relationship between this problem and the problem in the other thread that you referenced.

utuba
Offline
Joined: 2006-07-18
Points: 0

The relationship is that they are doing a similar thing:













They have two elements with the same name in the choice, one in the sequence, the other outside it. Only in their example the are createting a new element each time but with the same name. I'm using a ref attribute to reference an element defined elsewhere in the document. e.g.













For some reason I can't use the bindings to override the ref name when generating classes for this complex type structure.

Message was edited by: utuba

sekhar
Offline
Joined: 2003-06-25
Points: 0

Please file an issue against this on https://jaxb.dev.java.net/issues . I did verify using JAXB 2.0.1 that the
customization does not remove the binding to catch-all property; this was one of the intended uses for the
customization.

kohsuke
Offline
Joined: 2003-06-09
Points: 0

The best way to avoid a problem like this is to use the simple binding mode.

http://weblogs.java.net/blog/kohsuke/archive/2006/03/simple_and_bett.html

It can handle the content model like this without any need of customization.