Multiple @XmlElement with the same @XmlElementWrapper
dmlloyd Mar 10, 2010 9:26 PMAs the subject hints, I'm trying to do this:
// ... public List<SocketAddressMetaData> getBindings() { return bindings; } @XmlElementWrapper(name = "bind") @XmlElement(name = "bind-address") public void setBindings(final List<SocketAddressMetaData> bindings) { this.bindings = bindings; } public List<ManagedBindingMetaData> getManagedBindings() { return managedBindings; } @XmlElementWrapper(name = "bind") @XmlElement(name = "managed-binding") public void setManagedBindings(final List<ManagedBindingMetaData> managedBindings) { this.managedBindings = managedBindings; } // ...
It doesn't complain when it reads the annotations, however when it parses I get:
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: {urn:jboss:xnio:2.1}managed-binding not found as a child of {urn:jboss:xnio:2.1}bind in sequence: {urn:jboss:xnio:2.1}bind-address* at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:391) at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:401) at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source) at org.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source) at org.apache.xerces.xinclude.XIncludeHandler.emptyElement(Unknown Source) at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source) at org.apache.xerces.parsers.XMLParser.parse(Unknown Source) at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source) at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:199) ... 44 more
The enclosing type has "propOrder = {}", but I wouldn't think that would apply to the intermediate wrapping type which I'd want to be a "choice" with "maxOccurs = "unbounded"".
Ideas?