How to define elements in a dtd

A

Adrian

I cannot find a way to define an element so that it contains sub
elements in any order but only 1 of each.

I have tried a sequence of but then the order matters
I have tried a choice of 0 or more but then I can add an element in
twice.

Here is what I have tried so far
<!ELEMENT fields (type?, expiry_date?, ccmy?, commodity_name?,
exchange_symbol?, notice_date?, related_option?, action_ptr?,
double_quote_to?, double_quote_from?, retransmission?, active_index?,
title?)>


<!ELEMENT fields (type | expiry_date | ccmy | commodity_name |
exchange_symbol | notice_date | related_option | action_ptr |
double_quote_to | double_quote_from | retransmission | active_index |
title)*>


So in <fields> I want 0 or 1 of each field but I dont want to specifiy
an order for the elements in <fields>. Is this possible in a dtd
definition.

This has to be a dtd too, our xml library doesnt support schemas and
cannot be changed.


Adrian
 
G

George Bina

Hi Adrian,

No, that is not possible in a DTD. You need to either constrain the
model to a specific order as in your sequence case or define a more
relaxed model and enforce the constraints at application level.

Best Regards,
George
 
A

Adrian

Hi Adrian,

No, that is not possible in a DTD. You need to either constrain the
model to a specific order as in your sequence case or define a more
relaxed model and enforce the constraints at application level.
- Show quoted text -

Thanks George. I just assumed it was possible in the DTD.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top