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

RE: Element With Same Name


dtd same element name
Hello Raja,

One option you have with DTDs is to use a mixed content model, such as:

<!ELEMENT item (#PCDATA|Note)*>
<!ELEMENT Note (whatever)>
<!ELEMENT whatever EMPTY>

which would allow instances such as

1. <item>hello</item>

2. <item>
    <Note><whatever/></Note>
    <Note><whatever/></Note>
   </item>

3. <item>hello<Note><whatever/></Note></item>

Another option is to use RELAX NG [1] which has more expressive power than
DTDs:

<element name="item" xmlns="http://relaxng.org/ns/structure/1.0">
 <choice>
  <text/>
  <zeroOrMore>
   <element name="Note">
    <element name="whatever"><empty/></element>
   </element>
  </zeroOrMore>
 </choice>
</element>

where instances 1 and 2 are valid but 3 is not.

Mike

[1] http://www.oasis-open.org/committees/relax-ng/

-----Original Message-----
From: rajac [mailto:rajac@n...]
Sent: Saturday, March 16, 2002 10:44 AM
To: xml-dev@l...
Subject:  Element With Same Name


Hi,
   I have an Element in DTD called item ie <!ELEMENT item (#PCDATA)>. But
same Element item(in the same DTD) should be used like   <!ELEMENT item
(Note*)>.  This Note is an another Element which has a structure. So the
Element item is used in two different structures in same DTD. I tried to use
<!ELEMENT item  (ANY)>.  But it is not working. I hope that i have explained
the problem clearly. If the problem is not clear, please ask me.

Regards,
Raja


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.