[XMLSCHEMA-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Include multiple complex types into one element ...

From: Dragon Fly <dragon-fly999@hotmail.com>
Date: Mon, 7 Jul 2008 13:15:36 -0400
Message-ID: <BLU119-W533CE792131429CECF1728B9940@phx.gbl>
To: <xmlschema-dev@w3.org>
Include multiple complex types into one element ...
Hi,

I'm new to XSD and was wondering if I could include multiple complex types into one element.  For example, I have two complex types NameType and AddressType.

=====

  <xs:complexType name="NameType">
    <xs:sequence>
      <xs:element name="FirstName" type="xs:string" />
      <xs:element name="LastName" type="xs:string" />
    </xs:sequence>
  </xs:complexType>

  <xs:complexType name="AddressType">
    <xs:sequence>
      <xs:element name="Country" type="xs:string" />
      <xs:element name="Zip" type="xs:string" />
    </xs:sequence>
  </xs:complexType>

=====

I would like to create a root element that includes both the NameType and AddressType.  I was able to include them if I create "sub-elements" (i.e. SubA and SubB below).  However, I just want the elements in NameType and AddressType to be directly under RootInformation (without any sub-elements).  Can that be done? Thank you in advance for your help.

  <xs:element name="RootInformation">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="SubA" type="tns:NameType" />
        <xs:element name="SubB" type="tns:AddressType" />
      </xs:sequence>
    </xs:complexType>
  </xs:element>


_________________________________________________________________
It’s a talkathon – but it’s not just talk.
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_JustTalk
Received on Tuesday, 8 July 2008 18:24:30 GMT

Subscribe to the Stylus Scoop newsletter for helpful XML tips and tutorials.
Email
First Name
Last Name
Company

Download Stylus Studio 6 XML Enterprise Edition

Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2007 All Rights Reserved.