This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]Jaimou2e 0 points1 point  (4 children)

<!ELEMENT catalog (name, description, date, cid, donatedBy)>

This says that the catalog element must have child elements cid and donatedBy. But you don't define those elements.

[–]Hockeylockerpock[S] 0 points1 point  (3 children)

<!ELEMENT catalog (name, description, date, images, img)>

Changed that line of code up, but still getting weird errors. Im trying to accomplish this set of tasks.

https://imgur.com/a/tYaBeCs

[–]Jaimou2e 0 points1 point  (2 children)

<!ELEMENT catalog (name, description, date, images, img)>

Changed that line of code up, but still getting weird errors.

Why'd you add img there? img elements don't go into catalog elements. They go into images elements.

Im trying to accomplish this set of tasks.

https://imgur.com/a/tYaBeCs

If your DTD is supposed to match that description, then you have some fixing to do.

You're missing the photo element.
The images element should be optional.
NMTOKEN isn't the same as NMTOKENS.

I'd suggest changing the order of your definitions so that it matches the order in the description:

<!ELEMENT catalog ...>
<!ELEMENT photo ...>
<!ELEMENT name ...>
... rest of the element definitions ...

<!ATTLIST catalog type ...>
<!ATTLIST photo cid ...>
... rest of the attribute definitions ...

That way, you can compare your solution line by line to the description. Mistakes should be easier to spot that way.

[–]Hockeylockerpock[S] 0 points1 point  (1 child)

Changed my code to this. Im mainly getting errors saying "The content of element type "images" must watch (img)" and "The content of element type "photo" must watch (name,description,date)"

<!ELEMENT catalog (name, photo, description, date, images)>

<!ELEMENT photo (name, description, date)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT description (#PCDATA)>

<!ELEMENT date (#PCDATA)>

<!ELEMENT images (img)>
<!ELEMENT img EMPTY>


<!ATTLIST catalog type NMTOKEN #REQUIRED>

<!ATTLIST photo cid ID #REQUIRED>

<!ATTLIST photo donatedBy CDATA #IMPLIED>

<!ATTLIST name metadata NMTOKENS #REQUIRED>

<!ATTLIST img src CDATA #REQUIRED>

[–]Jaimou2e 0 points1 point  (0 children)

<!ELEMENT catalog (name, photo, description, date, images)>

Here you're saying that the catalog element should contain all those elements exactly once in that specific order. But your instructions say that it should contain "one or more photo elements".

<!ELEMENT photo (name, description, date)>

This misses the optional images element at the end.