[
Lists Home |
Date Index |
Thread Index
]
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@ncmr.co.in]
Sent: Saturday, March 16, 2002 10:44 AM
To: xml-dev@lists.xml.org
Subject: [xml-dev] 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
|