473,394 Members | 1,697 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to define elements in a dtd

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 <fieldsI 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

Mar 26 '07 #1
3 1723
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
---------------------------------------------------------------------
George Cristian Bina
<oXygen/XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
On Mar 26, 6:40 pm, "Adrian" <n...@bluedreamer.comwrote:
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 <fieldsI 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

Mar 27 '07 #2
On Mar 27, 1:24 am, "George Bina" <geo...@oxygenxml.comwrote:
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.


Mar 27 '07 #3
Adrian wrote:
On Mar 27, 1:24 am, "George Bina" <geo...@oxygenxml.comwrote:
>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.
It *is* possible in a DTD, but only when using SGML, not XML.

///Peter
--
XML FAQ: http://xml.silmaril.ie/
Mar 27 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

97
by: s | last post by:
Can I do this: #define MYSTRING "ABC" .. .. .. char mychar = MYSTRING; .. .. ..
34
by: Dennis | last post by:
I would like to dynamically allocate in a sub a 2 dimensional Array float *myarray = new float ; of course I get an error. How do you allocate a 2D array using the New operator? I...
1
by: Richard A. Lowe | last post by:
I'm new to hand-coding XSD files - how can I indicate that I want to reference tags from another XSD document in a certain section of my XSD? Essentially, I want to define one XSD with some...
7
by: Roman Mashak | last post by:
Hello, All! I wonder is it possible to define an array containing strings, not single characters? What I want is array 'table' that will have N elements, and every element is a strings tailoring...
29
by: Ancient_Hacker | last post by:
It sure would be nice if I could have a macro that add a level of indirection to its argument. So if I write: AddIndirection( X ) The macro AddIndirection will do: #define X (*X) ...
10
by: Zhou Yan | last post by:
I want to define a pointer to a multiple-subscripted array. For instance, I have an array defined as below( I have reduced the size of the array as well as the dimension, but I think it OK to ask...
20
by: subramanian100in | last post by:
Suppose I have #included <stdint.h> #define MAX_LINE_SIZE SIZE_MAX or const size_t maxLineLength = SIZE_MAX ; Between the above #define and const declaration, which should be...
23
by: anon.asdf | last post by:
Hello! In the following code-snippet, is it possible to initialize each element of arr, with STRUCT_INIT? struct mystruct { int a; char b; };
5
by: suresh | last post by:
Hi, How to define a two dimensional array where each row is of type vector<map<string,int>>? My idea is, if "x" is such a variable, x is a vector where each cell of the vector is a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.