I want to declare my DTD to force the XML node should have a value. For example I have the following XML structure.
<Employees>
<EmployeeID></EmployeeID>
<EmployeeName></EmployeeName>
<EmployeeAddress></EmployeeAddress>
</Employees>
I want the EmployeeID node value must exist for all the XMLs. So I want to create a DTD to have a value for th开发者_Go百科e XML node.
Can you make the EmployeeID be an attribute? Then you could declare it to be of type ID...
Otherwise, no, I don't think there's any way with a DTD to require its value to be a non-empty string.
Have you considered RelaxNG? It's powerful, flexible, and not difficult to learn.
精彩评论