Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I tried combining the two schemas (that use the same element name) as you suggested earlier. </p> <p><em><strong>(note: I had to use the "Answer your own question" posting in order to include the examples, since the comment allows only limited space)</em></strong></p> <p>One problem I am having is that some of the sub-elements in the actual schema (I cant post the actual schema) use the same names (I had to recreate, below, to illustrate this case... -notice that schema1 and schema2 "group"s contain elements having the same name)... </p> <p>Here is the schemacombo.xsd: </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"&gt; &lt;xs:group name="schema1"&gt; &lt;xs:sequence&gt; &lt;xs:element name="AA"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="CC1" type="xs:string"/&gt; &lt;xs:element name="CC2" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="BB"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="DD1" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:group&gt; &lt;xs:group name="schema2"&gt; &lt;xs:sequence&gt; &lt;xs:element name="AA"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="CC1" type="xs:string"/&gt; &lt;xs:element name="CC2" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;xs:element name="BB"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="DD1"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; &lt;xs:element name="EE1" type="xs:string"/&gt; &lt;xs:element name="EE2" type="xs:string"/&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:sequence&gt; &lt;/xs:group&gt; &lt;xs:element name="A"&gt; &lt;xs:complexType&gt; &lt;xs:choice&gt; &lt;xs:group ref="schema1" /&gt; &lt;xs:group ref="schema2" /&gt; &lt;/xs:choice&gt; &lt;/xs:complexType&gt; &lt;/xs:element&gt; &lt;/xs:schema&gt; </code></pre> <p>I've tried running </p> <pre><code>xjc schemacombo.xsd -b binding.xjb </code></pre> <p>...where binding.xjb contains </p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;jxb:bindings xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xs="http://www.w3.org/2001/XMLSchema" jaxb:version="2.0"&gt; &lt;jxb:bindings schemaLocation = "schemacombo.xsd" node="/xs:schema"&gt;&gt; &lt;jxb:schemaBindings&gt; &lt;jxb:bindings node="xs:group[@name='schema2']"&gt; &lt;jxb:nameXmlTransform&gt; &lt;jxb:modelGroupName suffix="2"/&gt; &lt;/jxb:nameXmlTransform&gt; &lt;/jxb:bindings&gt; &lt;/jxb:schemaBindings&gt; &lt;/jxb:bindings&gt; &lt;/jxb:bindings&gt; </code></pre> <p>...-A weak attempt, I know, and it does not work...i.e., running this yields:</p> <pre><code>parsing a schema... [ERROR] cos-element-consistent: Error for type '#AnonType_A'. Multiple elements with name 'AA', with different types, appear in the model group. line 49 of file:/C:/AAAAA_delegate/schemacombo.xsd [ERROR] cos-nonambig: AA and AA (or elements from their substitution group) violate "Unique Particle Attribution". During validation against this schema, ambiguity would be created for those two particles. line 49 of file:/C:/AAAAA_delegate/schemacombo.xsd Failed to parse a schema. </code></pre> <p>Do you have any suggestion for bindings statements or annotations that would fix this. --Note, I have still not seen customized binds work, yet. </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload