Re: special tags

At 2006-09-21 18:34 +0200, Debora Vanni wrote:
>That it doesn't work: it says that element choice has an invalid
>content.

A transcript below shows it working with MSV, Altova, Saxon and Xerces.

>I didn't find anywhere that I can write both "all" and "choice" inside
>the same complextype, is that possible?
>I probably need somenthing like "union" but for complex type, is there
>somenting like that?

You haven't indicated why you are using 
xs:all.  I've learned that when order is not 
important, it is better for downstream processing 
to impose one.  As well, the user doesn't get the 
impression that they have to guess which order to 
use, nor do they think they are getting any 
additional semantic by choosing a particular order.

I'm sorry I have no other suggestions to offer you.

. . . . . . . . . . . . Ken

T:\ftemp>type debora.xml
<?xml version="1.0" encoding="US-ASCII"?>
<test>
           <parameters>
                 <family-name>Rossi</family-name>
                 <first-name>Paolo</first-name>
                 <cod-fisc>123123123</cod-fisc>
               <home-address>via Vai</home-address>
               <cell-phone>12354356</cell-phone>
               <e-mail> pippo@yrr.it.net</e-mail>
             </parameters>

           <parameters>
                 <family-name>Rossi</family-name>
                 <first-name>Paolo</first-name>
                 <cod-fisc>123123123</cod-fisc>
               <home-address>via Vai</home-address>
               <cell-phone>12354356</cell-phone>

             </parameters>

           <parameters>
                 <family-name>Rossi</family-name>
                 <first-name>Paolo</first-name>
                 <cod-fisc>123123123</cod-fisc>
               <home-address>via Vai</home-address>

               <e-mail> pippo@yrr.it.net</e-mail>
             </parameters>
</test>

T:\ftemp>type debora.xsd
<?xml version="1.0" encoding="US-ASCII"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="test">
   <xs:complexType>
     <xs:sequence>
       <xs:element ref="parameters" maxOccurs="unbounded"/>
     </xs:sequence>
   </xs:complexType>
</xs:element>

<xs:element name="parameters">
   <xs:complexType>
     <xs:sequence>
       <xs:element name="family-name" type = "simple_text"/>
       <xs:element name="first-name" type = "simple_text"/>
       <xs:element name="cod-fisc" type = "alfa_numeric"/>
       <xs:element name="home-address" type = "simple_text"/>
       <xs:choice>
          <xs:sequence>
            <xs:element name="cell-phone" type = "simple_text"/>
            <xs:element name="e-mail" type = "simple_text" minOccurs="0"/>
          </xs:sequence>
          <xs:sequence>
            <xs:element name="e-mail" type = "simple_text"/>
            <xs:element name="cell-phone" type = "simple_text" minOccurs="0"/>
          </xs:sequence>
       </xs:choice>
     </xs:sequence>
   </xs:complexType>
</xs:element>

<xs:simpleType name="simple_text">
   <xs:restriction base="xs:string"/>
</xs:simpleType>

<xs:simpleType name="alfa_numeric">
   <xs:restriction base="xs:string"/>
</xs:simpleType>

</xs:schema>

T:\ftemp>call w3cschema-msv debora.xsd debora.xml
No validation errors.

T:\ftemp>call w3cschema-altova debora.xsd debora.xml
Altova
The XML data is valid

T:\ftemp>call w3cschema-saxon debora.xsd debora.xml

T:\ftemp>call w3cschema-xerces debora.xsd debora.xml
No validation errors.


--
UBL/XML/XSLT/XSL-FO training: Vårø, Denmark 2006-10-02/06,11-20/24
UBL International 2006  2006-11-13/17 http://www.ublconference.com
World-wide corporate, govt. & user group UBL, XSL, & XML training.
G. Ken Holman                 mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd.          http://www.CraneSoftwrights.com/x/
Box 266, Kars, Ontario CANADA K0A-2E0    +1(613)489-0999 (F:-0995)
Male Cancer Awareness Aug'05  http://www.CraneSoftwrights.com/x/bc
Legal business disclaimers:  http://www.CraneSoftwrights.com/legal

Received on Friday, 22 September 2006 00:06:03 UTC