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

Regarding Ajith Kalambell's mock question

 
Mahesh Kumar D
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

"Using mixed content modelling for DTDs facilitates maximum flexibility since DTDs can be changed without affecting the validity of existing XML documens."
A mixed content model allows you to define an either-or pattern for elements. For instance, if the original DTD has the definition -
<ELEMENT PropertyType ( Residential | Commercial )>
assuming Residential and Commercial are other elements defined in the DTD, you can safely add another type to the mixed content model say, VacantLot.
<ELEMENT PropertyType ( Residential | Commercial | VacantLot )>
By doing so, you will not be affecting the validity of existing XML documents.

I don't that that is correct. A change in DTD will affect all the application. The change that he has given is a subset of changes that can happen but which will not affect the old XML documents. But I don't think you can assume that mixed content model will shield you from DTD changes in general.
Am I missing something here?
 
Joel Amoussou
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Mahesh,
According to XML1.0, "an element type has mixed content when elements of that type may contain character data, optionally interspersed with child elements.".
Based on the definition above, the following ARE NOT the declarations of elements with mixed content models:
<ELEMENT PropertyType ( Residential | Commercial )>
<ELEMENT PropertyType ( Residential | Commercial | VacantLot )>
To make PropertyType an element with mixed content model, you will have to do the following:
<ELEMENT PropertyType (#PCDATA | Residential | Commercial)*>
<ELEMENT PropertyType (#PCDATA | Residential | Commercial | VacantLot)*>
In general, the EBNF representation of a mixed content model is:
[51] Mixed ::= '(' S? '#PCDATA' (S? '|' S? Name)* S? ')*' | '(' S? '#PCDATA' S? ')'
You can learn about the EBNF notation in Section 6 of the XML Specification. The syntax of XML is expressed in EBNF to avoid any ambiguity or confusion.
The other issue was: can a mixed content model help DTD backward compatibility. Yes it can because as specified in XML1.0, "the types of the child elements may be constrained, but not their order or their number of occurrences".
Joel Amoussou
XML Instructor
IBM XML Certification Practice Test
http://www.xmlmentor.net/xmlexamsim.htm
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic