[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: (newbie) DTD question
> -----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! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|