OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]
Re: [xml-dev] DTD vs XSD: No Duplicate Types in (Mixed) Content Models

Hi Ken,

thanks for your answer, I comment inline below.

Am 31.01.11 14:36, schrieb G. Ken Holman:
> At 2011-01-31 13:56 +0100, Maik Stührenberg wrote:
>> One of my students asked me if it wouldn't be easy to simulate XML
>> Schema's minOccurs and maxOccurs by repeating the same element type
>> (element name) in the content model of its parent element, e.g.:
>> <!ELEMENT a (b, b, b)>
> ...
>> All three solutions were tolerated by the parsers I've tried. For
>> simulating minOccurs="3", maxOccurs="5" one could use the following
>> DTD solution:
>> <!ELEMENT a (b, b, b, b?, b?)>
>> To my suprise, I had no problems with the parsers I've tried.
> That surprises me as well, for the very reason you cited:
>> The interesting case is, if I have exact four occurrences of the
>> element b in an instance, resulting that my parser cannot know which b
>> in the model is being matched.
> Exactly.
>> Was this behaviour expected?
> Yes, I believe so, because of the ambiguous particles ... which way to go.

But when in mixed content models duplicate types are not allowed -- why 
are they allowed in element content models? The additional #PCDATA of a 
mixed content model should have only little effect on the question of 
determinism, or do I forget anything (maybe the whitespace characters 
that are allowed...)?
> But have you tried, for minOccurs="3" and maxOccurs="5" the W3C Schema
> equivalent of the following:
> <!ELEMENT a (b, b, b, (b, b?)?)>
> That combination is not ambiguous but gives you what you want. There is
> no doubt which of the <b> elements is being encountered.

Just for clarification: There is no specific DTD or content model that I 
need or want, I just stumbled upon this different behaviour of DTDs and 
XSDs when my student asked about it.
But your declaration is (of course) accepted by the parser because it is 
non-ambiguous. However, the question remains: why is the original

<!ELEMENT a (b, b, b, b?, b?)>

valid, too?

Again, thanks for your input.



> I hope this helps.
> . . . . . . . . Ken
> --
> Contact us for world-wide XML consulting & instructor-led training
> Crane Softwrights Ltd. http://www.CraneSoftwrights.com/x/
> G. Ken Holman mailto:gkholman@CraneSoftwrights.com
> Legal business disclaimers: http://www.CraneSoftwrights.com/legal
> _______________________________________________________________________
> XML-DEV is a publicly archived, unmoderated list hosted by OASIS
> to support XML implementation and development. To minimize
> spam in the archives, you must subscribe before posting.
> [Un]Subscribe/change address: http://www.oasis-open.org/mlmanage/
> Or unsubscribe: xml-dev-unsubscribe@lists.xml.org
> subscribe: xml-dev-subscribe@lists.xml.org
> List archive: http://lists.xml.org/archives/xml-dev/
> List Guidelines: http://www.oasis-open.org/maillists/guidelines.php


Maik Stührenberg, M.A.

Universität Bielefeld
Fakultät für Linguistik und Literaturwissenschaft
Universitätsstraße 25
33615 Bielefeld

Telefon: +49 (0)521/106-2534
E-Mail: maik.stuehrenberg@uni-bielefeld.de


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index]

News | XML in Industry | Calendar | XML Registry
Marketplace | Resources | MyXML.org | Sponsors | Privacy Statement

Copyright 1993-2007 XML.org. This site is hosted by OASIS