Newbie problem in DTD

LenS

Usenet Archive
Joined
May 29, 2005
Messages
20
Reaction score
0
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
 

Richard Tobin

Usenet Archive
Joined
Jan 6, 2000
Messages
4,251
Reaction score
0
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
 

Michael Winter

Usenet Archive
Joined
Nov 23, 2002
Messages
3,424
Reaction score
0
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
 

Peter Flynn

Usenet Archive
Joined
Jan 2, 2000
Messages
1,813
Reaction score
0
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
548,049
Messages
3,104,246
Members
248,133
Latest member
DujonT

Latest Threads

Top