1

I need to create an XML DTD that should validate XML documents like this

<document>
     <book>
        <title>
            A wild title
        </title>
        <category>
            Fantasy
        </category>
    </book>
</document>

I did so:

<!DOCTYPE document[
    <!ELEMENT document(book)>
    <!ELEMENT book(title, category)>
    <!ELEMENT title(#PCDATA)>
    <!ELEMENT category(#PCDATA)>

I would like that the value of 'category' is chosen from a finite set (i.e. "Fantasy", "Classics", "Modern"). Is this possible?

unor
  • 92,415
  • 26
  • 211
  • 360
Ewybe
  • 395
  • 2
  • 4
  • 15

0 Answers0