Reputation: 84
Can someone please point out where I am wrong... this is seriously throwing me for a loop?!?!?!
Writting a DTD for some XML coding... I keep getting an error when I parse XML
ret.dtd:2:The markup declarations contained or pointed to by the document type declaration must be well-formed.
I will post some code, and hopefully its enough for someone to offer assistance
<!DOCTYPE ret [
<!--
1. The element ret
1.1. The element ret has an attribute version that must have the value 1.0
1.2. The element ret has a required attribute date that has a text representing the date of feed.
1.3. The element ret can have 0 or more feed elements
1.4. The element ret's last element is a required doc-copyright element. The copyright statement for your company. -->
<!ELEMENT ret (feed)*>
<!ATTLIST ret version CDATA #FIXED "1.0">
<!ATTLIST ret date CDATA #REQUIRED >
<!--
2. The element feed
2.1. The element feed starts with a required source element. Must appear exactly once. The source of the feed
2.2. The element feed's second element feed-desc is optional, but if present, appears no more than once. This is a description of the feed and its source.
2.3. The element feed's third element info is optional, but if present, appears no more than once. This is additional information about the feed.
2.4. The element feed's last element is a required stories element. Must appear exactly once. A list of feed stories. -->
This is the very start of my DTD...am I missing something?
Upvotes: 0
Views: 807
Reputation: 52888
There shouldn't be an issue when using the asterisk outside the content model. The model (feed)*
should be fine. (It's fine validating with Xerces or the W3C Markup Validation Service.)
Based on the filename "ret.dtd" in the error, it looks like you're using an external DTD. An external DTD should not have a DOCTYPE declaration in it. The DOCTYPE declaration should be in the XML instance. Try removing <!DOCTYPE ret [
(and ]>
) from the DTD.
Here's another question that had the same error and was resolved by removing the duplicate DOCTYPE declaration: External referenced DTD in XML
Upvotes: 3