Hi again - stuck now in Chapter 10 with a strange error message.
I'm working on developing the dtd for cameraList1.xml (noticed that the
download code didn't include the dtd, by the way....)I typed the dtd
exactly as shown in the book, except I added an element "quantity" which
the book added to cameraList1.xml but never amended in cameraList.dtd -
another strange thing that was not mentioned in the book's errata but htat
I'm assuming was an ommission?
Anyway, now when I'm attempting to view cameraList.xml, I'm getting the
error message that I "can't have more than one doctype declaration". I
don't get it....
I should also mention that when I first viewed the xml doc in my browser
while following along in the book BEFORE I even added the dtd to my
project (book was somewhat vague on the steps in this exercise),it viewed
fine - I was even able to view my quantity element before I had even added
it to the dtd! So I'm wondering what could be going on? It's like the dtd
is being read from somewhere else in my project, so the parser thinks I'm
declaring two DOCTYPEs....bizarre!
I've included code below for both the dtd and xml docs - thanks in advance
for taking a look!
Regards,
Kirsten
This is cameraList.dtd (to which I added the "quantity" element not
specified in the book):
<!ELEMENT cameraList (camera+)>
<!ELEMENT camera (name, product_id, type_id?,
price+, quantity)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT product_id (#PCDATA)>
<!ELEMENT type_id (#PCDATA)>
<!ELEMENT price (#PCDATA)>
<!ATTLIST price
currency CDATA #REQUIRED>
<!ELEMENT quantity (#PCDATA)>
]>
This is cameraList1.xml with the "quantity" element added as instructed by
the book:
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE cameraList SYSTEM "cameraList.dtd">
<?xml:stylesheet href="cameraList.css"
type="text/css" ?>
<cameraList>
<camera>
<name>WRC Supra 70</name>
<product_id>WRC00001</product_id>
<type_id>1</type_id>
<price currency="US$">100</price>
<quantity>3</quantity>
</camera>
<camera>
<name>WRC Supra 90</name>
<product_id>WRC00002</product_id>
<type_id>1</type_id>
<price currency="US$">130</price>
<quantity>8</quantity>
</camera>
<camera>
<name>WRC Mini 70</name>
<product_id>WRC00003</product_id>
<type_id>3</type_id>
<price currency="US$">190</price>
<quantity>2</quantity>
</camera>
</cameraList>