DTD

Hi! to all

Does anybody know how to create a DTD Definition with the following source

<CHECKOUTLIST>

<OPERATOR NAME = "Sally Tompson" STAFFID = "334561Q"/>

<CUSTOMERLIST>

<CUSTOMER CHECKINTIME = "34556" CHECKOUTTIME = "34565"/>

<PAYMENT TYPE = "Cash" AMOUNT = "457"/>

<VOUCHERS AMOUNT ="120"/>

<LOYALTYCARD ID = "ERT558"/>

</CUSTOMER >

<CUSTOMER CHECKINTIME = "34590" CHECKOUTTIME = "34602"/>

<PAYMENT TYPE = "CreditCard" AMOUNT = "8899"/>

<VOUCHERS AMOUNT ="0"/>

</CUSTOMER >

CUSTOMER CHECKINTIME = "34604" CHECKOUTTIME = "34612"/>

<PAYMENT TYPE = "Switch" AMOUNT = "2310"/>

<VOUCHERS AMOUNT ="0"/>

<LOYALTYCARD ID = "ERU770"/>

</CUSTOMER >

CUSTOMER CHECKINTIME = "34615" CHECKOUTTIME = "34619"/>

<PAYMENT TYPE = "Switch" AMOUNT = "3455"/>

<VOUCHERS AMOUNT ="25"/>

<LOYALTYCARD ID = "ERZ669"/>

</CUSTOMER >

</CUSTOMERLIST>

</CHECKOUTLIST>

Thanks

[1152 byte] By [pep1a] at [2007-11-27 7:05:40]
# 1
DTD? I want an XMLSchema!
Hippolytea at 2007-7-12 18:56:54 > top of Java-index,Java Essentials,New To Java...
# 2
I want RELAX.
DarumAa at 2007-7-12 18:56:54 > top of Java-index,Java Essentials,New To Java...
# 3
What's Schema or RELAX?
pep1a at 2007-7-12 18:56:54 > top of Java-index,Java Essentials,New To Java...
# 4
> I want RELAX.Don't get filestream started on Frankie Goes To Hollywood.
Hippolytea at 2007-7-12 18:56:54 > top of Java-index,Java Essentials,New To Java...
# 5
> What's Schema or RELAX?They are things you should know about before saying you want a DTD.
DrClapa at 2007-7-12 18:56:54 > top of Java-index,Java Essentials,New To Java...
# 6
> What's Schema or RELAX? http://www.w3.org/XML/Schema http://www.xml.gr.jp/relax/
Hippolytea at 2007-7-12 18:56:54 > top of Java-index,Java Essentials,New To Java...
# 7
l know that l use this >import org.xml.sax.*;to read the source from a text file
pep1a at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...
# 8
You can do that, but that has little to do with a DTD. That is, you can use SAX to read an XML file, with or without validation against a DTD.Do you know what a DTD is?
paulcwa at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...
# 9
Yes please
pep1a at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...
# 10
Are you really sure you know what a DTD is?
paulcwa at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...
# 11

OK this is my DTD, but it doesn't work

<?xml version= "1.0" standalone = "yes"?>

<!DOCTYPE CHECKOUTLIST[

><!ELEMENT CHECKOUTLIST (OPERATOR,CUSTOMERLIST)>

<!ELEMENT OPERATOR (#PCDATA)>

<!ELEMENT CUSTOMERLIST (#PCDATA)>

[<!ELEMENT CUSTOMER (PAYMENT*,VOUCHERS*, LOYALTYCARD*)>

<!ELEMENT PAYMENT (#PCDATA)>

<!ELEMENT VOUCHERS (#PCDATA)>

<!ELEMENT LOYALTYCARD (#PCDATA)>

<!ATTLIST OPERATOR NAME CDATA #REQUIRED

STAFFID CDATA #REQUIRED >

<!ATTLIST CUSTOMER CHECKINTIME CDATA #REQUIRED

CHECKOUTTIME CDATA #REQUIRED >

<! ATTLIST PAYMENT TYPE CDATA #REQUIRED

AMOUNT CDATA #REQUIRED>

<!ATTLIST VOUCHERS AMOUNT #REQUIRED

><! ATTLIST LOYALTYCARD ID CDATA #REQUIRED

]>

<CHECKOUTLIST>

<OPERATOR NAME = "Sally Tompson" STAFFID = "334561Q"/>

<CUSTOMERLIST>

<CUSTOMER CHECKINTIME = "34556" CHECKOUTTIME = "34565"/>

<PAYMENT TYPE = "Cash" AMOUNT = "457"/>

<VOUCHERS AMOUNT ="120"/>

<LOYALTYCARD ID = "ERT558"/>

</CUSTOMER >

<CUSTOMER CHECKINTIME = "34590" CHECKOUTTIME = "34602"/>

<PAYMENT TYPE = "CreditCard" AMOUNT = "8899"/>

<VOUCHERS AMOUNT ="0"/>

</CUSTOMER >

CUSTOMER CHECKINTIME = "34604" CHECKOUTTIME = "34612"/>

<PAYMENT TYPE = "Switch" AMOUNT = "2310"/>

<VOUCHERS AMOUNT ="0"/>

<LOYALTYCARD ID = "ERU770"/>

</CUSTOMER >

CUSTOMER CHECKINTIME = "34615" CHECKOUTTIME = "34619"/>

<PAYMENT TYPE = "Switch" AMOUNT = "3455"/>

<VOUCHERS AMOUNT ="25"/>

<LOYALTYCARD ID = "ERZ669"/>

</CUSTOMER >

</CUSTOMERLIST>

</CHECKOUTLIST>

pep1a at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...
# 12
Please try using the [code] [/code] or the [pre] [/pre] tags. That will keep the forum software from tactlessly redacting your DTD.
kevjavaa at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...
# 13

How do you know it doesn't work? In which manner does it fail to work?

Just glancing at it, it looks syntactically incorrect. Are you getting syntax errors at some point?

I believe that w3.org has a DTD validator. Have you tried running it through that? Did you fix the error messages it showed you?

paulcwa at 2007-7-12 18:56:55 > top of Java-index,Java Essentials,New To Java...