I'm having problems with a DTD that is a modified version of an example in
the W3 schools DTD tutorial.

Problem is WDSC and the only on-line validator I can find both say it is
invalid and I cannot for the life of me see why.

Apologies if there is a dumb mistake in this - I've tried so many version
now ...

<!DOCTYPE Tools[
<!ELEMENT Tools (Product+)>
<!ELEMENT Product ( #PCDATA , Description , Quantity? , SellPrice ) >
<!ELEMENT Quantity ( #PCDATA ) >
<!ELEMENT SellPrice ( #PCDATA ) >
]>
<Tools>
<Product>00020
<Description>This is the description </Description>
<SellPrice> 20.00 </SellPrice>
</Product>

<Product>00001
<Description>A Christmas gift </Description>
<SellPrice>95.00</SellPrice>
<Quantity> 125 </Quantity>
</Product>
</Tools>

What this should represent is that there are multiple Products each of which
contains PCDATA plus a Description, Price and an optional Quantity.

If I change this line:
<!ELEMENT Product ( #PCDATA , Description , Quantity? , SellPrice ) >

To this:
<!ELEMENT Product ( #PCDATA | Description | Quantity? | SellPrice )* >

Then it validates and WDSC accepts it - but is seems such a kluge to me and
I suspect results in more elements being optional than I intend.


Jon Paris
Partner400

www.Partner400.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.