[
https://jira.jboss.org/jira/browse/JBXB-182?page=com.atlassian.jira.plugi...
]
Alexey Loubyansky closed JBXB-182.
----------------------------------
Resolution: Done
It's fixed. Thanks for the report. Although, in case you are using JAXB binding
annotations, I am wandering how the Java class is bound to this schema snippet. Because,
in this testcase the schema is bound by parsing the XSD. AFAIU, normally Java class bound
with JAXB annotations will have to define two different properties for each bar element in
the choice.
Parse error if a choice is between an element and a sequence which
also contains the element
--------------------------------------------------------------------------------------------
Key: JBXB-182
URL:
https://jira.jboss.org/jira/browse/JBXB-182
Project: JBoss XML Binding (JBossXB)
Issue Type: Bug
Environment: JBoss AS5, JBossXB 2.0.0.GA
Reporter: Matt Wringe
Assignee: Alexey Loubyansky
Fix For: JBossXB-2.0.1.Beta2
Attachments: test-schema.tar.gz
JBossXB fails to parse an xml file if the xsd contains a choice between an element and a
sequence which also contains the element.
For example, in the follow the choice should allow the option between specifying A and
then B, or just B
<choice>
<sequence>
<element name="A"/>
<element name="B"/>
</sequence>
<element name="B"/>
</choice>
But, if an xml file used contains just B, an exception will be thrown saying that B is in
the wrong order for the sequence. The expected result would be that it should work since
just having B is valid.
Part of the actual xsd file (
http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd) in
question:
<choice>
<sequence>
<element name="resource-bundle"
type="portlet:resource-bundleType"/>
<element name="portlet-info"
type="portlet:portlet-infoType" minOccurs="0"/>
</sequence>
<element name="portlet-info"
type="portlet:portlet-infoType"/>
</choice>
Part of the stacktrace thrown when a portlet-info element is declared in an portlet.xml
file without resource-bundle:
Caused by: org.jboss.xb.binding.JBossXBRuntimeException: Requested element
{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}portlet-info is not allowed in
this position in the sequence. The next element should be
{http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd}resource-bundle
at
org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:226)
at
org.jboss.xb.binding.sunday.unmarshalling.ChoiceBinding$1.startElement(ChoiceBinding.java:230)
at
org.jboss.xb.binding.sunday.unmarshalling.SequenceBinding$1.startElement(SequenceBinding.java:254)
at
org.jboss.xb.binding.sunday.unmarshalling.ModelGroupBinding$Cursor.startElement(ModelGroupBinding.java:185)
at
org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:451)
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.xinclude.XIncludeHandler.startElement(Unknown Source)
at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown
Source)
Note: when using other tools, the xsd file validates as a proper xsd file, and the xml
file used properly validates against the specified xsd.
More information (stacktraces, actual files used, etc...) is available upon requested.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira