W3C home > Mailing lists > Public > xmlschema-dev@w3.org > February 2003

Re: Help! Can't XML Schema do this?

From: <bibhaker.saran@txu.com.au>
Date: Tue, 25 Feb 2003 11:31:05 +1100
To: Norris Merritt <norris.merritt@peregrine.com>
Cc: <xmlschema-dev@w3.org>
Message-ID: <OFA7C144EF.D97CAB2F-ONCA256CD8.0002AE2C@txu.com.au>


Norris,
Yes, add an attribute name of xsd:string type to your complexType "array".
Cheers
Bibhakar Saran
-------------------------------------------------------
B2B Technical Architect
TXU IT Architecture & Planning
Level 15 452 Flinders St, Melbourne
Phone : (+61 3) 9229 6153
Mobile: 0411 203036
Email: bibhaker.saran@txu.com.au


                                                                                                                       
                      Norris Merritt                                                                                   
                      <norris.merritt@per         To:      "'xmlschema-dev@w3.org'" <xmlschema-dev@w3.org>             
                      egrine.com>                 cc:                                                                  
                      Sent by:                    Subject: Help! Can't XML Schema do this?                             
                      xmlschema-dev-reque                                                                              
                      st@w3.org                                                                                        
                                                                                                                       
                                                                                                                       
                      25/02/2003 10:30 AM                                                                              
                                                                                                                       
                                                                                                                       





I'm having trouble trying to create one small set of reusable .xsd
definitions that I can use to describe a lot of existing xml fragments that
follow the simple pattern shown below, without having to hard-code any
element names.  If I have to define a complex type for each such XML
fragment, and hard-code the element names for the contained child elements,
it forces me to replicate the same schema definitions many many times, even
though all the XML fragments have the exact same structure and follow the
same rules. They just have different element names. For example:

<Array1 mytype="array">
  <Array1Elem mytype="string">foo</Array1Elem>
  <Array1Elem mytype="string">bar</Array1Elem>
</Array1>

I have many occurrences of XML fragments like the one shown above. It is
infeasible to duplicate the schema code for each possible element name.  So
I just want to define some complex types where the actual element names can
vary.  All of the contained elements always have the same name and type.

Can this be done using abstract elements? Substitution groups? Some other
feature? Not at all?










**********************************************************************************************
This email and any files transmitted with it may be confidential and are intended
solely for the use of the individual or entity to whom they are addressed. Any
confidentiality is not waived or lost because this email has been sent to you by
mistake. This email may contain personal information of individuals, and be 
subject to Commonwealth and/or State privacy laws in Australia. This email
is also subject to copyright. If you are not the intended recipient, you must not
 read, print, store, copy, forward  or use this email for any reason, in accordance
 with privacy and copyright laws. If you have received this email in error, please
notify the sender by return email, and delete this email from your inbox.
************************************************************************************TXUAU
Received on Monday, 24 February 2003 21:45:51 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:36 GMT