W3C home > Mailing lists > Public > xmlschema-dev@w3.org > December 2001

Re: Generating dynamic "choice" content

From: <noah_mendelsohn@us.ibm.com>
Date: Tue, 4 Dec 2001 17:38:37 -0500
To: Piccand Régis <regis.piccand@imtf.ch>
Cc: xmlschema-dev@w3.org
Message-ID: <OF223B64A3.15329E28-ON85256B18.007CC2C5@lotus.com>
A schema is an XML document, and it's also a text file.  You can generate 
and manipulate schemas using a very broad range of tools designed to 
manipulate either text (e.g. Emacs, Notepad) or XML (various XML editors, 
etc.)  Included in this list are a variety of programming libraries, API's 
such as DOM, etc.   The schema specification says nothing (I.e. places no 
restrictions) on how you might build up or edit a schema document prior to 
its use in validation.  Robin Cover's pages have lots of pointers to XML 
tools.   See:  http://www.oasis-open.org/cover/xml.html.

------------------------------------------------------------------------
Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
------------------------------------------------------------------------







Piccand Régis <regis.piccand@imtf.ch>
Sent by: xmlschema-dev-request@w3.org
12/03/01 06:20 AM

 
        To:     xmlschema-dev@w3.org
        cc:     (bcc: Noah Mendelsohn/CAM/Lotus)
        Subject:        Generating dynamic "choice" content


Hi all,

I'm pretty new to XML-schema and am wondering about dynamical generation 
of
schemas.

Let's assume I want to dynamically fill or add new elements in a choice
list, as follows :

<!-- extract from XML Schemas tutorial - Roger Costello - available at
http://www.xfront.com/-->
<xsd:element name="transportation">
                 <xsd:complexType>
                                 <xsd:choice>
                                                 <xsd:element name="train" 
type="xsd:string"/>
                                                 <xsd:element name="plane" 
type="xsd:string"/>
                                                 <xsd:element 
name="automobile" type="xsd:string"/>
                                                 ...
                                 </xsd:choice>
                 </xsd:complexType>
</xsd:element>

The "choice" elements (train, plane, automobile) should be read from a DB
and dynamically added ; the complete element definition (type, minOccurs,
maxOccurs, etc.) would be read from the DB too.

What options do I have to achieve this ? 

For now, the only option I see is to programmatically generate a schema 
for
this type and then ref it from my main schema.

I would be very grateful if any of you could give me some "pointers" to
available documents/products involving dynamic generation of schemas.

Thanks a lot in advance for your help and best regards

Régis
Received on Tuesday, 4 December 2001 17:49:40 GMT

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