[ https://issues.apache.org/jira/browse/XMLBEANS-513?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14212328#comment-14212328 ]
Victor Roldan Betancort commented on XMLBEANS-513: -------------------------------------------------- proposed fix: {code:title=SampleXmlUtil.java|borderStyle=solid} private void processChoice(SchemaParticle sp, XmlCursor xmlc, boolean mixed) { SchemaParticle[] spc = sp.getParticleChildren(); xmlc.insertComment("You have a CHOICE of the next " + String.valueOf(spc.length) + " items at this level"); for (int i = sp.getIntMinOccurs(); i <= sp.getIntMaxOccurs(); i++) { processParticle(spc[i], xmlc, mixed); } } {code} also randomization of the choice could be introduced, but not sure if that is desirable: {code:title=SampleXmlUtil.java|borderStyle=solid} processParticle(spc[pick(spc.length)], xmlc, mixed); {code} > SampleXmlUtil.processChoice() does not honor xs:choice boundaries > ----------------------------------------------------------------- > > Key: XMLBEANS-513 > URL: https://issues.apache.org/jira/browse/XMLBEANS-513 > Project: XMLBeans > Issue Type: Bug > Components: Samples > Affects Versions: Version 2.6 > Reporter: Victor Roldan Betancort > Priority: Minor > > When generating a sample for an XSD making use of xs:choice. SampleXmlUtil > does not consider the boundaries of the choice, but in fact generate an > instance of every element in the choice. This leads to invalid XML, depending > on the value of the minOccurs and maxOccurs. > http://www.w3schools.com/schema/el_choice.asp -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@xmlbeans.apache.org For additional commands, e-mail: dev-h...@xmlbeans.apache.org