Newbie problem in DTD

L

LenS

In XMLspy trying to create a simple DTD. Following is what I have;

<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT orders (order+)>
<!ELEMENT order (order_header, order_detail+, order_footer)>
<!ELEMENT order_header (order_date, po_no, credit_card, cc_no,
expire_date, bill_to, ship_to, special_instructions)>
<!ELEMENT order_date (#PCDATA)>
<!ELEMENT po_no (#PCDATA)>
<!ELEMENT credit_card EMPTY>
<!ATTLIST credit_card type_cc (Master Card|Visa|American
Express|Dinners Club|None) "None" >
<!ELEMENT cc_no (#PCDATA)>
<!ELEMENT expire_date (#PCDATA)>
<!ELEMENT salesman_no (#PCDATA)>
<!ELEMENT bill_to (company, address1, address2, city, state, zip_code)>
<!ATTLIST bill_to new_customer (No | Yes) "No" #REQUIRED chg_customer
(No | Yes) "No" #REQUIRED>
<!ELEMENT company (#PCDATA)>

Getting the following error at <!ATTLIST credit_card........;

Character '<' is grammatically unexpected in column 1 at line 8
Reason: one of the following is expected (see below)
')'
'|'
Details
XML production: Production 'Enumeration' not satisfied.

I don't see what I'm doing wrong.

Any help appreciated

Len Sumnler
 
R

Richard Tobin

LenS said:
<!ATTLIST credit_card type_cc (Master Card|Visa|American
Express|Dinners Club|None) "None" >
Character '<' is grammatically unexpected in column 1 at line 8

It's a bit of an odd error message, but the error is that the choices
for an enumerated attribute type must be name tokens - they can't
contain whitespace.

-- Richard
 
M

Michael Winter

LenS wrote:

[snip]
<!ATTLIST bill_to new_customer (No | Yes) "No" #REQUIRED chg_customer
(No | Yes) "No" #REQUIRED>

Richard Tobin covered your earlier enumerated attribute error, but the
attribute list declaration above is also incorrect: default values and
the #REQUIRED keyword are mutually exclusive.

If an attribute is required, there is no need for a default value as the
name/value pair must always be present in the attribute specification.
That is to say that an author would always have to write either

<bill_to new_customer="Yes" ...>

or

<bill_to new_customer="No" ...>

Removing the #REQUIRED keyword is probably the better choice, here.

[snip]

Mike
 
P

Peter Flynn

Richard said:
It's a bit of an odd error message, but the error is that the choices
for an enumerated attribute type must be name tokens - they can't
contain whitespace.

I'd change your parser/validator for one with better error messages.

///Peter
 

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,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top