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

RE: (newbie) DTD question

  • To: "J. David Eisenberg" <catcode@c...>,"Glen Mazza" <glenmazza@y...>
  • Subject: RE: (newbie) DTD question
  • From: "Dare Obasanjo" <dareo@m...>
  • Date: Fri, 12 Jul 2002 13:45:14 -0700
  • Cc: <xml-dev@l...>
  • Thread-index: AcIp2XhBrybebpGER5a5cMfh7kZfLgACv77A
  • Thread-topic: (newbie) DTD question

dtd element sequence

> -----Original Message-----
> From: J. David Eisenberg [mailto:catcode@c...] 
> Sent: Friday, July 12, 2002 12:22 PM
> To: Glen Mazza
> Cc: xml-dev@l...
> Subject: Re:  (newbie) DTD question
> You can't redefine an element in a DTD (i.e., make it context 
> dependent). However, it is easily possible in Relax NG:
> 
> <element name="person">
>    <element name="name">
>        <element name="firstname"><text/></element>
>        <element name="lastname"><text/></element>
>    </element>
> </element>
> 
> <element name="pet">
>    <element name="name"><text/></element>
> </element>
> 
> I suspect it's possible with XML Schema as well.

Yup. 

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

 <xs:element name="family">
  <xs:complexType>
   <xs:sequence>
    <xs:element name="person" type="personType" />    
    <xs:element name="pet" type="petType" />         
   </xs:sequence>
  </xs:complexType>
 </xs:element>

 <xs:complexType name="petType">
  <xs:sequence>
   <xs:element name="name" type="xs:string"/>
  </xs:sequence>
 </xs:complexType>

 <xs:complexType name="personType">
  <xs:sequence>
  <xs:element name="name">
   <xs:complexType>
    <xs:sequence>
     <xs:element name="firstname" type="xs:string" />
     <xs:element name="lastname" type="xs:string" />
    </xs:sequence>
   </xs:complexType>
  </xs:element>
  </xs:sequence>
 </xs:complexType>

</xs:schema>


-- 
PITHY WORDS OF WISDOM 
The primary function of the design engineer is to make things difficult
for the fabricator and impossible for the serviceman.

This posting is provided "AS IS" with no warranties, and confers no
rights. 



PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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-2013 All Rights Reserved.