tags:

views:

18

answers:

1

Hi,

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 the XML node.

+1  A: 

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.

LarsH