0

I have an element that must contain only specific values in xml but there may be more that one of that element.However the dtd seems to be wrong(skipping irrelevant parts)

dtd

<!ELEMENT Country ( US | UK | France | Italy ) >

xml

<table>
    <details>
        <Country>US</CINEMA>
        <Country>Italy</CINEMA>
        <Country>UK</CINEMA>
    </details>

Here is the error that i get when using xmlvalidator

The content of element type "Country" must match "( US | UK | France | Italy )"
user2650277
  • 6,289
  • 17
  • 63
  • 132

1 Answers1

1

Your DTD restricts content of <Country> elements to 4 possible child elements. So example of valid <Country> elements according to the DTD would be :

<Country>
    <US></US>
</Country>
<Country>
    <Italy></Italy>
</Country>

Unfortunately, there is no way to restrict text node content inside an element using DTD. Related question : Element that can only have one of two text values?

Community
  • 1
  • 1
har07
  • 88,338
  • 12
  • 84
  • 137