Click here to Skip to main content
15,898,732 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to make sure that I am writing the code correctly and fully understand what is needed. My biggest concern is what tags to use, (? * | ect.)

2.The element feed
2.1.The element feed starts with a required source element. Must appear exactly once. This is 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.

The element source
3.1. The element source has a required name element. Must appear exactly once.
3.2. The element source has a required url element. Must appear exactly once.
3.2.1.These two elements can appear in either order, name first or url first

The element feed-desc
4.1. The element feed-desc contains at least 1 par element. May contain more than one. Represents paragraph(s) of text.


<!ELEMENT feed (source?, feed-desc, info, stories+>
<!ELEMENT source (name, url) >
<!ELEMENT feed-desc (par+>


Thank you.

What I have tried:

check book and online tutorials.
Posted
Updated 27-Nov-19 22:24pm
v2

1 solution

Start here: DTD Tutorial[^]

More at: DTD Elements[^]
Quote:
Declaring Only One Occurrence of an Element
HTML
<!ELEMENT element-name (child-name)>


Declaring Minimum One Occurrence of an Element
HTML
<!ELEMENT element-name (child-name+)>


Declaring Zero or More Occurrences of an Element
HTML
<!ELEMENT element-name (child-name*)>


Declaring Zero or One Occurrences of an Element
HTML
<!ELEMENT element-name (child-name?)>


So, it should be something like that:
HTML
<!ELEMENT feed (source, feed-desc?, info?, stories)>
<!-- define child nodes here ... -->

Good luck!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900