DTD question about ATTLIS

Are you missing a feature? Request its implementation here.
rahul1_parekh

DTD question about ATTLIS

Post by rahul1_parekh »

Hi,



Sample of a DTD file for an XML.



<!ELEMENT SEGMENT ( SEG1 | SEG2 | SEG3 )>

<!ATTLIST SEGMENT

ACTION (ACTION1 | ACTION2)

TYPE = XYZ

>



Now if I use this dtd, then the attribute “TYPE” of the element “SEGMENT” will have the value “XYZ” for all the possible elements in the XML (i.e SEG1 or SEG2 or SEG3)



Is there any way by which I can check some condition (say for example, whether the “SEGMENT” is “SEG1” or “SEG2” or “SEG3”) and then decide the value of the attribute “TYPE” (something like if .. else) ?



Can anyone please help me ?



Thanks,



Rahul
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Rahul,

This kind of constrains cannot be enforced by a DTD. You can do this with Relax NG or with Schematron. oXygen has support for both.

Best Regards,
George
Post Reply