Next in thread → Next in month →

Re: [xml-dev] What does it mean to lexically distinguish significant and insignificant whitespace?

From
John Cowan <>
To
Michael Kay <>
Date
2017-09-15T22:59:32Z
ID
<CABzTEQAvOq+nNRTOQw7p9eWY=>
Thread
Re: [xml-dev] What does it mean to lexically distinguish significant and insignificant whitespace?


On Wed, Sep 13, 2017 at 7:45 AM, Michael Kay <[email protected]> wrote:

What I meant by the phrase is that when you see

<a>
  <b/>
</a>

there is nothing within the document itself to tell you whether the whitespace is significant; you typically need external information (e.g. a schema or DTD, or just outside knowledge) to know.

Well, if xml:space="preserve" is present you know it's significant, and if both non-whitespace children and element children are present, the betting is that it's significant.  Otherwise, you're right, you don't know.

My utility DTDcrunch reduces an external DTD subset to just enough declarations, suitable for use as an internal subset, to provide the infoset effects of the DTD (as opposed to validation information).  Specifically:

1) An internal general entity declaration is preserved.

2) A non-CTEXT attribute declaration is preserved.

3) A CTEXT attribute declaration with a default or fixed value is preserved.

4) An element declaration with element-only content is preserved in the reduced form <!ELEMENT foo (foo)>.

The resulting document has the same infoset as the original when parsed with a non-validating parser.

-- 
John Cowan          http://vrici.lojban.org/~cowan        [email protected]
Man has no body distinct from his soul, for that called body is a portion
of the soul discerned by the five senses, the chief inlets of the soul
in this age.  --William Blake

Next in thread → Next in month →