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

Re: Attribute as well as textvalue

From: <Noah_Mendelsohn@lotus.com>
Date: Thu, 11 Oct 2001 16:56:30 -0400
To: "Kuberean, Venkatesan (Cognizant)" <Venkatk@chn.cognizant.com>
Cc: xmlschema-dev@w3.org
Message-ID: <OFC35D669A.943EC3CC-ON85256AE2.0073469A@lotus.com>
The answers to many such questions are in the schema primer.  In this 
case, you are looking to get a complex type (can have attributes and 
element content) from a simple type (your author is basically a string). 
The primer covers this at [1].

Roughly, you would do something like:

<xsd:element name="author">
    <xsd:extension base="xsd:string">
     <!-- following defines attribute named YourAttribute
          with a type of xsd:string...define as many
          attributes as you need. --> 
     <xsd:attribute name="YourAttribute" type="xsd:string"/>

Hope this helps.   I do suggest you read the primer, as it  covers many 
questions that you will encounter as a new user of schemas.

[1] http://www.w3.org/TR/xmlschema-0/#complexTfromSimpleT

Noah Mendelsohn                                    Voice: 1-617-693-4036
Lotus Development Corp.                            Fax: 1-617-693-8676
One Rogers Street
Cambridge, MA 02142
Received on Thursday, 11 October 2001 17:05:32 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:14:54 UTC