Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: whitespace in element content

From: "cr88192" <cr88192@------.-------.--->
To: NULL
Date: 11/1/2004 9:26:00 AM
"Wolfgang Jeltsch" <jeltsch@t...> wrote in message 
news:2ukruvF2bv9jrU1@u......
> Hello,
>
> it is often convenient to insert whitespace into an XML document in order 
> to
> format it nicely.  For example, take this snippet of a notional DocBook 
> XML
> document:
>
>    <para>
>      This is a longer paragraph.
>      With <wordasword>longer</wordasword> I mean that it contains more 
> than
>      one sentence.
>    </para>
>
> I want the whitespace in this snippet of code to be handled as follows:
>
>    (1) The whitespace between "<para>" and "This" as well as the 
> whitespace
>        between "sentence." and "</para>" shall be discarded.
>
>    (2) Each other sequence of adjacent whitespace characters shall be
>        transformed into a single space character.
>
> But how do XML processors and applications deal with this issue?
>
> In section 2.10 of "Extensible Markup Language (XML) 1.0 (Third Edition)",
> one can read:
>
>    In editing XML documents, it is often convenient to use "white
>    space" (spaces, tabs, and blank lines) to set apart the markup for
>    greater readability. Such white space is typically not intended for
>    inclusion in the delivered version of the document.
>
> But who decides which whitespace shall be considered as whitespace that is
> just used to set apart the markup?  And is whitespace just used to indent
> lines of text also not intended for inclusion in the delivered version?
> What is this "delivered version" of the document?
>
> I'd be thankful for any clarification.
>
my parser uses what could be called the "newline whitespace assertion", 
namely:
any initial whitespace is ignored;
any whitespace following a newline is eaten and replaced with a single space 
(unless it is the end of the text).


<foo>Hello  World
        Again</foo>

is parsed as:
<foo>Hello  World Again</foo>





transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent