LISTSERV mailing list manager LISTSERV 15.5

Help for XML-L Archives

XML-L Archives

XML-L Archives


Next Message | Previous Message
Next in Topic | Previous in Topic
Next by Same Author | Previous by Same Author
Chronologically | Most Recent First
Proportional Font | Monospaced Font


Join or Leave XML-L
Reply | Post New Message
Search Archives

Subject: Re: XML Schema Question
From: Paul Spencer <[log in to unmask]>
Reply-To:General discussion of Extensible Markup Language <[log in to unmask]>
Date:Tue, 28 Aug 2001 10:55:06 +0100

text/plain (72 lines)

For your optional elements, you need to include "minOccurs="0". That might
explain your error message - if you have a bill_to_phone without a
bill_to_contact, you would get the message you quote.

If this is not the problem, can you post the instance as well as the schema.
Also, replace tabs by a couple of spaces - it is much easier to read for
those offering free help.

You might also like to re-think your naming. You have a generic "Address"
type, but all the sub-elements make it a billing address. Why not just use
element names like "city" and "state"? Then you can define an element as:

<xsd:element name="BillingAddress type="Address"/>

Or you could define Company, Address and Contact separately and pull them
together for billing.


Paul Spencer
CTO, alphaXML Ltd
alphaXML is recruiting XML Consultants
+44 (0)1491 630053

-----Original Message-----
From: General discussion of Extensible Markup Language
[mailto:[log in to unmask]]On Behalf Of Lamonde, Steve
Sent: 23 August 2001 21:01
To: [log in to unmask]
Subject: XML Schema Question

Hi list,

I have a newbie question regarding the defining of a sequence in a schema.

My schema (so far) looks like this :

>       <!-- Defining the type Address -->
>               <xsd:complexType name="Address">
>                               <xsd:sequence>
>                                       <xsd:element
> name="bill_to_location_name"            type="xsd:string"/>
>                                       <xsd:element
> name="bill_to_location_address1"     type="xsd:string"/>
>                                       <xsd:element
> name="bill_to_location_address2"     type="xsd:string"/>
>                                       <xsd:element
> name="bill_to_location_city"               type="xsd:string"/>
>                                       <xsd:element
> name="bill_to_location_state"             type="xsd:string"/>
>                                       <xsd:element
> name="bill_to_location_zipcode"        type="xsd:string"/>
>                               </xsd:sequence>
>                               <xsd:element name="bill_to_contact"
> type="xsd:string"/>
>                               <xsd:element name="bill_to_phone"
> type="xsd:string"/>
>           </xsd:complexType>

I am attempting to put all of the "bill_to_location" elements in a standard
sequence, while allowing "bill_to_contact" and "bill_to_phone" to remain
optional. However, I am unable to validate this as I am getting an
"unexpected child element" error on the elements that are not defined in the
sequence. How would I accomplish this?

Thanks in advance,


Back to: Top of Message | Previous Page | Main XML-L Page



CataList Email List Search Powered by the LISTSERV Email List Manager