Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

a basic dtd question

 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel both of the DTD specs given below give the same result. Am I right?

<!ELEMENT item (#PCDATA | item)* >
<!ELEMENT item (#PCDATA)* >
 
Deepak Sagar
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both are different.
<!ELEMENT item (#PCDATA|item)*> can include any parsed data along with other element item in it.
but in case of<!ELEMENT item (#PCDATA)*> it can only include parsed data, it cant hold any other element item in it.
it will give an error if "<" placed in side element.

please correct if iam wrong
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks.

but that part is understood.

item is anyway a parsed data right?

why not write


instead of
?

what is the difference between the two scripts given above?

Can you please help?
[ April 11, 2006: Message edited by: ArulJose ]
 
Sergey Tyulkin
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
PCDATA is parsed character data. It means, that content marked as #PCDATA will be parsed - i.e. the parser will try to recognize markup in the content. Obviously, if it encounters <item> it woul treat it as an element -item-, but the DTD says, that root element cannot have any nested elements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic