Hi Patric,<br><br>thanks for the advice.<br><br>Does that mean I have to use an intermediate schema to define the choice?<br><br>Currently, I have this:<br><br>test.xsd //my example below shows the complexType definition<br>
module1.xsd //a simple opencms schema to define a sub-module<br>module2.xsd //another simple opencms schema to define a sub-module<br><br>So what I want to do is to have a list of "modules" (or elements) in the test files where the modules can be of one of those two types.<br>
<br>Creating another complextType in the test.xsd schema like the following, results in the error "Exactly 2 complex type definitions are required, not 3."<br><br> <!-- 3. Root element name and type of our XML type --><br>
<xsd:element name="Tests" type="OpenCmsTests"/><br>
<br>
<!-- 4. Definition of the type described above --><br>
<xsd:complexType name="OpenCmsTests"><br>
<xsd:sequence><br>
<xsd:element name="Test" type="OpenCmsTest"<br>
minOccurs="0" maxOccurs="unbounded"/><br>
</xsd:sequence><br>
</xsd:complexType><br>
<br>
<!-- 5. Data field definitions --><br>
<xsd:complexType name="OpenCmsTest"><br>
<xsd:sequence><br>
<!-- <br>
<xsd:element name="MT1" type="OpenCmsModule1" minOccurs="0" /><br>
<xsd:element name="MT2" type="OpenCmsModule2" minOccurs="0" /><br>
--><br>
<xsd:element name="Text" type="OpenCmsText"<br>
minOccurs="0"/> <br>
</xsd:sequence><br>
<br>
<!-- 6. locale attribute is required --><br>
<xsd:attribute name="language" type="OpenCmsLocale"<br>
use="optional"/><br>
</xsd:complexType><br>
<br>
<xsd:complexType name="OpenCmsText"> <br>
<xsd:choice> <br>
<xsd:element name="Headline" type="OpenCmsString" minOccurs="0" /><br>
<xsd:element name="Title" type="OpenCmsString" minOccurs="0" /> <br>
</xsd:choice><br>
<br>
<xsd:attribute name="language" type="OpenCmsLocale" use="optional"/> <br>
</xsd:complexType><br><br>Note that the names are just arbitrary chosen, in order to do some tests.<br><br>Should the structure instead be like this?<br><br>test.xsd //this would contain a list of the type defined by modulechoice.xsd<br>
modulechoice.xsd //would only contain the element with the xsd:choice between the modules<br>module1.xsd //a simple opencms schema to define a sub-module<br>
module2.xsd //another simple opencms schema to define a sub-module<br><br><br>Thanks for your effort.<br><br><br>Regards,<br><br>Thomas<br><br><div class="gmail_quote">2011/9/28 patric dosch <span dir="ltr"><<a href="mailto:patric.dosch@virtual-identity.com">patric.dosch@virtual-identity.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div link="blue" vlink="purple" lang="DE"><div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Hey, <u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">You have to make the choice-element in your own schema. <u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F;background:silver">xsd:complexType</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"OpenCmsArticle"</span></i><span style="color:teal">></span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:sequence</span><span style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:element</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"Title"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"<u>OpenCmsString</u>"</span></i><span style="color:teal">/></span><span style="color:black"> <u></u><u></u></span></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt;text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black">[…] </span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:35.4pt;text-indent:35.4pt;text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:element</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"ContextTeaser"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"</span><u><span style="color:#F79646">OpenCmsContextTeaser</span></u><span style="color:#2A00FF">"</span></i> <span style="color:#7F007F">minOccurs</span><span style="color:black">=</span><i><span style="color:#2A00FF">"0"</span></i> <span style="color:#7F007F">maxOccurs</span><span style="color:black">=</span><i><span style="color:#2A00FF">"unbounded"</span></i><span style="color:teal">/></span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:sequence</span><span style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-indent:35.4pt;text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:attribute</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"language"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"<u>OpenCmsLocale</u>"</span></i> <span style="color:#7F007F">use</span><span style="color:black">=</span><i><span style="color:#2A00FF">"required"</span></i><span style="color:teal">/></span><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F;background:silver">xsd:complexType</span><span style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span lang="EN"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:complexType</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"</span><span style="color:#F79646">OpenCmsContextTeaser</span><span style="color:#2A00FF">"</span></i><span style="color:teal">></span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:choice</span><span style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:element</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"TextTeaser"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"<u>OpenCmsTextTeaser</u>" </span></i><span style="color:#7F007F">minOccurs</span><span style="color:black">=</span><i><span style="color:#2A00FF">"0"</span></i><span style="color:teal">/></span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:element</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"LinkListTeaser"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"<u>OpenCmsLinkListTeaser</u>"</span></i> <span style="color:#7F007F">minOccurs</span><span style="color:black">=</span><i><span style="color:#2A00FF">"0"</span></i><span style="color:teal">/></span><span style="color:black"> </span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:element</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"Contact"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"<u>OpenCmsVfsFile</u>"</span></i> <span style="color:#7F007F">minOccurs</span><span style="color:black">=</span><i><span style="color:#2A00FF">"0"</span></i><span style="color:teal">/></span><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:choice</span><span style="font-size:10.0pt;font-family:Consolas;color:teal">></span><span style="font-size:10.0pt;font-family:Consolas"><u></u><u></u></span></p>
<div class="im"><p class="MsoNormal" style="text-autospace:none"><span style="font-size:10.0pt;font-family:Consolas;color:black"> </span><span style="font-size:10.0pt;font-family:Consolas;color:teal"><</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:attribute</span><span style="font-size:10.0pt;font-family:Consolas"> <span style="color:#7F007F">name</span><span style="color:black">=</span><i><span style="color:#2A00FF">"language"</span></i> <span style="color:#7F007F">type</span><span style="color:black">=</span><i><span style="color:#2A00FF">"<u>OpenCmsLocale</u>"</span></i> <span style="color:#7F007F">use</span><span style="color:black">=</span><i><span style="color:#2A00FF">"optional"</span></i><span style="color:teal">/></span><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:teal"></</span><span style="font-size:10.0pt;font-family:Consolas;color:#3F7F7F">xsd:complexType</span><span style="font-size:10.0pt;font-family:Consolas;color:teal">><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:Consolas;color:teal"><u></u> <u></u></span></p></div><p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D">Regards, Patric<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;color:#1F497D"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt">Von:</span></b><span style="font-size:10.0pt"> <a href="mailto:opencms-dev-bounces@opencms.org" target="_blank">opencms-dev-bounces@opencms.org</a> [mailto:<a href="mailto:opencms-dev-bounces@opencms.org" target="_blank">opencms-dev-bounces@opencms.org</a>] <b>Im Auftrag von </b>Thomas Göttlich<br>
<b>Gesendet:</b> Mittwoch, 28. September 2011 11:55<br><b>An:</b> The OpenCms mailing list<br><b>Betreff:</b> [opencms-dev] XML-Content xsd:choice<u></u><u></u></span></p><div><div></div><div class="h5"><p class="MsoNormal">
<u></u> <u></u></p><p class="MsoNormal">Hi, <br><br>how would I use the xsd:choice element in my schemas?<br><br>Currently I tried the following but I get "invalid schema structure" errors:<br><br><br><xsd:complexType name="OpenCmsTest"><br>
<xsd:sequence><br> <xsd:choice><br> <!-- <br> <xsd:element name="MT1" type="OpenCmsModule1" minOccurs="0" /><br> <xsd:element name="MT2" type="OpenCmsModule2" minOccurs="0" /><br>
--><br> <xsd:element name="Headline" type="OpenCmsString"<br> minOccurs="1" maxOccurs="1" /><br> <xsd:element name="Title" type="OpenCmsString"<br>
minOccurs="1" maxOccurs="1" /><br> </xsd:choice><br> </xsd:sequence><br> <br> <!-- 6. locale attribute is required --><br> <xsd:attribute name="language" type="OpenCmsLocale"<br>
use="optional"/><br> </xsd:complexType><br><br>Unfortunately I did find any documentation or examples, just notes that it is now possible to use that.<br><br>Thanks in advance,<br><br>Thomas<u></u><u></u></p>
</div></div></div><br><span style="font-size:8pt;color:rgb(169, 169, 169)"><span style="font-family:Arial;font-size:8pt">_____________________________________________________________________<br><br>
<span style="font-size:8pt;color:rgb(169, 169, 169)">Vorstand: Ralf Heller, Udo Möbes <br>
Vorsitzende des Aufsichtsrates: Kirsten Heller <br>
Sitz der Gesellschaft: Gruenwaelderstrasse 10-14, D-79098 Freiburg <br>
Amtsgericht Freiburg HRB 6218<br>
<br>
Versand am 28.09.2011 12:30 von dosch patric<br>
Validation-Code: 4055011134176</span><br>
</span></span>
<br></div>
<br><br>
_______________________________________________<br>
This mail is sent to you from the opencms-dev mailing list<br>
To change your list options, or to unsubscribe from the list, please visit<br>
<a href="http://lists.opencms.org/mailman/listinfo/opencms-dev" target="_blank">http://lists.opencms.org/mailman/listinfo/opencms-dev</a><br></blockquote></div><br>