1

Trying to achieve something like this

ATTLIST employee role (leader|analyst|leader,analyst)

where I can't change it into an element; it needs to be an attribute.

It seems like DTD doesn't like commas in its expressions.

kjhughes
  • 106,133
  • 27
  • 181
  • 240
Roy Joo
  • 11
  • 2
  • Use spaces instead of commas. That's how html class attribute works. Though technically it's simply defined as a string rather than having any structure in the xhtml DTD – slebetman May 08 '15 at 03:05

2 Answers2

1

An attribute in XML cannot contain elements.

You're really going against the grain to try to add structure to attributes in any way. If you must do it, keep it simple: You can represent a list via space or comma-separated values. Going any further runs into requiring a separate micro-parser distinct from an XML parser just to parse the attribute values. It's not a good idea, and don't expect support from DTD beyond that which is provided by NMTOKENS, IDREFS, or ENTITIES

See also: XML Element vs XML Attribute

Community
  • 1
  • 1
kjhughes
  • 106,133
  • 27
  • 181
  • 240
0

You can do :

<!ATTLIST employee role (leader|analyst|leader) "analyst">
CodeNoob
  • 345
  • 4
  • 17