Google Answers Logo
View Question
 
Q: XML DTDs '?', '*' - Can I constrain "1 - N"? i.e. "At Least One, Can Be Many" ( No Answer,   0 Comments )
Question  
Subject: XML DTDs '?', '*' - Can I constrain "1 - N"? i.e. "At Least One, Can Be Many"
Category: Computers > Programming
Asked by: wreilly2001-ga
List Price: $2.00
Posted: 19 Nov 2005 14:06 PST
Expires: 19 Nov 2005 14:14 PST
Question ID: 595233
Notes:
[1. Mostly looking to confirm, "No, they can't."]
[2. Would be pleased to learn of a (DTD, not Schema) work-around/kludge ? Thx.]

Question:
Do XML DTDs let me express this?  "Must be at least one, can be many."

I know that:
  foo? means 0 or 1.
  foo* means 0 or many.
  foo  means 1 (and only 1).

I would like to have a DTD to constrain these 3 data examples:

1. NO: 0 'bar'
<foo>
</foo>

2. YES: 1 'bar'
<foo>
  <bar>stuff</bar>
</foo>

3.  YES: "N" 'bar's
<foo>
  <bar>stuff a</bar>
  <bar>stuff b</bar>
</foo>


This is NOT it:
<!ELEMENT foo (bar)*>

This is NOT it, either:
<!ELEMENT foo (bar)?>

NOR this:
<!ELEMENT foo (bar)>

THANK YOU.
William Reilly
Cambridge, Mass. USA
Answer  
There is no answer at this time.

Comments  
There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy