Re: Whitespace

Peter@ursus.demon.co.uk (Peter Murray-Rust) wrote:

> <!ELEMENT CML (XVAR)*>
> <!ELEMENT XVAR (#PCDATA)>
> [...]
> <CML>
> <XVAR>
> A variable
> </XVAR>
> </CML>
>
> parses with sgmls to give a CML element which contains an XVAR element
> whose content is 'A variable'.  There are no other #PCDATA elements.
> I can include as much whitespace (space, newline) between tags as I like and
> the result is the same.
>
> If I write
> <!ELEMENT CML (#PCDATA|XVAR)*>
> instead  it also validates, but gives a different result, with additional
> #PCDATA elements (content '\n') on either side of the XVAR element.  If I
> use ANY as the content model of CML it does the same.
> [...]
> If all CML documents have to be presented as
>
> <CML><XVAR>A variable</XVAR></CML>
>
> this is unworkable, [...]


AFAIK, the only way to make sure that DTD-aware and DTD-unaware
processors produce the same results in the presence of element content
is to avoid inserting any "insignificant" whitespace.

Would it be acceptable to write the instance as:

    <CML
    ><XVAR
    >A variable</XVAR
    ></CML>

instead?



--jenglish@crl.com

Received on Wednesday, 7 May 1997 22:17:41 UTC