- From: éÏÎÏ× äÍÉÔÒÉÊ ðÅÔÒÏ×ÉÞ <Ionov@ndc.ru>
- Date: Thu, 12 May 2011 22:49:01 +0400
- To: <xmlschema-dev@w3.org>
- Message-ID: <AFDDEC5F6CC6A241A6A08956F1CC578506E0E248@delta.ndc.ru>
>On 11/05/2011 17:25, éÏÎÏ× äÍÉÔÒÉÊ ðÅÔÒÏ×ÉÞ wrote: >> >> Hello. >> >> During a few days I can't solve one problem. >> >> There are two groups of fields in the xml file >> >> first >> >> <field1></field1> >> <field2></field2> >> <field3></field3> >> >> second >> >> <field4></field4> >> <field5></field5> >> >> All fields in the same level of document. >> >> I need to check filled/presents or not at least one of these groups. >> >> >It's not entirely clear to me what your requirement is. Perhaps you want > ><xs:choice minOccurs="1" maxOccurs="unbounded"> ><xs:sequence> ><xs:element name="f1"/> ><xs:element name="f2"/> ><xs:element name="f3"/> ></xs:sequence> ><xs:sequence> ><xs:element name="f4"/> ><xs:element name="f5"/> ></xs:sequence> ></xs:choice> Unfortunately no :-( I have an xml document like as: <Document DOC_ID="1" version="1"> <doc_HEADER> <header_field1>aaa</header_field1> <header_field2>bbb</header_field2> <header_field3>ccc</header_field3> </doc_HEADER> <doc_body> <some_field1>sf1</some_field1> <some_field2>sf2</some_field2> <some_field3>sf3</some_field3> <items> <item> <item_c>item_</item_c> <item_q>1</item_q> </item> </items> <field1></field1> <field2></field2> <field3></field3> <field4></field4> <field5></field5> </doc_body> </Document> And doc_body can be in 3 variants 1. see upper (in xml document sample) 2. <doc_body> <some_field1>sf1</some_field1> <some_field2>sf2</some_field2> <some_field3>sf3</some_field3> <items> <item> <item_c>item_</item_c> <item_q>1</item_q> </item> </items> <field1></field1> <field2></field2> <field3></field3> </doc_body> 3. <doc_body> <some_field1>sf1</some_field1> <some_field2>sf2</some_field2> <some_field3>sf3</some_field3> <items> <item> <item_c>item_</item_c> <item_q>1</item_q> </item> </items> <field4></field4> <field5></field5> </doc_body> Variant <doc_body> <!- some firlds --> <field2></field2> <field3></field3> <field5></field5> </doc_body> Or something like is wrong. And now XSD sees so <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> ššššššššššš <xsd:include schemaLocation="common_types.xsd"/> ššššššššššš <xsd:element name="Document"> ššššššššššššššššššššššš <xsd:complexType> šššššššššššššššššššššššššššššššššš <xsd:all> šššššššššššššššššššššššššššššššššššššššššššššš <xsd:element name="doc_HEADER" type="type_doc_HEADER"/> šššššššššššššššššššššššššššššššššššššššššššššš <xsd:element name="ERRORS" type="type_ERRORS" minOccurs="0"/> šššššššššššššššššššššššššššššššššššššššššššššš <xsd:element name="doc_body" type="type_doc_body"/> šššššššššššššššššššššššššššššššššš </xsd:all> šššššššššššššššššššššššššššššššššš <xsd:attribute name="DOC_ID" type="xsd:int"/> šššššššššššššššššššššššššššššššššš <xsd:attribute name="version" type="xsd:int"/> ššššššššššššššššššššššš </xsd:complexType> ššššššššššš </xsd:element> ššššššššššš <xsd:complexType name=" type_doc_body"> ššššššššššššššššššššššš <xsd:all> šššššššššššššššššššššššššššššššššš <xsd:element name=" some_field1" minOccurs="0"/> šššššššššššššššššššššššššššššššššš <xsd:element name=" some_field2" minOccurs="0"/> šššššššššššššššššššššššššššššššššš <xsd:element name=" some_field3" minOccurs="0"/> <xsd:element name="field1"/> <xsd:element name="field2"/> <xsd:element name="field3"/> <xsd:element name="field4"/> <xsd:element name="field5"/> ššššššššššššššššššššššš </xsd:all> ššššššššššš </xsd:complexType> </xsd:schema> How I can change XSD for check all variants of doc_body ?
Received on Thursday, 12 May 2011 18:49:34 UTC