N
Norm
I am creating an XML DTD, and I want to have an element that is
constrained to a set of enumerated values. My idea is to write my DTD
like this:
<!ELEMENT testEnum (mode)>
<!ELEMENT mode (mode_enabled | mode_disabled | mode_other)>
<!ELEMENT mode_enabled EMPTY>
<!ELEMENT mode_disabled EMPTY>
<!ELEMENT mode_other EMPTY>
Then an example XML document could look like this:
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<!DOCTYPE test>
<testEnum>
<mode>
<mode_disabled />
</mode>
</testEnum>
Is this a good way to do it? (Is there a standard way?) I welcome any
comments about it.
BTW, I am an XML newbie.
Thanks,
Norm
constrained to a set of enumerated values. My idea is to write my DTD
like this:
<!ELEMENT testEnum (mode)>
<!ELEMENT mode (mode_enabled | mode_disabled | mode_other)>
<!ELEMENT mode_enabled EMPTY>
<!ELEMENT mode_disabled EMPTY>
<!ELEMENT mode_other EMPTY>
Then an example XML document could look like this:
<?xml version="1.0" encoding="US-ASCII" standalone="yes"?>
<!DOCTYPE test>
<testEnum>
<mode>
<mode_disabled />
</mode>
</testEnum>
Is this a good way to do it? (Is there a standard way?) I welcome any
comments about it.
BTW, I am an XML newbie.
Thanks,
Norm